gpt4 book ai didi

ios - 崩溃-[AVPlayerItem _attachToPlayer :] An AVPlayerItem cannot be associated with more than one instance of AVPlayer

转载 作者:技术小花猫 更新时间:2023-10-29 10:26:44 25 4
gpt4 key购买 nike

我有一个崩溃影响了我大约 10% 的用户,但我无法重现它,并且不知道发生这种情况的确切时间。

Crashlytics 报告说,大约一半的崩溃用户没有关注应用程序,即做背景音频或 AirPlay。该应用程序播放 HLS 视频流,并在后台切换到纯音频版本。

有什么问题吗,或者为什么我的单例 Player 类中会有多个 AVPlayer 实例?

谢谢!

Exception Type:
NSInvalidArgumentException
Reason:
An AVPlayerItem cannot be associated with more than one instance of AVPlayer
Fatal Exception
Latest Crash: 4/06/2013 at 8:48:46 UTC+0200
0 CoreFoundation __exceptionPreprocess + 162
1 libobjc.A.dylib objc_exception_throw + 30
2 AVFoundation -[AVPlayerItem _attachToPlayer:] + 188
3 AVFoundation -[AVPlayer _attachItem:andPerformOperation:withObject:] + 336
4 AVFoundation -[AVPlayer _insertItem:afterItem:] + 26
5 AVFoundation -[AVQueuePlayer insertItem:afterItem:] + 136
6 MediaPlayer __block_global_4 + 520
7
...
libdispatch.dylib _dispatch_call_block_and_release + 10
14

最佳答案

这似乎可以通过在设置新 URL 之前明确停止播放来解决,例如

[moviePlayer stop];
moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[moviePlayer setContentURL:[NSURL URLWithString:[videos objectForKey:quality]]];

关于ios - 崩溃-[AVPlayerItem _attachToPlayer :] An AVPlayerItem cannot be associated with more than one instance of AVPlayer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16213611/

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