Iphone AVAudio播放器停止在设备上工作

Iphone AVAudio播放器停止在设备上工作,iphone,objective-c,ios,avplayer,Iphone,Objective C,Ios,Avplayer,我使用的是AVPlayer它在设备上也工作得很好,但是在它仍然在模拟器上工作的时候突然停止了在设备上的工作。我不明白为什么它停止工作了。请检查下面的代码 NSURL *url=[NSURL URLWithString:self.urlStr]; self.audioSound = [[AVPlayer alloc] init]; playerItem = [AVPlayerItem playerItemWithURL:url]; [playerItem ad

我使用的是
AVPlayer
它在设备上也工作得很好,但是在它仍然在模拟器上工作的时候突然停止了在设备上的工作。我不明白为什么它停止工作了。请检查下面的代码

    NSURL *url=[NSURL URLWithString:self.urlStr];

    self.audioSound = [[AVPlayer alloc] init];

    playerItem = [AVPlayerItem playerItemWithURL:url];

    [playerItem addObserver:self forKeyPath:@"playbackBufferEmpty"   options:NSKeyValueObservingOptionNew context:nil];

    [playerItem addObserver:self forKeyPath:@"status" options:0 context:nil];

    [self.audioSound replaceCurrentItemWithPlayerItem:playerItem]; 

我没有看到任何播放视频的代码,比如
[player play]


您是否编写了此代码?

如果您没有遇到这种情况,请原谅,但您的设备上的静音开关是否设置为振动?考虑到您正在使用AVPlayer,您可能刚刚将其排除在外,但在替换当前项目后,您是否正在播放新项目?(
[self.audioSound play]
)哦,在更改时,我错误地删除了这个。。。。它正在工作。。谢谢,谢谢。。。。