Disable media keys


Is it possible to disable the media keys when using the Stream Player API?
Normally I would do the following but doesn’t seem like it’s working with the Cloudflare iframe:

if ('mediaSession' in navigator) {
  navigator.mediaSession.setActionHandler('play', () => { })
  navigator.mediaSession.setActionHandler('pause', () => { })
  navigator.mediaSession.setActionHandler('seekbackward', () => { })
  navigator.mediaSession.setActionHandler('seekforward', () => { })
  navigator.mediaSession.setActionHandler('previoustrack', () => { })
  navigator.mediaSession.setActionHandler('nexttrack', () => { })

Tried document.getElementById('iframe-element').contentWindow.mediaSession but getting Blocked a frame with origin "https://example.com" from accessing a cross-origin frame error.


We are showing the Cloudflare videos in a theater-style format and currently the viewers can pause and forward the video with their media keys which is kind of weird.
Also when you get an incoming phone call, the video pauses due to this.

Any quick solution for this?