@svta/common-media-library
Version:
A common library for media playback in JavaScript
25 lines • 763 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDuration = getDuration;
/**
* @internal
*
* Calculate the duration of a track.
*
* `target duration * number of segments`
*
* @param manifest - Manifest of the track
* @param segments - Array of segments in a track
* @returns duration of a track
*
* @group CMAF
* @alpha
*/
function getDuration(manifest, segments) {
if (!(manifest === null || manifest === void 0 ? void 0 : manifest.targetDuration)) {
console.error('Could not calculate duration, manifest is undefined.');
return null;
}
return (manifest === null || manifest === void 0 ? void 0 : manifest.targetDuration) * segments.length;
}
//# sourceMappingURL=getDuration.js.map