Software Archive
Read-only legacy content
17061 Discussions

Sound not playing on device

Manasse_B_
Beginner
723 Views

Hi intel, I new to XDK, but anyway I succeded to convert an html website into an .apk. 
My issue: I have many wav files embeded in my site trough the default HTML5 audio player which I enabled with the help of the "player" plugin. When I am testing the player in the emulator it works fine, plays the file without problems. After I build the app, the player is there but it is inactive on the device as if there would be no .wav file loaded. Any help would be apreciated!

I am usig the following code to call the player:

<audio class="widget uib_w_2 d-margins" data-uib="media/audio" data-ver="0" controls="controls">
<source src="sounds/soundfile.wav" type="audio/wav"> </audio>

0 Kudos
6 Replies
PaulF_IntelCorp
Employee
723 Views

Take a look at this demo app, it shows two ways to play the audio files, probably how you reference the files is the problem. Note that the <audio> tag does not work on many older devices. Best bet is to use Crosswalk for Android if you want that to work reliably, or use the Cordova Media function or one of the many third-party plugins out there.

0 Kudos
Ian_Devlin
Beginner
723 Views

Also, the wav format is not well supported by browsers that even do support <audio>. You'd be better off using mp3 and ogg.

0 Kudos
Manasse_B_
Beginner
723 Views
Thak you for the advices! Now I am having another issue: I converted a single index.html file with a couple of mp3's usig the crosswalk option, it all worked fine on the device. When I am converting my whole project which includes sub pages and more mp3's I am getting the "app unfortunately stopped" message on device. Any suggestions? I also would like to tell you that when I am converting the same project with only the android option it doesen't give the error but this way it doesen't play the sound files.
0 Kudos
Manasse_B_
Beginner
723 Views
Thank you for the advices! Now I am having another issue: I converted a single index.html file with a couple of mp3's usig the crosswalk option, it all worked fine on the device. When I am converting my whole project which includes sub pages and more mp3's I am getting the "app unfortunately stopped" message on device. Any suggestions? I also would like to tell you that when I am converting the same project with only the android option it doesen't give the error but this way it doesen't play the sound files.
0 Kudos
PaulF_IntelCorp
Employee
723 Views

Try using the Debug tab to figure out where those messages are coming from. It runs your app in Crosswalk.

0 Kudos
Ian_Devlin
Beginner
723 Views

I don't know if this is connected or not, but it might also be worth adding preload="none" to all of the <audio> declarations to prevent the app from trying to start loading all your sound files in one go. In the web world Chrome has a problem with this, as it has a limit of 6 or so, so it's possible that this is also a problem here?

Just a thought.

 

0 Kudos
Reply