sampotts / plyr

A simple HTML5, YouTube and Vimeo player
https://plyr.io
MIT License
26.56k stars 2.93k forks source link

[iOS] Audio playback is stopped once a screen is locked down #1894

Open boombang opened 4 years ago

boombang commented 4 years ago

Hi, thanks for this wonderful library, we are using it for a long time and the customer and users are happy using it :)

But there is a bit uncomfortable issue... There are a lot of audio tracks that users want to listen while doing other things. It will lead to the device's screen locking down. But in this case, playback is stopped on the iOS devices. Nevertheless, it works perfectly on Android devices.

Expected behaviour

Actual behaviour

Steps to reproduce

  1. start playback of audio
  2. wait until device is locked down automatically
  3. after time between playback start and lock down(or even at once) the playback is stopped

    Environment

sampotts commented 4 years ago

Have you tried this on a regular HTML5 <audio> element? I'd suspect it'd be the same behavior?

vahost commented 4 years ago

@sampotts That's probably true, but it's still a problem.

I've run into the same issue. I use plyr in vue-plyr, which in turn I use in Quasar/Vue with Cordova to build the iOS app.

Cordova offers a permissions setting for this: playAudioWhenScreenIsLocked in https://github.com/apache/cordova-plugin-media. The permission gets passed when playing an audio or video file using their media object.

The Cordova doc says their playAudioWhenScreenIsLocked parameter defaults to true in Cordova's media plugin, but apparently the same is not the case with plyr and vue-plyr. That probably means I'd have to build my own media player, and I'm not skilled enough to do that.

That's why I was hoping there'd be a way for plyr or vue-plyr to pass a similar permission setting.