AVPlayer noise issue after playing a while

不羁岁月 提交于 2019-12-08 09:37:09

问题


I use AVPlayer to play streamed network audio.

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".

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


回答1:


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.

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

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. Use the original *.wav files or *.mp3 files
  2. Deactivate/Activate the AVAudioSession between clips or periodically.
  3. This may be just a simulator problem and not happen on the device (theory).

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

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

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



来源:https://stackoverflow.com/questions/13189240/avplayer-noise-issue-after-playing-a-while

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!