java - LibVLC MediaPlayer Controllers in Android -
i'm using libvlc in android application.
i trying create own application using compiled vlc libraries. worked several hours , managed use vlc library provided mrmaffen in project.
i streaming video vlc player , video/audio working fine in application thing want setup mediacontrollers in application so, may able play, pause, seekforward, rewind, seekbackwards video.
here java code vlc player:
public class videovlcactivity extends activity implements ivideoplayer { private static final string tag = videovlcactivity.class.getsimplename(); // size of video private int mvideoheight; private int mvideowidth; private int mvideovisibleheight; private int mvideovisiblewidth; private int msarnum; private int msarden; private surfaceview msurfaceview; private framelayout msurfaceframe; private surfaceholder msurfaceholder; private surface msurface = null; private libvlc mlibvlc; private string mmediaurl; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); log.d(tag, "videovlc -- oncreate -- start ------------"); setcontentview(r.layout.activity_video_vlc); msurfaceview = (surfaceview) findviewbyid(r.id.player_surface); msurfaceholder = msurfaceview.getholder(); msurfaceframe = (framelayout) findviewbyid(r.id.player_surface_frame); mmediaurl = getintent().getextras().getstring("videourl"); try { mlibvlc = new libvlc(); mlibvlc.setaout(mlibvlc.aout_audiotrack); mlibvlc.setvout(mlibvlc.vout_android_surface); mlibvlc.sethardwareacceleration(libvlc.hw_acceleration_full); mlibvlc.init(getapplicationcontext()); } catch (libvlcexception e){ log.e(tag, e.tostring()); } msurface = msurfaceholder.getsurface(); mlibvlc.attachsurface(msurface, videovlcactivity.this); mlibvlc.playmrl(mmediaurl); } @override protected void ondestroy() { super.ondestroy(); // mediacodec opaque direct rendering should not used anymore since there no surface attach. mlibvlc.stop(); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_video_vlc, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } public void eventhardwareaccelerationerror() { log.e(tag, "eventhardwareaccelerationerror()!"); return; } @override public void setsurfacelayout(final int width, final int height, int visible_width, int visible_height, final int sar_num, int sar_den){ log.d(tag, "setsurfacesize -- start"); if (width * height == 0) return; // store video size mvideoheight = height; mvideowidth = width; mvideovisibleheight = visible_height; mvideovisiblewidth = visible_width; msarnum = sar_num; msarden = sar_den; log.d(tag, "setsurfacesize -- mmediaurl: " + mmediaurl + " mvideoheight: " + mvideoheight + " mvideowidth: " + mvideowidth + " mvideovisibleheight: " + mvideovisibleheight + " mvideovisiblewidth: " + mvideovisiblewidth + " msarnum: " + msarnum + " msarden: " + msarden); } @override public int configuresurface(android.view.surface surface, int i, int i1, int i2){ return -1; }
}
someone please tell me lines of code should add in application. after setting mediacontrollers additional question can stream recorded videos nvr. if so, please tell me how can stream recorded video nvr in media player.
Comments
Post a Comment