android - 如何在 android 中显示 Youtube 视频?

标签 android android-intent youtube

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

我该怎么做?

最佳答案

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

如果您想通过Intent 打开 youtube channel ,您可以使用以下代码段:

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);
}

关于android - 如何在 android 中显示 Youtube 视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33483980/

相关文章:

android - 获取隐式 Intent 打开的应用程序

android - 当我将我的应用程序带到前台时,不会加载最后一个 Activity

youtube - 了解 Youtube Data API 配额限制

youtube - YouTube 还在使用 DASH 吗?

android - 如何比较字符串数组

android - Android 加速度计的最小和最大范围是多少?

Android:应用启动时仅将数据插入本地数据库一次

java - Android SeekBar 自定义矩形拇指视觉 bug

java - 广播接收器使某些设备中的应用程序崩溃

php - 无法回显 file_get_contents 中的函数内容