I'm streaming a video file from a cloud storage bucket in an express.js server and was able to successfully pipe that stream to a video element in the frontend. However, since the video content is now loaded progressively, I can't seek through the loaded video.
My node.js code for getting a video stream from a cloud storage object is as follows.
async function getVideoStream(gcloudFileName,res){
const bucket = storage.bucket(process.env.GCS_BUCKET);
const remoteFile = bucket.file(gcloudFileName);
return remoteFile.createReadStream().pipe(res)
}
How can I make this video stream possible to seek so that users can seek through the video on the frontend? Helpful suggestions are highly appreciated.
EDIT:
I tried with @Rafael's answer and got it working up to some extent, but now the problem is the stream stops after delivering the first few chunks of the video. Also at the same time, the video also stops playing.
