android - 使用 YouTube Player API,以特定用户身份播放视频,应用 YouTube Red 订阅

标签 android youtube android-youtube-api

我可以使用适用于 Android 的 YouTube Player API 1.2.2 播放视频。但是,即使订阅了 YouTube Red,用户也总会看到前贴片广告。我找不到任何有关作为特定 YouTube 用户播放视频的文档,以便利用禁用广告的 YouTube Red 订阅。
YouTubePlayerSupportFragment.initialize() 的 javadoc说:

public void initialize (String developerKey, YouTubePlayer.OnInitializedListener listener)

Initialize a YouTubePlayer, which can be used to play videos and control video playback. One of the callbacks in listener will be invoked when the initialization succeeds or fails.

Parameters

developerKey A valid API key that is enabled to use the YouTube Data API v3 service. To generate a new key, visit the Google Developers Console.
listener The callbacks that will be invoked when the initialization succeeds or fails.



所以它需要一个 API key ,而不是用户的 OAuth 凭据。有没有办法传递 OAuth 凭据,以特定用户身份播放视频?

我看到了这个示例应用程序:https://github.com/youtube/yt-direct-lite-android -- 它显示了使用 OAuth 2.0 上传视频的示例,但播放仅使用简单的 API key 。

最佳答案

除了使用 WebView 之外,目前没有办法以特定用户的身份播放视频。与 Play private YouTube video using YoutubePlayerView from YoutubeAndroidPlayerAPI? 的答案相同:

This is not possible with the Android Player API. The only way to play private videos on a device is to implement a WebView in your app, have the user log into their YouTube account, and then play back the Private video in that specific browser session only.

关于android - 使用 YouTube Player API,以特定用户身份播放视频,应用 YouTube Red 订阅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45604832/

相关文章:

带有可以滚动到屏幕外的非粘性标题行的 Android ListView

android - 在回复超时内未收到回复。 Smack 4.2.0 muc.join()

javascript - 如何使用自定义帖子类型创建 WordPress 视频库

javascript - Youtube 视频叠加?

android - 使用 ExoPlayer 播放 YouTube 视频

安卓摄像头检测

android - 我的 Flex 应用程序的 Android native 扩展中包含 Adob​​e native 扩展 : How do I package third party libraries (. jar)?

youtube - 当 Youtube 视频上传 API 时通知

google-cloud-platform - 具有公开的 GCP API key 的 YouTube 播放器 API

java - OpenYoutubeActivity : java. lang.NoClassDefFoundError OpenYouTubePlayerActivity