player.js
player.js copied to clipboard
Undocumented / inconsistent cross-browser values for `percent` and `duration` when streaming
Expected Behavior
That there should be some consistent way to identify during playback that the viewer is watching a livestream rather than an on-demand video.
I note that https://developer.vimeo.com/player/sdk/reference#timeupdate does not document what these values should / might be for a livestream but I would have expected them to have some defined behaviour.
Actual Behavior
When viewing a livestream, the timeupdate event gives different percent and duration values depending on the browser.
| Browser | seconds | duration | percent |
|---|---|---|---|
| Current Chrome, Edge, Firefox | time elapsed since start of stream | Infinity (the JS constant) |
0 |
| Safari 15 (possibly others) | " " " | 47721.859 |
{seconds} / {duration} |
The value 47721.859 doesn't appear to correlate to anything in the event setup / schedule, as far as I can see it is just a consistent but arbitrary number.
Steps to Reproduce
During a livestream:
player.on(
'timeupdate',
({seconds, percent, duration}) => console.log(seconds, percent, duration)
);
Observe that the values reported to the console are as above.