v0l / zap.stream

Nostr live streaming
https://zap.stream
MIT License
33 stars 12 forks source link

fix: call video.play() after short delay to ensure cached video is playing on load #5

Closed stacktoshi closed 6 months ago

stacktoshi commented 6 months ago

Certain cached videos such as RHR and Stacker News Live don't automatically play. Examples:

This PR just adds a small delay and then attempts to call play on the video element after the manifest is parsed.

It also catches the exception that usually results from having too low of a "Media Engagement Index" and set the play state to paused:

DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD

working demo of this branch: https://zap.nostril.cam/naddr1qqjrzvrzx93njep4943rsde3956r2e3494sn2e3k943x2dpjxc6nwcf4xcckvqg3waehxw309ahx7um5wgh8w6twv5hsygx0gknt5ymr44ldyyaq0rn3p5jpzkh8y8ymg773a06ytr4wldxz55psgqqqwens76sav9

v0l commented 6 months ago

Fixed in 459db5b9c2e8979aed05978fbd140ec697954adf