Software Archive
Read-only legacy content

Playable audio formats with Apache Cordova Media Plugin

Joan_A_
Beginner
1,920 Views

Hello,

Does anyone know what are the audio formats that can be played by Apache Cordova Media plugin (https://github.com/apache/cordova-plugin-media)?

Does the Apache Cordova Media plugin support the same formats as the Audio API (HTML5) would support? What if the Audio API is not supported? Will the Apache Cordova Media plugin still work? How to know or check the formats supported?

Thank you in advance,
 Joan

0 Kudos
8 Replies
Amrita_C_Intel
Employee
1,920 Views

Hi Joan,

First of all you can take look of one of our sample to understand how it works.

Here is the link: https://github.com/gomobile/sample-audio-player

.wav and .ogg files are the only ones compatible with the emulator. However, you can use .mp3 files without issues except that you should test on a built app or app preview. 

0 Kudos
Joan_A_
Beginner
1,920 Views

Hello,

Thanks for your reply.

That sample seems to use the Cordova Native Audio Plugin instead of the Cordova Media Plugin. Right?

My code already works well and plays audio files without problem. As you said, MP3 files are not supported by the emulator but they work in my Android device (Sony Xperia Z3).

I have successfully played MP3, OGG, WAV and some more. But I only have a phone to test. Maybe some formats I tried are not supported by another different device. So I need a method to know what formats are supported by the device which is currently running the app.

I just would like to know whether the audio formats supported depend on the Cordova Media Plugin or depend on the system/platform. If it depends on the system, where can I find a list of the compatible audio formats for each system? Are the formats supported by the Cordova Media plugin the same supported ones by the HTML5 Audio API? Iin such a case, I could use the canPlayType() method of the Audio object.

In other words, will the canPlayType() method give me the information I need to know whether the Cordova Media plugin can play an audio format in the current system the app is running or not?

Thank you.

Cheers,

 Joan

0 Kudos
Amrita_C_Intel
Employee
1,920 Views

Are you building with crosswalk or Android?

0 Kudos
Amrita_C_Intel
Employee
1,920 Views

And can you explain what is Cordova Native Audio Plugin vs Cordova Media Plugin?

Emulator is just a simulator. There are some limitations just check out this link: https://software.intel.com/en-us/xdk/docs/dev-emulator

Try to build with crosswalk and use either build or debug tab to see the actual behavior of the app.

0 Kudos
Joan_A_
Beginner
1,920 Views

Cordova Native Audio plugin and Cordova Media plugin are two totally different plugins for Apache Cordova.

I think maybe I did not express myself clearly. I just want to know what formats are supported by the Apache Cordova Media plugin. Not only on my device but in all other devices. There must be a way to check what formats are supported by the device which is running the app.

0 Kudos
Joan_A_
Beginner
1,920 Views

Yes, I am the owner of that post in Stackoverflow. But no body provided a good answer so far.

0 Kudos
Amrita_C_Intel
Employee
1,920 Views

Hi,

As Paul indicated it is platform based. It really depends on what platform you are using.

0 Kudos
Reply