gpt4 book ai didi

android - 无法在Android设备上播放音频

转载 作者:行者123 更新时间:2023-12-02 23:54:44 28 4
gpt4 key购买 nike

我想做这样的事情:

    <audio controls>
<source src="media/blablabla.mp3" type="audio/mpeg"></source>
</audio>

我在本地主机:8080 / console上运行我的应用程序,并且该应用程序正常运行(可以播放音乐)。但是,当我在设备上运行该应用程序时,音乐无法播放。

我的设备操作系统是Android 4.1.2

最佳答案

看到这个问题的答案:IBM Worklight 6.1 - Unable to play a local media file using Cordova

复制并粘贴我的答案:

... for playing a local media file, you need to provide the full path to the media file's location where it'll be in the generated Android project. For example, if you create a common\audio folder in the Worklight application and place a .mp3 file in it, you need to use the following path (in the HTML or JavaScript, or however you'd like...):

<a href="#" onclick="playAudio('/android_asset/www/default/audio/myMediaFile.mp3');">Play Audio</a>

Sample project: Android Cordova Media API

关于android - 无法在Android设备上播放音频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17774559/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com