Open zsaraf opened 5 years ago
I have the same issue. I solved it by removing code involved 'playbackRateUnitDescription'.
I have the same issue. I solved it by removing code involved 'playbackRateUnitDescription'.
But the rate property will not work.
When the user change the stream, I create a new STKAudioPlayer:
func newAudioPlayer() {
if let audioPlayer = self.audioPlayer {
audioPlayer.dispose()
self.audioPlayer = nil
}
var options = STKAudioPlayerOptions()
options.flushQueueOnSeek = false
options.enableVolumeMixer = true
options.equalizerBandFrequencies = (32, 64, 125, 250, 500, 1000, 2000, 4000, 8000, 16000, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0)
self.audioPlayer = STKAudioPlayer(options: options)
self.audioPlayer.delegate = self
self.audioPlayer.meteringEnabled = false
self.audioPlayer.equalizerEnabled = true
self.audioPlayer.volume = 1
for i in 0..<self.frequencyPlotView.gains.count {
self.audioPlayer.setGain((self.frequencyPlotView.gains[i] as! NSNumber).floatValue, forEqualizerBand: Int32(i))
}
self.audioPlayer.appendFrameFilter(withName: "CustomEQFilter") { (channelsPerFrame, bytesPerFrame, frameCount, frames) in
guard self.frequencyAnalyzer != nil else {return}
let description = AudioStreamPacketDescription(mStartOffset: 0, mVariableFramesInPacket: 0, mDataByteSize: bytesPerFrame * frameCount)
self.frequencyAnalyzer.audioPlayer(self.audioPlayer, samplesAvailable: frames, description: description)
}
}
Good day! I have the same problem, but I have some requirements:
Does anyone have solutions/suggestions how this problem can be fixed?
After several days I've found a solution. I need to reset audiounit state on pause:
OOStatus error = AudioUnitReset(playbackRateUnit, kAudioUnitScope_Global, 0);
Hello,
I am building an Icecast streaming radio app that streams from a few different URLs. This issue doesn't arise on the first time that I call
STKAudioPlayer.play
. But every time I callSTKAudioPlayer.play
on the player after the first stream is played and stopped, I hear a tiny bit of the last stream before I hear the new stream. Just a tiny bit (around ~500ms), but it makes for a very bad user experience.For reference, this is how I call play and stop:
An example URL that might be passed in to
startStreamWithUrl:
could be: http://ss.deprogrammedradio.com:8000/deprogrammedradio.mp3Calling
[self->_audioPlayer stop]
is supposed to clear out all of the old buffers, but it doesn't seem like this is fully happening.Anyone have any idea where I should look?
Thanks. Zach