muxinc / media-chrome

Custom elements (web components) for making audio and video player controls that look great in your website or app.
https://media-chrome.org
MIT License
1.21k stars 62 forks source link

Unhandled Promise Rejections in Safari (RemotePlayback API issue) #809

Closed k-g-a closed 7 months ago

k-g-a commented 7 months ago

Hi!

This issue is the follow up of https://github.com/video-dev/hls.js/issues/6197

The short sumamry is: when disableRemotePlayback attribute is set on video element (in our case it comes from the hls.js code), the media.remote?.watchAvailability call originating from MEDIA_AIRPLAY_UNAVAILABLE.mediaSetCallback produces error. As this call is made within .then() (this.handleMediaUpdated(this.media).then((media) => this.mediaSetCallback(media));) it is treated as unhandled promise rejection.

This does not break the playback (or corrupt functionality in any way), but still is an error. The most unpleasent side effect for us atm is the annoying dev server overlay :)

This was introducd in media-chrome@2.0.0.

Live demo: https://codepen.io/k-g-a-kontur/pen/LYaJERV (it's important to use the real browser console, not the codepen's one).

Related files:

I suppose it's best to check for attribute presence before using the RemotePlayback API.