android - MediaPlayer not playing live stream for some audio file -
some audio file url not playing in mediaplayer here code
mediaplayer = new mediaplayer(); if (mediaplayer != null) { try { string audiourl = constants.audiolink.tostring().replace(" ", "%20"); mediaplayer.setdatasource(audiourl); mediaplayer.prepareasync(); mediaplayer.setonerrorlistener(new mediaplayer.onerrorlistener() { @override public boolean onerror(mediaplayer mediaplayer, int i, int i1) { progressdialogs.getinstance().closedialog(); toast.maketext(audioplayactivity.this, "failed load audio", toast.length_short).show(); return false; } }); mediaplayer.setonpreparedlistener(new mediaplayer.onpreparedlistener() { @override public void onprepared(mediaplayer mediaplayer) { progressdialogs.getinstance().closedialog(); finaltime = mediaplayer.getduration(); seekbar.setmax((int) finaltime); seekbar.setclickable(false); play(); duration.setvisibility(view.visible); } }); } catch (exception e) { e.printstacktrace(); } }
i noticed small audio files played large audio file not playing. try ffmpegmediaplayer library intead of mediaplayer large audio file played apk file size increase 32 mb. can't use ffmpegmediaplayer play audio through url. please suggest me best library or native code play large audio file live stream.
thanks in advance
i use following library
compile 'com.devbrackets.android:exomedia:3.1.1'
now large file playing perfectly.
use
import com.devbrackets.android.exomedia.emaudioplayer; private emaudioplayer mediaplayer;
Comments
Post a Comment