LiteAVSDK / Player_iOS

Super player for iOS...
https://trtc.io/
1.11k stars 226 forks source link

iOS 播放音频, PLAYER_FFPLAY 模式下无法唤起锁屏控制中心 #225

Closed vinsent closed 2 years ago

vinsent commented 3 years ago

版本: 'TXLiteAVSDK_Player', '8.2.9808' 使用 PLAYER_AVPLAYER 模式能正常唤起锁屏控制中心, 但是使用 PLAYER_FFPLAY 模式时始终无法唤起

此Demo也是如此, 验证如下: 类 MoviePlayerViewController, 方法: - (void)superPlayerDidStart:(SuperPlayerView *)player 中添加以下代码:

[UIApplication.sharedApplication beginReceivingRemoteControlEvents];

MPMediaItemArtwork *artWork = [[MPMediaItemArtwork alloc] initWithBoundsSize:CGSizeMake(128, 128) requestHandler:^UIImage * _Nonnull(CGSize size) {
        return [UIImage new];
    }];
MPNowPlayingInfoCenter *infoCenter = MPNowPlayingInfoCenter.defaultCenter;
NSMutableDictionary *dic = [infoCenter.nowPlayingInfo mutableCopy];
dic[MPMediaItemPropertyArtwork] = artWork;
dic[MPMediaItemPropertyTitle] = @"Title";
dic[MPMediaItemPropertyArtist] = @"Name";
dic[MPMediaItemPropertyPlaybackDuration] = @(100);
dic[MPNowPlayingInfoPropertyElapsedPlaybackTime] = @(10);
dic[MPNowPlayingInfoPropertyPlaybackRate] = @1.0;
infoCenter.nowPlayingInfo = [dic copy];
tgitpushping commented 2 years ago

已经可以了 可以使用10.*版本