cordova-plugin-nativeaudio
cordova-plugin-nativeaudio copied to clipboard
How to play file:///data/data/com.ionicframework.testapp123/files/2887.mp3
Hi, I tried playing this file which I have downloaded using native file transfer plugin but it seems to append www/ in front to the url and it raises an exception called java.io.FileNotFoundException:
is there any flag which I need to add or is it not possible to play audio which is not inside www/ ?
Same Issue here.
Same issue.
I had the same problem. After some research, I've decided that what we're trying to do is impossible. This plugin uses the AssetManager class to get access to audio files (see here in the source). The description of this class says explicitly:
This class presents a lower-level API that allows you to open and read raw files that have been bundled with the application...
So, basically, you can't play an audio file that has been downloaded by the app itself since it can't be retroactively bundled into the APK.
Instead, use the Media plugin. Here's an example.
@morphatic I realised the same. Howerver, it is not a good option for me to use Media plugin since I need both a html5 video player and the audio to run at the same time. Only one can be running at a time :(
@Xixiao007 are you sure? I am able to play more than one audio file at the same time using the Media plugin, so I'm thinking you should be able to play separate video and audio files at the same time. I don't have any examples, though, of how to do this.
@morphatic Probably media plugin supports multiple audio playing in parallel. However, I need to play a video in html5 video. By given this, playing both html5 video and audio from Media plugin does not work. One will make the other stop :(
Hi can you add a boolean to the preload method that leave the choice between absolute or relative path. if it is true the path is absolute then you don't add the www/ folder in the begin of path and if false the path is relative and you can add the cordova.file.applicationDirectory www/?
thank you
same issue here please help me.
user H5 audio