[
https://issues.apache.org/jira/browse/CB-6003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13899733#comment-13899733
]
cesine commented on CB-6003:
----------------------------
Here is my workaround, until I have time to figure out what might have been
responsible for adding "android_asset/www" to the files in the first place, and
what might be stripping it.
https://github.com/cesine/montage-chrome-app/commit/dcc71c83a3523d1dc33d297240d5c75fc80f2d2d
org/apache/cordova/media/AudioPlayer.java
{code}
private void loadAudioFile(String file)
...
try {
this.player.prepare();
} catch (Exception e) {
Log.v("DebuggingAudio",
"Exception while preparing the audio file " + file);
e.printStackTrace();
/* try it in the assets folder */
file = "www/" + file;
try {
android.content.res.AssetFileDescriptor fd =
this.handler.cordova
.getActivity().getAssets().openFd(file);
this.player.setDataSource(fd.getFileDescriptor(),
fd.getStartOffset(), fd.getLength());
this.setState(STATE.MEDIA_STARTING);
this.player.setOnPreparedListener(this);
this.player.prepare();
} catch (Exception ex) {
Log.v("DebuggingAudio",
"Exception while preparing the audio file and assuming
its in the assets folder "
+ file);
ex.printStackTrace();
}
}
{code}
> Cant play files from the assets folder Android
> ----------------------------------------------
>
> Key: CB-6003
> URL: https://issues.apache.org/jira/browse/CB-6003
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin Media
> Environment: Android
> Reporter: cesine
> Labels: audio
>
> I've been trying to pin this down.
> I think this commit brings me to conclude something is odd with playing audio
> from assets on android.
> https://github.com/cesine/TestingCordovaAudio/commit/9556fd523f68c6ec2f4659b9476f3e39a3199c33
> The same audio file plays fine
> * if its played from a http:// url
> * if its played in Native Android
> Tested with Android 4.3, I would be ecstatic if it was just my tablet but I
> dont have any others to test with right now...
> {code}
> $ cordova --version
> 3.3.1-0.1.2
> {code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)