播放一段时间后,AVPlayer噪音问题 [英] AVPlayer noise issue after playing a while

查看:85
本文介绍了播放一段时间后,AVPlayer噪音问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用AVPlayer播放流式网络音频.

I use AVPlayer to play streamed network audio.

我修改了以下示例代码 AVPlayerDemo 苹果

I modify the sample code AVPlayerDemo from Apple

工作很好.但是玩了一段时间后,播放器有声音,有人叫刮擦声".

The work is good. But after play for a while, the player has noise sound, someone call "scratch sound".

我检查了代码,只要我的播放器只有一个AVPlayer对象,一个用于标记的AVPlayerItem对象,一个用于标记的AVURLAsset对象.我显式使用分配,保留,重新分配",因此这不是内存开销的问题.

I checked the code, anytime my player has only one AVPlayer object, one AVPlayerItem objet for marking, one AVURLAsset object for marking. I use "alloc, retain, realease" explicitly, so it's not problem of memory overhead.

您知道引起噪音的任何原因吗?谢谢

Can you know any reason cause the noise sound? Thank you

推荐答案

我遇到了类似的问题.在我的情况下,使用AVPlayerAVAudioPlayer一段时间来播放多个剪辑,并且它们之间有暂停,会导致音频质量下降.首先,它开始变得发痒,然后变得更糟,最终完全掉下来,听不见.

I am having a similar problem. Using an AVPlayer or AVAudioPlayer for a length of time, in my case to play multiple clips with pauses in between, causes the audio to degrade. First it begins to get scratchy, then as it gets worse it eventually drops off completely and is inaudible.

我尝试为每个剪辑创建新的AVAudioPlayer's,但无济于事.

I have attempted creating new AVAudioPlayer's for each clip to no avail.

我怀疑音频文件本身(* .m4a)引起了问题.即使经过几轮降噪后,有些也包含静电.尽管其中的静态不是静态的,但AVAudioPlayer正在引入.

I am suspect that the audio files themselves (*.m4a) are causing the problem. Some contain static themselves even after a few rounds of noise reduction. Though the static within them is not the static the AVAudioPlayer is introducing.

我正在研究两种替代理论和一种理论;

I am working on two alternate theories and a theory;

  1. 使用原始的* .wav文件或* .mp3文件
  2. 在剪辑之间或定期停用/激活AVAudioSession.
  3. 这可能只是模拟器问题,不会在设备上发生(理论上).

尽管这些可能不适用于您的视频流,但也许这里有解决方案.

Though these may not be applicable to your stream, perhaps there is a solution in here somewhere.

更新:*.wav与* .m4a没有区别.

UPDATE: *.wav vs *.m4a makes no difference.

更新:这不是在设备本身上发生的,只是在我自己的模拟器中发生.

UPDATE: This is not happening on the device itself, only in the simulator for me.

这篇关于播放一段时间后,AVPlayer噪音问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆