I’m sort of working on a video sharing platform and currently I just change a <video> tag’s `src` to the link of the video someone uploaded when viewed, but it takes a bit to load, especially with short videos. So I’ve been thinking, maybe I can somehow temporarily download it to their computer so it will load faster? But it probably self-deletes once they click off the page or something. Thanks
@SempervivumFeb 26.2022 — #Try to use a hidden video tag and set the src attribute to the video in question. This way the browser should download it and keep it in it's cache. This is a proven procedure for images and I assume it will work for videos either.
@BostauthorFeb 27.2022 — #@coothead#1642875 That's not what I mean. I mean like using javascript, not a link. And it should self-delete, not just open a save window. Because then how would I get the file from their machine?
@BostauthorFeb 27.2022 — #@Sempervivum#1642868 Hmm, so then when it finished loading I would set display to block on the real video instead of the loader one?
and make the video visible when it fires. >The canplaythrough event is fired when the user agent can play the media, and estimates that enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
@ginerjmFeb 28.2022 — #Some of what you are writing makes it sound like you or your app want to take control of someone's laptop and put files on it as well as take files from it. I don't like the thought of any app doing that to my PC. Any app that deals with something like this should be giving the choice of passing files around to the user, not the author. I especially do not like your point about using JS to do this and not a link that the user clicks on and sees what's happening.
Maybe I am not seeing what you want to do. If I am not I apologize. But - I would also ask that you could give us a clearer view of what you goal is.
@BostauthorFeb 28.2022 — #@ginerjm#1642910 Oh no. No I've seen posts that do want to do that though, but it's only a video file and it'd probably just download to their temp folder and auto-delete. Also I'm pretty sure the browser would have a permission popup.
@SempervivumFeb 28.2022 — #@Bost#1642921 >What would be the cutoff for large and small videos to be separate?
I do not recommend to distinguish large ones from small ones. Use the event "canplaythrough", the browser will fire it appropriately regardless of the video being large or small.