polimediaupv / paella-core

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

Automatic playback of videos is not possible #361

Open ferserc1 opened 5 months ago

ferserc1 commented 5 months ago

Because of paella-core's way of synchronising the different streams, it is necessary to get a response to the canplay event of the videos to complete the loading of the player.

The Safari browser has a rather annoying behaviour that makes it impossible to sync videos: the canplay event is never called, if the video is not explicitly played via the play() function. For this reason, the MP4 video plugin and all its descendants call the video's play() function to trigger this event, so that video synchronisation and player loading can be completed.

The problem is that the default policy of browsers is to prevent video playback with audio, and if the user configures it this way, video playback can also be prevented completely. For this reason, in order for the call to play() not to fail, it must be triggered by a user event, such as click.

All this makes it impossible to call the paella.load() and paella.loadVideo() APIs without a user event.

The problem cannot be solved for now as the video synchronisation system works, but it will be fixed in future versions of paella-core, when the synchronization model is changed.

More information on this issue can be found at the following link:

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