I'm trying to serve videos which are being transcoded on-the-fly. Unfortunately, this means that seeking does not work. I'm assuming that this is because the browser doesn't know how long the video is and therefore can't display a seekbar properly.
Does anyone know if it's possible to hard-code the duration of a video?
The other option I've thought of may be to create my own seek-bar and use JS to update it's position and, if dragged, update the video URL to pass a start-time to the server.
Any suggestions on the best way to do this?
W
You need to provide more info into how this is working on the server. However, here's my generic answer on what I assume is going on.
You have a video in a certain format on your server and it's being served in a different format, I assume for browser compatibility (WebM for firefox etc).
What you should do is have a database for all uploaded videos which keep track of the length in it's original format. Then when transcoding the video to a different format, you can check the database to see it's length instead of trying to pull it out of the transcoding stream.
Use that to create yourself a slider with the length as the max value.
Then set currentTime to the html5 video element using the slider's value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With