开发者

Android Video Streaming using Video View (video view not showing automatially)

I have managed to stream video from internet using Video View

  Uri uri=Uri.parse(videoFileList[0]);
    VideoView vv=(VideoView) this.fin开发者_JS百科dViewById(R.id.vv);

    vv.setVisibility(1);
    vv.bringToFront();
    vv.setVideoURI(uri);        
    vv.setMediaController(new MediaController(this));
    vv.requestFocus();

But the video page displays as blank at first. Only if I click on the blank space the video view appeares.

Can any body give a solution to display it automatically?


Try this. It worked for me.

void playvideo(String url) 
{
    String  link=url;
    Log.e("url",link);
    view1 = (VideoView) findViewById(R.id.myVideoView); 
    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    MediaController mc = new MediaController(this); 
    mc.setMediaPlayer(view1); 
    view1.setMediaController(mc); 
    view1.setVideoURI(Uri.parse(link)); 
    view1.requestFocus(); 
    view1.start();
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜