【发布时间】:2012-03-08 05:42:59
【问题描述】:
我正在尝试使用 VideoView 播放 youtube 视频。它给了我“无法播放视频”错误。我在下面的代码中做错了什么。我使用的网址只是普通的 youtube 网址:http://www.youtube.com/watch?v=q7u30Li-oOc
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
setContentView(R.layout.main);
//init components for use
mVideoView = (VideoView) findViewById(R.id.video);
text = (TextView)findViewById(R.id.textView1);
//Get URI data from VideoDemo activity
Bundle uristream = getIntent().getExtras();
videoUri = uristream.getString("urivalue");
//set Texfield to URI string
text.setText(videoUri);
//mVideoView.setVideoPath(videoUri);
//provide VideoView component with file path and play
mVideoView.setVideoURI(Uri.parse(videoUri));
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
mVideoView.start();
}
【问题讨论】:
-
你能发布完整的例外吗?
-
它并没有真正给出太多例外。它说“无法播放。抱歉,此视频无法播放”。标签:MediaPlayer 错误 (0 , 0)。我正在罗技 (Google TV) 上运行该应用
-
@MahdeTo ,它还说“无法在客户端打开文件尝试服务器端”
-
我有确切的问题。你找到解决办法了吗?
-
@Juhani,不,不幸的是我没有。我刚刚为我的应用找到了解决方法。