Tapas
Tapas

Reputation: 1193

Error in cordova-plugin-media while playing m3u8 file

I'm building a music application with capabilities to stream audio from hosted streaming server. But I'm not able to find any cordova plugin which enables me to stream audio inside application. I have tried using cordova-plugin-media, but it gives error code 1 in android for .m3u8 files.

To summarise what I have already tried:

  1. I have tried HTML audio and video tags but they don't support mp3 streaming m3u8 file links.
  2. I have tried cordova-plugin-streaming-mediabut it plays the music in default music player installed in device. What I want is playing in-app music which custom UI.
  3. I also tried using cordova-plugin-media, it works fine in iOS app but gives error code 1 in android for same m3u8 file.

Can somebody point me in right direction?

Thanks

Upvotes: 2

Views: 1523

Answers (1)

Gandhi
Gandhi

Reputation: 11935

As you have already mentioned that the app works fine in iOS with cordova media plugin, the easiest and minimal change that needs to be done to make this work in Android is to use the exoplayer plugin that has the capability to play m3u8 files.

You can make use of the Cordova device plugin to identify the device platform and invoke Cordova media plugin for iOS and exoplayer plugin for Android. This should do the trick for you.

Upvotes: 3

Related Questions