gpt4 book ai didi

ios - YTPlayerView 不在模拟器上播放内容(解码失败,错误代码)

转载 作者:行者123 更新时间:2023-11-28 23:41:05 26 4
gpt4 key购买 nike

当我播放普通内容时,它可以完美加载模拟器。

YTPlayerView参数

@implementation SingleVideoViewController

- (void)viewDidLoad {
[super viewDidLoad];
NSString *videoId = @"weRHyjj34ZE";

// For a full list of player parameters, see the documentation for the HTML5 player
// at: https://developers.google.com/youtube/player_parameters?playerVersion=HTML5
NSDictionary *playerVars = @{
@"controls" : @0,
@"playsinline" : @1,
@"autohide" : @1,
@"showinfo" : @0,
@"modestbranding" : @1
};
self.playerView.delegate = self;
[self.playerView loadWithVideoId:videoId playerVars:playerVars];



[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receivedPlaybackStartedNotification:)
name:@"Playback started"
object:nil];

}

但是,如果我的播放列表中有高清视频,则会出现以下错误和代码 https://github.com/youtube/youtube-ios-player-helper

Git 项目中提供了代码,只需下载它并更改 SingleVideoViewController 中的 videoId。

Decoding failed with error code -1
Decoding: C0 0x01E00168 0x0000304A 0x22111100 0x00000000 6668
Options: 1x-1 [0000002D,01E0010F] 0001C060
Decoding failed with error code 7
Decoding: C0 0x01E00168 0x0000304A 0x22111100 0x00000000 773
Options: 1x-1 [0000002D,01E0010F] 0001C060
Decoding failed with error code -1
Decoding: C0 0x01E00168 0x0000304A 0x22111100 0x00000000 773
Options: 480x360 [FFFFFFFF,FFFFFFFF] 0001C060

最佳答案

尝试将 origin 参数添加到您的 playerVars dictionary,即

NSDictionary *playerVars = @{
@"controls" : @0,
@"playsinline" : @1,
@"autohide" : @1,
@"showinfo" : @0,
@"modestbranding" : @1,
@"origin":@"https://www.youtube.com"
};

来自 YouTube API 文档,

Origin: This parameter provides an extra security measure for the IFrame API and is only supported for IFrame embeds. If you are using the IFrame API, which means you are setting the enablejsapi parameter value to 1, you should always specify your domain as the origin parameter value.

您可以阅读更多相关信息 here .

关于ios - YTPlayerView 不在模拟器上播放内容(解码失败,错误代码),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53434938/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com