UNPKG

@theoplayer/react-native-ui

Version:

A React Native UI for @theoplayer/react-native

30 lines (27 loc) 717 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isAtLive = isAtLive; exports.isLiveDuration = isLiveDuration; const LIVE_MARGIN = 10_000; /** * Check whether the player is playing a live stream. */ function isLiveDuration(duration) { return duration !== undefined && !isFinite(duration); } /** * Check whether the given timestamp is at the live point. */ 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