2011-09-29 97 views
1

我已成功使用視頻查看Android的視頻流使用視頻搜索(視頻圖中不顯示automatially)

Uri uri=Uri.parse(videoFileList[0]); 
    VideoView vv=(VideoView) this.findViewById(R.id.vv); 

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

但視頻頁面顯示起初爲空白,以流從互聯網視頻。只有當我點擊視頻視圖的空白處纔會出現。

任何機構都可以提供自動顯示的解決方案嗎?

回答

11

試試這個。它爲我工作。

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

最好的一個https://github.com/google/ExoPlayer – Qamar