【问题标题】:How to display Youtube videos in android?如何在 android 中显示 Youtube 视频?
【发布时间】:2016-02-02 17:05:06
【问题描述】:

我知道我可以用 URL 开始一个意图,但我想要一个开始视频的缩略图。
就像这里:

我该怎么做?

【问题讨论】:

  • @MarcinOrlowski 好吧,我试图把它放在 VideoView 中,但没有用。我还看到我可以使用 Youtube API。但如果有办法不用它,我会更喜欢。

标签: android android-intent youtube


【解决方案1】:

您需要使用 YouTube Android Player API。请参阅此处的说明:https://developers.google.com/youtube/android/player/

如果您想通过Intent 打开 youtube 频道,您可以使用以下 sn-p:

public static void watchYoutubeVideo(Context context, String channelId) {
    Intent intent = new Intent(Intent.ACTION_VIEW,
            Uri.parse("http://www.youtube.com/channel/" + channelId));
    context.startActivity(intent);
}

【讨论】:

    猜你喜欢
    • 2017-11-17
    • 1970-01-01
    • 2015-11-03
    • 1970-01-01
    • 2023-02-16
    • 2011-11-11
    • 1970-01-01
    • 1970-01-01
    • 2018-02-12
    相关资源
    最近更新 更多