当我运行应用程序时,它显示错误视频无法播放抱歉该视频无法播放
package com.video;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.Window;
import android.widget.MediaController;
import android.widget.VideoView;
public class video extends Activity {
/** Called when the activity is first created. */
// String LINK = "http://www.ted.com/talks/download/video/8584/talk/761";
//this is direct youtube url.. which i want to play
String LINK = "http://www.youtube.com/watch?v=Dff1wa-po5k&feature=topvideos_music";
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setContentView(R.layout.main);
final MyCount counter = new MyCount(5000, 1000);
counter.start();
// final ImageView imageview = (ImageView) this.findViewById(R.id.ImageView01);
// imageview.setImageResource(R.drawable.index);
final VideoView videoView = (VideoView) this.findViewById(R.id.videoview01);
final MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
final Uri video = Uri.parse(this.LINK);
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.start();
}
public class MyCount extends CountDownTimer {
public MyCount(final long millisInFuture, final long countDownInterval) {
super(millisInFuture, countDownInterval);
// TODO Auto-generated constructor stub
}
public void onFinish() {
// TODO Auto-generated method stub
}
public void onTick(final long arg0) {
// TODO Auto-generated method stub
}
}
}
package com.video;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.Window;
import android.widget.MediaController;
import android.widget.VideoView;
public class video extends Activity {
/** Called when the activity is first created. */
// String LINK = "http://www.ted.com/talks/download/video/8584/talk/761";
//this is direct youtube url.. which i want to play
String LINK = "http://www.youtube.com/watch?v=Dff1wa-po5k&feature=topvideos_music";
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setContentView(R.layout.main);
final MyCount counter = new MyCount(5000, 1000);
counter.start();
// final ImageView imageview = (ImageView) this.findViewById(R.id.ImageView01);
// imageview.setImageResource(R.drawable.index);
final VideoView videoView = (VideoView) this.findViewById(R.id.videoview01);
final MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
final Uri video = Uri.parse(this.LINK);
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.start();
}
public class MyCount extends CountDownTimer {
public MyCount(final long millisInFuture, final long countDownInterval) {
super(millisInFuture, countDownInterval);
// TODO Auto-generated constructor stub
}
public void onFinish() {
// TODO Auto-generated method stub
}
public void onTick(final long arg0) {
// TODO Auto-generated method stub
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,请在下次询问时正确格式化您的源代码。对于您的问题:我认为问题的发生是因为您正在尝试播放 Flash 视频 (YouTube)。这会引发错误,因为 Android 现在安装了标准 Flash 播放器。您可以尝试使用 YouTube 应用有意打开视频。
First of all please format you source correctly the next time you ask. And for your problem: I think the issue happens because you're trying to play back an flash video (YouTube). This throws an error because Android has now standard flash player installed. You can try to open the video with an intent and using the YouTube app.