I am using trying to have inline html5 audio in my Windows Phone 8.1 app. The source of the audio is in the application package. This works fine for iOS and android but on Windows Phone 8.1 I see “Invalid Source” instead of the play bar.
I have searched extensively on what the path SHOULD be.
src="audio/L03T01P040a_v2.mp3
src="ms-appx:///audio/L03T01P040a_v2.mp3
Neither work. The standard relative path produces “Invalid Source” in place of the controls. The ms-app path produces “Aborted” instead of the controls.
If I use a url to a hosted fie it works fine. This leads me to think it’s a problem with accessing the file in the package.
The attached image shows several variations of the trying to play the audio with no success.
Thanks
I have searched extensively on what the path SHOULD be.
src="audio/L03T01P040a_v2.mp3
src="ms-appx:///audio/L03T01P040a_v2.mp3
Neither work. The standard relative path produces “Invalid Source” in place of the controls. The ms-app path produces “Aborted” instead of the controls.
If I use a url to a hosted fie it works fine. This leads me to think it’s a problem with accessing the file in the package.
The attached image shows several variations of the trying to play the audio with no success.
Thanks
- 5 Posts
- 0 Reply Likes
Posted 5 years ago
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
Mike,
to be clear are you using Phonegap Build or CLI?
FWIW I added the tag "phonegap framework"
to be clear are you using Phonegap Build or CLI?
FWIW I added the tag "phonegap framework"
- 1840 Posts
- 78 Reply Likes
- 1840 Posts
- 78 Reply Likes
Hi Mike,
Try using the full path to the audio file, including the protocol name.
-yiming
Try using the full path to the audio file, including the protocol name.
-yiming
- 5 Posts
- 0 Reply Likes
Hi,
If i use a full path to a hosted file it works fine. The issue comes up when i try to use a path to a file packaged with the app. Microsoft documentation says to use a path like below but that is not working
ms-appx:///audio/L03T01P040a_v2.mp3 - This produces "Aborted".
If i use a full path to a hosted file it works fine. The issue comes up when i try to use a path to a file packaged with the app. Microsoft documentation says to use a path like below but that is not working
ms-appx:///audio/L03T01P040a_v2.mp3 - This produces "Aborted".
- 1840 Posts
- 78 Reply Likes
Hi Mike,
Try playing the audio files using the Media plugin instead of the audio tag:
https://github.com/apache/cordova-plugin-media
-yiming
Try playing the audio files using the Media plugin instead of the audio tag:
https://github.com/apache/cordova-plugin-media
-yiming
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
@Mike, playing audio back via the
<audio> is inconsistent. I have done this on Android (various version), and iOS 8. Use the plugin. Here is some example code: https://github.com/jessemonroy650/Pho...- 5 Posts
- 0 Reply Likes
Yi and Jesse, thanks for the suggestion and the sample code. still not working but at least now i am getting some feedback from the app.
The relative path produces error code 1, Aborted.
If I use "ms-appx:///" in the path a code of 5 is produced. I can't seem to find what that code means.
The relative path produces error code 1, Aborted.
If I use "ms-appx:///" in the path a code of 5 is produced. I can't seem to find what that code means.
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
Try putting the code error, verbatim, into google.
- 14 Posts
- 0 Reply Likes
Try this. I have the same problem with the videos, but audios are working fine:
var mypath = location.pathname;
var idx = mypath.lastIndexOf('/');
mypath = mypath.substring(0, idx + 1);
AUDIO_PATH = mypath + "audio/";
// Media = cordova-plugin-media
var sound = new Media(AUDIO_PATH + 'filename.mp3', onSuccess, onError);
sound.play();
var mypath = location.pathname;
var idx = mypath.lastIndexOf('/');
mypath = mypath.substring(0, idx + 1);
AUDIO_PATH = mypath + "audio/";
// Media = cordova-plugin-media
var sound = new Media(AUDIO_PATH + 'filename.mp3', onSuccess, onError);
sound.play();
Related Categories
-
PhoneGap Framework
- 2926 Conversations
- 61 Followers
-
PhoneGap Build
- 15111 Conversations
- 275 Followers



