Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player resumes when paused during buffering #112

Closed
davros1970 opened this issue Mar 16, 2016 · 2 comments
Closed

Player resumes when paused during buffering #112

davros1970 opened this issue Mar 16, 2016 · 2 comments

Comments

@davros1970
Copy link

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.

@saiday
Copy link
Member

saiday commented Mar 16, 2016

Can this issue reproduce on sample project?

davros1970 [email protected] 於 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
#112

@davros1970
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants