Software Archive
Read-only legacy content
17060 Discussions

HTML audio player unable to play MP3 files.

Mikael_L_
Beginner
812 Views

Sorry in advance for this stupid question as im a new user of Intel XDK and have only had it for 4 days or so.

So I have for a day or two now tried to get the standard HTML audio player to play MP3 files in Intel XDK.

My folders are structured like this:

repository.PNG
Inside the music folder I have placed a Mp3 file called "song.mp3". But after I have added the audio player it wont play the Mp3 file. I have tried it both with the emulator and actually made a android build and tried it on my Sony Xperia Z3 compact but it wont work on neither of them.
All the buttons on the audio player just becomes grey like there isnt anything to play and no matter what I do it wont work. I have tried using a .wav files instead (of the same song, just converted) and then it works.

The code for the audio player looks like this. And it's written inside the "index.html" file so the source file path should be "music/song.mp3" if im not misstaken right?

<audio class="widget uib_w_1 d-margins" data-uib="media/audio" data-ver="0" controls="controls">
                <source src="music/song.mp3" type="audio/mpeg">
</audio>

I have tried writing the code in myself and using the designer but neither seems to work. I dont want to use .wav files because (correct me if im wrong) but not all phones support .wav format files.

What am I doing wrong? 
Is this a bug or common problem?

Sorry in advance if this thread got placed in the wrong section.


Thanks in advance!

0 Kudos
3 Replies
John_H_Intel2
Employee
812 Views

Have you enabled to correct plugins for the app? You can do this under Projects tab, Cordova plugins.

0 Kudos
Mikael_L_
Beginner
812 Views

Exactly which plugin do you have in mind? I have enabled the "Player" plugin in the Cordova plugin menu

0 Kudos
Amrita_C_Intel
Employee
812 Views

Look at the sample Audio player. You can get an overview.

https://github.com/gomobile/sample-audio-player

0 Kudos
Reply