Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
VideoJS does not update the duration display when the duration is NaN or 0. #5347
VideoJS does not update the duration display when the duration is NaN or 0.
Steps to reproduce Case A
Go to Case A .
Results In Case A
When clicking on setDuration(10) or setDuration(30) or setDuration(0.0001), the duration display UI updated.
Clicking on setDuration(0) or setDuration(NaN) does not update the duration display.
Steps to reproduce Case B
Go to Case B
Results In Case B
The duration display should reset to 0:00 or something like '-:-'.
The duration display doesn't update when the source is changed.
With plain html5 video, changing the source does indeed reset the duration,
This is occurring in the latest version as of this post (v7.1.0)
I do see the duration change in case b when the new source is loaded. I see it change from 21s to 30s.
As for case A, what's the usecase for setting a duration of 0 or NaN? Infinity does work and it puts the player into a live state as that's what a duration of infinity represents. I'd except you to only call
added a commit
Jul 26, 2018
referenced this issue
Jul 26, 2018
I removed the reference to Infinity, since it doesn't apply here.
In case B, the duration display updates only after the video starts playing, not when the source is changed. It cannot have changed from 21s to 30s prior to playing since
A use case for case A is actually case B. When the source is changed, duration should change to NaN according to W3C specs (https://www.w3.org/TR/2011/WD-html5-20110113/video.html#media-element-load-algorithm). Pull request #5348 addresses this.
Another minor use case for case A is purely for esthetic purpose. Suppose I change the media source but do not want it loaded right away (preload = 'none'), the duration should be NaN. That would normally (with #5348 fix applied) change the duration display to