polimediaupv / paella-core

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

Issue #323 iPad support for multi-video #338

Closed karendolan closed 11 months ago

karendolan commented 12 months ago

The pull Includes:

ferserc1 commented 11 months ago

Native HLS support was implemented only for iOS, because in this case it is not supported by Media Source Extensions (iPadOS is supported).

The forceNative parameter was implemented due to your request, but I can't identify any case where it is better to use the native version, could you explain it to me? I don't like at all how the HLS player is getting, it started quite simple, and now we are adding a lot of patches. From my experience with Paella 6, this is not a good idea.

As for iPad detection, the problem with the UserAgent stems from the fact that Safari is configured by default to display desktop web as of iPadOS 16. If the user disables this option, the iPad detection code you added stops working. I don't like to add such hacks that tend to fail when an operating system update is released.

But the problem is not related to the userAgent, but that the volume APIs are not available. So I would choose to detect if the volume APIs are available. I am finishing a function that detect this case independently of the platform. The idea is to create an audio element in JavaScript, modify the volume and query if it has changed. It is not as simple as it sounds, because sometimes the response is asynchronous, so you have to implement this function by capturing the volumechanged event, but with the tests I am doing it seems to work fine. This new function will be available as a utility inside the VideoPlugin

karendolan commented 11 months ago

The motivation for this patch

  1. iPad will play a single video event, but will fail to load the videos on a multi video event (the second load video await never returns)
  2. Android/Chrome fails if forceNative = true.

This patch resolves the above by adding extra param to only force iOS devices, like iPad, to play native, which stops the Android/Chrome from attempting native.

ferserc1 commented 11 months ago

I have not been able to find any example of multi stream videos failing on iPad with HLS, at least in our servers. Sometimes we have detected that it fails, but it has always been related with problems with the video. In that cases, the problem is not solved using the native player.

Here are some examples of our OpenCast service:

https://engage.videoapuntes.upv.es/paella7/ui/watch.html?id=bcce8190-1012-11ee-9f15-7b8970428ebd https://engage.videoapuntes.upv.es/paella7/ui/watch.html?id=9f4fc780-5b6e-11ee-b12b-6f298397837a https://engage.videoapuntes.upv.es/paella7/ui/watch.html?id=3531ff40-48df-11ee-87d0-2b62c15b0638

This is the HLS example in paella player site: https://paellaplayer.upv.es/#/demos/hls-multiquality

Maybe you should check your streaming server configuration. You can also try to modify the hls.js library configuration, but I'm afraid that I won't be able to help you with HLS configuration issues.

As for Android, completely removing forcing to native mode would eliminate the problem, because in the previous version without forcing hls.js was always given priority.

github-actions[bot] commented 11 months ago

This pull request has conflicts ☹ Please resolve those so we can review the pull request. Thanks.

karendolan commented 11 months ago

We were using this link to verify the issue in iPad https://paellaplayer.upv.es/player.html?id=belmar-multiresolution-remote I'm asking our QA team to check if it still can't play in iPad.

karendolan commented 11 months ago

That UPV links plays Ok in iPad per our QA team. I'm closing this ticket for upstream. We'll retest with our workaround on the next UPV major upgrade.