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

发布于 2024-11-03 05:42:00 字数 1726 浏览 3 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抠脚大汉 2024-11-10 05:42:00

首先,请在下次询问时正确格式化您的源代码。对于您的问题:我认为问题的发生是因为您正在尝试播放 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文