美文网首页
iOS AVPlayer在蓝牙耳机播放时seek/pause时有

iOS AVPlayer在蓝牙耳机播放时seek/pause时有

作者: 七维树 | 来源:发表于2022-04-07 14:24 被阅读0次

在暂停(pause)时,会延迟0.3秒暂停,如果有变速会更明显能听到后面的内容。
在seek的时候,会往前多seek0.3秒。

可以通过 AVAudioSessionRouteDescription判断音频是否通过蓝牙耳机输出中,然后独立处理一下这种情况即可。

- (BOOL)isBluetoothHeadsetOutput {
    AVAudioSessionRouteDescription* route = [[AVAudioSession sharedInstance] currentRoute];
    for (AVAudioSessionPortDescription* desc in [route outputs]) {
        if ([[desc portType] isEqualToString:AVAudioSessionPortBluetoothA2DP])
            return YES;
    }
    return NO;
}

相关文章

网友评论

      本文标题:iOS AVPlayer在蓝牙耳机播放时seek/pause时有

      本文链接:https://www.haomeiwen.com/subject/fnzjsrtx.html