@theoplayer/react-native-ui
Version:
A React Native UI for @theoplayer/react-native
23 lines (21 loc) • 581 B
JavaScript
const LIVE_MARGIN = 10_000;
/**
* Check whether the player is playing a live stream.
*/
export function isLiveDuration(duration) {
return duration !== undefined && !isFinite(duration);
}
/**
* Check whether the given timestamp is at the live point.
*/
export function isAtLive(duration, time, seekable) {
if (isLiveDuration(duration)) {
if (!seekable || seekable.length === 0) {
return true;
}
const seekableEnd = seekable[seekable.length - 1].end;
return seekableEnd - time < LIVE_MARGIN;
}
return false;
}
//# sourceMappingURL=LiveUtils.js.map