polimediaupv / paella-core

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

Facing multiple and inconsistent error while calling paella.load() #360

Closed daksh8559 closed 5 months ago

daksh8559 commented 5 months ago

Hi, I wanted to prefetch hls.js video fragments on the window load. the default behaviour of the player is when we click on the play button after that it will start loading hls.js fragments. But I want to load fragements on window load.

So to achieve that I called
paella.load()

But in this, I am facing multiple issues.

  1. DOMException: play() failed because the user didn't interact with the document first. This is because there is a logic added in the hlsVideoFormat.js that is trying to play the video using a script. But in the Chrome browser, it is prohibited.
  2. If I tried to play the video it jerked for almost one second then started playing.
  3. Sometimes it gives an error in VideoContainer.js, this is in updateLayout() that validContendIds are undefined.

My goal is to enable prefetch of the video on window load.

@turro @ferserc1

ferserc1 commented 5 months ago

Indeed, all the problems you mention must be caused by the fact that the call to load must be causing an exception that interrupts the loading of the player.

This problem has no easy solution. In all the time we have not been given a use case where the call to load() was not triggered by a user action, and in fact this function is intended to be invoked on user events.

Regardless of this, we recently identified some cases where HLS videos never went to readyState>=2 unless play was explicitly called, hence the error you indicate: we need to call play() on the video load to reach a valid readyState. But we have the problem that we haven't been able to get the player to work without this fix. As paella-core is a multi stream player, it is necessary that all the videos are in readyState>=2 to be able to synchronise the videos correctly.

To implement this would probably require the creation of a new state between MANIFEST and LOADED, and this is a non-trivial task. To do this would probably require a redesign of the entire player architecture, and would probably also require the addition of new APIs for video format plugins.

I will try to find a solution that does not require so many changes, but at the moment it seems complicated.

ferserc1 commented 5 months ago

Unfortunately, it is impossible to solve this problem right now. The detailed explanation of the reason is in the following document:

https://paellaplayer.upv.es/#/doc/about_autoplay.md

daksh8559 commented 5 months ago

Thanks for clarification Fernando. If you found any solution in future please let me know.

On Thu, Apr 18, 2024 at 2:48 PM Fernando Serrano Carpena < @.***> wrote:

Unfortunately, it is impossible to solve this problem right now. The detailed explanation of the reason is in the following document:

https://paellaplayer.upv.es/#/doc/about_autoplay.md

— Reply to this email directly, view it on GitHub https://github.com/polimediaupv/paella-core/issues/360#issuecomment-2063411870, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVKDSS64LNLEFUVJ7MMNILY56FWDAVCNFSM6AAAAABGHHM74WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRTGQYTCOBXGA . You are receiving this because you authored the thread.Message ID: @.***>