如何下载和播放具有不同质量值的YouTube视频,例如"高," "低,"和"正常"?
答案 0 :(得分:0)
答案 1 :(得分:0)
使用YouTube的iOS Player Helper class(YTPlayerView),您可以按建议的质量值加载视频;
ViewController.m
@property (weak, nonatomic) IBOutlet YTPlayerView *playerView;
// ...
[self.playerView loadVideoById:@"zN-GGeNPQEg" startSeconds:0.0f suggestedQuality:kYTPlaybackQualitySmall];
YTPlayerView.h中的质量选项:
/** These enums represent the resolution of the currently loaded video. */
typedef NS_ENUM(NSInteger, YTPlaybackQuality) {
kYTPlaybackQualitySmall,
kYTPlaybackQualityMedium,
kYTPlaybackQualityLarge,
kYTPlaybackQualityHD720,
kYTPlaybackQualityHD1080,
kYTPlaybackQualityHighRes,
kYTPlaybackQualityAuto, /** Addition for YouTube Live Events. */
kYTPlaybackQualityDefault,
kYTPlaybackQualityUnknown /** This should never be returned. It is here for future proofing. */
};
请勿使用Auto
,该值仅适用于直播活动播放。