android - mediacontroller does not work on nexus 7 tab -


i have android code playing video using videoview , control buttons such pause,rewind , forward using mediacontroller. works on nexus s many samsung phones, mediacontroller buttons dont seem work on nexus 7! need work on devices. there need do?

mediacontroller mediacontroller = new mediacontroller(activity.this); mediacontroller.setanchorview(videoview); uri video = uri.parse("path/to/video"); videoview.setmediacontroller(mediacontroller); videoview.setvideouri(video); videoview.start(); 

just stumbled upon answer in unable pause/forward/backward video using mediacontroller in android. lg devices seem have issue well.

as mentioned @vineela yarlagadda, need override videoview methods below

@override public boolean canseekforward() {     return true; }  @override public boolean canseekbackward() {     return true; }  @override public boolean canpause() {     return true; } 

tested & works on nexus 7.


alternate solution: use surfaceview instead of videoview suggested in sample code in apidemos.

 setcontentview(r.layout.media_player2);  msurface = (surfaceview) findviewbyid(r.id.surface);  holder = msurface.getholder();  holder.addcallback(this);   mmediaplayer = new mediaplayer();  mmediaplayer.setdatasource(stream);  mmediaplayer.setdisplay(holder);  mmediaplayer.prepareasync();  mcontroller = new mediacontroller(this);  mmediaplayer.setonbufferingupdatelistener(this);  mmediaplayer.setoncompletionlistener(this);  mmediaplayer.setonpreparedlistener(this);  mmediaplayer.setaudiostreamtype(audiomanager.stream_music);  mcontroller.setmediaplayer(this);  mcontroller.setanchorview(msurface); 

i opened bug code.google.com/p/android/issues/detail?id=59776 after encountering same issue @kriswiz when used videoview , player. video play on nexus 7 , on samsung nexus now.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -