polimediaupv / paella-core

Paella Player core library
Educational Community License v2.0
20 stars 15 forks source link

iPad Only (v16.4 and Safari) "NotAllowedError" multi-stream mp4VideoFormat play() #323

Open karendolan opened 1 year ago

karendolan commented 1 year ago

The iPad is throwing a Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. on https://github.com/polimediaupv/paella-core/blob/main/src/js/videoFormats/es.upv.paella.mp4VideoFormat.js#L42-L46

Test with multi-video https://paellaplayer.upv.es/player.html?id=belmar-multiresolution-remote

This is not happening from iPhone, only from the iPad. This is not happening from a single video in the iPad, only multiple videos.

It appears to be a too early call for the video to play that is rejected by the browser. I suspect that the waitForLoaded() is having difficulty telling when both videos are ready to play in an iPad. However, it's odd that the issue does not also happen in an iPhone.

karendolan commented 1 year ago

Related... even though that error is throw, the video does play IF iPad is using native HLS. If iPad is using HLS.js, the code halts at the second video.play() in that second promise of the multi-video load.

Frustratingly... even though setting forceNative = true in the player's config.json solves the multi-video load issue for iPad, the Android/Chrome also responds with "maybe" to video.canPlayType('application/vnd.apple.mpegurl'). Then, Android/Chrome throws an error when the m3u8 is attempted in it's native HLS.

Our current attempt at a workaround is to forceNative on iOS devices only, in order to support native HLS multi-video on iPad and HLS.js on Android/Chrome.

karendolan commented 11 months ago

FYI - our site is working around this and a few other iPad difficulties by forcing the native browser HLS player instead of allowing HLS.js when using an iPad for both single and multiple-video events. We will revisit this issue when/if we separate the audio from the video files in our published multiple-videos events.

karendolan commented 5 months ago

iPad OS v17 seems to have less of an issue using HLS.js for multiple videos. But iPad OS v16 consistently errors out attempting to use HLS.js to load multi-videos at our site.

Do you have a recommendation on how to just isolate the iPad for dual stream videos when checking if it should force native without impacting Androds and other devices that can are able to run dual videos in HLS.js?

Our current workaround is to just force all iOS to run HLS natively, which is non-optimal.

miesgre commented 5 months ago

We currently do not have any iPad v16 and cannot test the issues with HLS.js.

But I don't understand what you want to do.

Can you explain it to me?

karendolan commented 5 months ago

@miesgre, None of the 3 options are ideal. Ideally, catching that "NotAllowedError" when attempting multi-video with HLS.js, then testing and forcing native HLS is the most general. It also seems complicated to implement.

In the interim, our site took the easy 4-lines-of-code option (via an HLS plugin override) of forcing all iPads to use native HLS instead of HLS.js until our next upgrade. By then iPadOS v16 should be long gone.

Feel free to close this issue as "won't do" and leave it as informational.


  1. Force all iOS to native?

Pros:

Cons:

Pros:

Cons:

  1. iPad v16 to native?

Pros:

Cons: