Closed davros1970 closed 8 years ago
Can this issue reproduce on sample project?
davros1970 notifications@github.com 於 2016年3月16日星期三 寫道:
When I invoke pause() during the first few seconds of playing a mp3 from the internet, the player will resume unexpectedly. "HysteriaPlayer: resume from buffering.." If I wait 10 secs approx into the audio playing, then my calls to pause() are honored.
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/StreetVoice/HysteriaPlayer/issues/112
Yes.
I modified the sample code like this... HysteriaPlayerSwiftExample.ViewController.swift
func hysteriaPlayerReadyToPlay(identifier: HysteriaPlayerReadyToPlay) {
switch(identifier) {
case .CurrentItem:
hysteriaPlayer.play()
delay()
break
default:
break
}
}
func delay() {
NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: Selector("pause"), userInfo: nil, repeats: false)
}
func pause() {
print("Attempting to pause audio")
hysteriaPlayer.pause()
}
Then the logs look like this...
2016-03-16 07:20:46.835 HysteriaPlayerSwiftExample[17763:209724] unable to register background playback Attempting to pause audio 2016-03-16 07:20:48.943 HysteriaPlayerSwiftExample[17763:209724] resume from buffering..
When I invoke pause() during the first few seconds of playing a mp3 from the internet, the player will resume unexpectedly. "HysteriaPlayer: resume from buffering.." If I wait 10 secs approx into the audio playing, then my calls to pause() are honored.