java - Video does display in android emulator -
video not display while run project. push a.mp4 file in file explore -> mnt -> sdcard -> a.mp4 still videos not play while run project. please me mistake in below code.
public class mainactivity extends activity { videoview video_player_view; surfaceview sur_view; mediacontroller media_controller; displaymetrics dm; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } public void getinit() { video_player_view = (videoview)findviewbyid(r.id.videoview1); media_controller = new mediacontroller(this); dm = new displaymetrics(); this.getwindowmanager().getdefaultdisplay().getmetrics(dm); int height = dm.heightpixels; int width = dm.heightpixels; video_player_view.setminimumheight(height); video_player_view.setminimumwidth(width); video_player_view.setmediacontroller(media_controller); video_player_view.setvideopath("/mnt/sdcard/a.mp4"); video_player_view.start(); } }
u didnt call getinit() method
public class mainactivity extends activity { videoview video_player_view; surfaceview sur_view; mediacontroller media_controller; displaymetrics dm; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main);\ getinit(); } public void getinit() { video_player_view = (videoview)findviewbyid(r.id.videoview1); media_controller = new mediacontroller(this); dm = new displaymetrics(); this.getwindowmanager().getdefaultdisplay().getmetrics(dm); int height = dm.heightpixels; int width = dm.heightpixels; video_player_view.setminimumheight(height); video_player_view.setminimumwidth(width); video_player_view.setmediacontroller(media_controller); video_player_view.setvideopath("/mnt/sdcard/a.mp4"); video_player_view.start(); } }
the emulator have issues playing videos, have done video testing on actual devices. when video work on emulator, typically extremely slow (1fps, offset sound) @ best.
Comments
Post a Comment