我希望在我的YTPlayerView,而鎖定iPhone的下一個和上一個按鈕iPhone的iOS, 實際上,當我在模擬器中使用下一個和上一個按鈕其效果很好,但是當我按下一個按鈕時iPhone已鎖定,然後其崩潰, 我在我的應用程序中使用YTPlayerView。想要下一個和上一個按鈕在我的YTPlayerView,而鎖定iPhone
我的應用程序委託代碼
NSError *setCategoryError = nil;
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryError];
[MPRemoteCommandCenter sharedCommandCenter].playCommand.enabled = YES;
//comment below hide next and previous
MPRemoteCommandCenter *rcc = [MPRemoteCommandCenter sharedCommandCenter];
MPRemoteCommand *nextTrackCommand = [rcc nextTrackCommand];
[nextTrackCommand setEnabled:YES];
[nextTrackCommand addTarget:self action:@selector(nextTrackCommandAction)];
// Doesn’t show unless nextTrack is enabled
MPRemoteCommand *previousTrackCommand = [rcc previousTrackCommand];
[previousTrackCommand setEnabled:YES];
[previousTrackCommand addTarget:self action:@selector(previousTrackCommandAction)];
-(void)nextButtonMethod{
NSDictionary *playerVars = @{
@"controls" : @1,
@"playsinline" : @1,
@"autohide" : @1,
@"modestbranding" : @1,
@"showinfo" : @1
};
[[YTPlayerInstance instance] loadWithVideoId:@"LlrY456zAMU" playerVars:playerVars];
}
我的應用程序崩潰旁邊的..
您是否找到了解決方案? – jos
我在鎖定的屏幕上創建了播放和暫停按鈕,隱藏了下一個和上一個鎖定屏幕 –
ey @Jagveer Singh看看我的解決方案,也許它可以幫助你! – jos