2
votes

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

1
i have build a streaming app with shoutcast in cordova , can you give me a sample m3u8 file , i will check with my plugin , if it works will provide you with that solutionThe Blue Shirt Developer
35.154.5.85:1935/vod/mp3:file.mp3/playlist.m3u8Tapas
@Tapas May be the easiest solution I could think of is to use the cordova media plugin in case of iOS platform and try out using this plugin - github.com/frontyard/cordova-plugin-exoplayer which plays m3u8 file in android platform. You can use device plugin to detect the current platform. This will also have minimal impact on you existing working appGandhi
@Gandhi I liked your idea, let me check if it works and I'll reward you the bounty in case it works. :)Tapas
@Tapas This should work out. anyways keep me posted so that i can post the answer.CheersGandhi

1 Answers

3
votes

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.