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

[IOS] Player does not keep playing when phone is locked #4

Open
zPhoeniqz opened this issue Sep 6, 2024 · 1 comment
Open

[IOS] Player does not keep playing when phone is locked #4

zPhoeniqz opened this issue Sep 6, 2024 · 1 comment

Comments

@zPhoeniqz
Copy link

When a track is playing, it is automatically paused when the phone is locked (on IOS).

@felixkrautschuk
Copy link

Add this to your App_Resources/iOS/Info.plist:

<key>UIBackgroundModes</key>
<array>
          <string>audio</string>
</array>

In addition, you need to set some specific configs in your player options:

this._playerOptions = {
            loop: false,
            //audioFile: ...
};


if(platform.isIOS) {
            //allow audio to continue on screen lock, app sent to background or silent switch
            this._playerOptions.sessionCategory = AVAudioSessionCategoryPlayback;
            this._playerOptions.sessionMode = AVAudioSessionModeDefault;
            this._playerOptions.sessionRouteSharingPolicy = AVAudioSessionRouteSharingPolicy.Default;
}

player.initFromUrl(this._playerOptions).then(() => {
   //...
} (e) => {
            console.log(e);
});

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