AirenSoft / OvenPlayer

OvenPlayer is JavaScript-based LLHLS and WebRTC Player for OvenMediaEngine.
https://airensoft.com/ome.html
MIT License
515 stars 126 forks source link

Slow network connections cause unexpected behaviour with static media #373

Open razethion opened 1 year ago

razethion commented 1 year ago

When using ovenplayer with static media (mp4) on a slow network connection, sometimes the user will try and hit play before the media is ready. If this is done after player.on('ready') but before the file is downloaded enough, the player does recognize the play button has been pressed, but visually nothing happens. This can be confusing to the user who might try pressing play again, and think it's not functioning properly.

This can be easily reproduced by using the browser's built-in network throttling feature.

Workaround If we wait for player.on('metaChanged') to return the duration of the video, we can tell that the media has loaded enough for the player to actually do something. The way I have fixed this is by hiding the player and displaying a loading div in place of the player until the duration has been returned. Then the loading div is hidden and player is shown.

Suggested fix the "ready" state is misleading. The player will be "ready" but may not yet have downloaded the content from the server for the play button to actually be functional (and thus, is not "ready"). The player should return a "loading" state until the meta has been successfully pulled and the player will actually attempt to visually play the video.

SangwonOh commented 10 months ago

Let me check it. It may take some time due to its low priority.