如何设置在YouTube上的Andr​​oid播放器API仅播放高清影片 [英] how to set to play only HD Videos in YouTube Android Player API

查看:174
本文介绍了如何设置在YouTube上的Andr​​oid播放器API仅播放高清影片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使YouTube的Andr​​oid的播放器API播放的只有高清影片 链接

How to make YouTube Android Player API play only HD Videos Link

@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider,
        YouTubePlayer player, boolean wasRestored) {
    if (!wasRestored) {
        Log.v("Mobile Url", "" + mobile_url);
        player.loadVideo(mobile_url);
        player.setFullscreen(true);
        player.setShowFullscreenButton(false);
        player.loadVideo("N1nFoVI3xJM");
    }
}

在这里,我可以设置 loadVideo setFullscreen setShowFullscreenButton 我需要加载的只有高清影片。那可能吗?是任何可用的设置只播放高清视频的方法?如果没有高清视频发现该ID,然后我需要显示敬酒像现在打非高清影片如何执行此,请给一些意见或建议来实现这一概念

Here I can set the loadVideo, setFullscreen, setShowFullscreenButton I need to load only HD Videos. Is that possible? Is any method available to set play only HD videos? If no HD Video found for that ID then I need to show toast as now playing non-HD Videos how to perform this please give some idea or suggestion to achieve this concept

推荐答案

您可以使用 player.setPlaybackQuality(suggestedQuality:字符串):虚空

从YouTube的API文档:

From the YouTube API docs:

本功能设置当前视频的建议的视频质量。   该功能使视频重新加载在其中的当前位置   新的质量。如果播放质量没有改变,只不过是改变   用于视频播放。调用此函数并不保证   该播放质量会真正改变。然而,如果   播放质量不发生变化,onPlaybackQualityChange事件会   火了,你的code应该响应该事件,而不是事实   它叫setPlaybackQuality功能。

This function sets the suggested video quality for the current video. The function causes the video to reload at its current position in the new quality. If the playback quality does change, it will only change for the video being played. Calling this function does not guarantee that the playback quality will actually change. However, if the playback quality does change, the onPlaybackQualityChange event will fire, and your code should respond to the event rather than the fact that it called the setPlaybackQuality function.

这篇关于如何设置在YouTube上的Andr​​oid播放器API仅播放高清影片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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