开发者

how to playback video from internal storage(my app) with videoView

Im trying to play video from internal storage, but videoview cant play it. Is there a way to do this and not by temporarily copying to sdcard and playing it? The video was recorded开发者_运维知识库 with mediarecorder.


Use this code in your activity

 VideoView videoView = (VideoView) findViewById(R.id.video_view);
 MediaController mediaController = new MediaController(this);
 mediaController.setAnchorView(videoView);
 videoView.setMediaController(mediaController);
 videoView.setVideoPath(getFilesDir().getAbsolutePath()+"/file_name.mp4");
 ideoView.start();

The file_name.mp4 must be created with Context.MODE_WORLD_READABLE

Holp this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜