开发者

(stream.bytesLoaded / stream.bytesTotal) * video.duration != loaded seconds for mp4?

开发者 https://www.devze.com 2023-01-08 18:32 出处:网络
Good day! I\'m trying to determine how much of video is loaded (in seconds). When I try something (stream.bytesLoaded /stream.bytesTotal) * video.duration the result is not accurate because distribut

Good day!

I'm trying to determine how much of video is loaded (in seconds). When I try something (stream.bytesLoaded / stream.bytesTotal) * video.duration the result is not accurate because distribution of video stream size is not uniform inside the file.

For example if video starts with static part with video title or blank screen, the size of this part is much less (in other words compressed better) than other video with fast movements. As far as I understand MP4 is adaptive and the more movement is in the video the more space it will take.

I tried to use seek points (time + offset) defined in mp4 and it works and is really accurate, but I don't real开发者_StackOverflowly want to depend on them.

Thanks for any advices!


You are correct video loaded may vary according to compression.

A better way to handle this might be to instead display a buffer and show the user how much of the buffer has been loaded.

Otherwise, you might need to fix the videos so that they are a constant bit rate so that you can estimate how much of your video has loaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消