当我运行应用程序时显示错误视频无法播放抱歉此视频无法播放

时间:2011-04-26 07:36:32

标签: android youtube video-capture

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

    }

}

}

1 个答案:

答案 0 :(得分:0)

首先,请在下次询问时正确格式化您的来源。对于你的问题:我认为问题的出现是因为你正在尝试播放Flash视频(YouTube)。这会引发错误,因为Android现在安装了标准的Flash播放器。您可以尝试使用YouTube应用程序打开视频。