title: Contintue to play iframe even though device locked
body: <p>I got an iframe on my site which I want to continue to play even if I lock my screen. I enabled javascript on my safari app in settings aswell.</p>
  
  <pre><code>document.addEventListener('visibilitychange', _ =&gt; {
    var state = document.visibilityState;
    console.log('document is:',state);
    if (document.hidden){
      player.playVideo();
    }
  })
  </code></pre>
  
  <p>I got this script which notices if the screen is active or not, When the state is hidden on my pc the video is starting to play, however when I use my iphone the sound just stops. I'm using the youtube api so <code>player.playVideo();</code> works fine.</p>
  
  <p>When i lock my phone this display comes up 
  <a href="https://i.stack.imgur.com/Wu0rF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wu0rF.png" alt="enter image description here"></a></p>
  
  <p>But later when I press play manually it just crashes...
  Can I work with this or is there another way to for example convert the currently played iframe to mp4 or something which is playable?</p>