如何在Android原生播放器播放YouTube视频? [英] How to play YouTube video in Android native player?

查看:989
本文介绍了如何在Android原生播放器播放YouTube视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Android原生播放器播放YouTube视频?如果任何一个实现了这个请让我知道的方式。

How to play YouTube video in Android native player? If any one achieved this please let me know the way.

推荐答案

您可以在这里检查出的API:
https://developers.google.com/youtube/android/player/downloads/

You can check out the API here: https://developers.google.com/youtube/android/player/downloads/

然后,你需要注册您的应用程序(获得API密钥)
https://developers.google.com/youtube/android/player/register

Then you need to register your application (get an API key) https://developers.google.com/youtube/android/player/register

然后你可以简单地添加所需的方法,你的活动:
<一href=\"https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayerView\" rel=\"nofollow\">https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayerView

And then you can simply add the required methods to your Activity: https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayerView

有也是createPlayVideoIntentWithOptions,它打开了安装在设备上的本机YouTube的应用

There is also the createPlayVideoIntentWithOptions, it opens up the native youtube application installed on the device

public static Intent createPlayVideoIntentWithOptions (Context context, String videoId, boolean fullscreen, boolean finishOnEnd)

这篇关于如何在Android原生播放器播放YouTube视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆