android - Adding SubtitleUrl is killing my app(ANR) -
hi guys may sound bit silly, when i'm loading hls stream url android videoview player begins streaming video fine, when add subtitle url same app crashes when seek, lose complete control on app , video stream not stop playing(i.e keeps playing in background).
this i'm doing.(pls me figure out mistake im doing.thanks in advance)
mvideoview.setvideouri(uri.parse(mprofileurl)); mvideoview.setmediacontroller(new mediacontroller(this)); if (null != msubtitleurl && android.os.build.version.sdk_int >= android.os.build.version_codes.kitkat) { new addsubtitleasync().execute(msubtitleurl); } } //*************************************************************************** class addsubtitleasync extends asynctask<string, void, inputstream> { progressdialog pd; @override protected void onpreexecute() { // pd = progressdialog.show(mparentnotifier.getparentactivty(), "", "", false, false); } @suppresslint("newapi") @override protected void onpostexecute(inputstream inputstream) { // if (pd != null && pd.isshowing()) // pd.dismiss(); if (null != inputstream) { mvideoview.addsubtitlesource(inputstream, mediaformat.createsubtitleformat("text/vtt", locale.english.getlanguage())); } // mparentnotifier.enablemainmenulayout(false); mvideoview.requestfocus(); // mvideoview.start(); if (mmoviestartpoint > 0) { timer mtimer = new timer(); mtimer.schedule(new timertask() { @override public void run() { mvideoview.seekto(mmoviestartpoint); mvideoview.start(); } }, 5000); // mvideoview.seekto(15 * 60 * 1000); // mvideoview.setvisibility(view.invisible); } } @override protected inputstream doinbackground(string... params) { inputstream inputstream = null; try { httphandler http = new httphandler(); inputstream = http.getcontent(params[0]); } catch (exception e) { e.printstacktrace(); } return inputstream; } }
Comments
Post a Comment