开发者

streaming video android

开发者 https://www.devze.com 2023-03-30 05:58 出处:网络
Basically I am writing code for video player using media controller and videoview and is working well when i set videoview.setvideopath(string)...also When a play a mp3 file using mediaplayer.setsourc

Basically I am writing code for video player using media controller and videoview and is working well when i set videoview.setvideopath(string)...also When a play a mp3 file using mediaplayer.setsourcedata() it also work well........

my question is that i want to stream a video from SD card ...so that for i have to pass input stream to video view but it is not possible ... when a play the same my passing a video stream to mediaplayer.setsourcedata() it work but only a sound come from mp4 file ,,,no video is displayed....

this is nice example

File clip=new File(Environment.getExternalStorageDirectory(),
                   "test.mp4");
  video=(VideoView)findViewById(R.id.video);
  video.setVideoPath(clip.getAbsolute开发者_如何学运维Path());

  ctlr=new MediaController(this);
  ctlr.setMediaPlayer(video);
  video.setMediaController(ctlr);
  video.requestFocus();
  video.start();


//it work fine but "test.mp4" is a file and I want a stream of mp4 like 

InputStream in = null;
in = new BufferedInputStream(new FileInputStream(clip));

//and finally this stream has to be in video view...

If anybody as prior knowledge to video stream please help me out.

0

精彩评论

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