import type { IManifest, IManifestMetadata } from "../../../manifest"; import type { IMediaSourceInterface } from "../../../mse"; import type { IContentInitializationData } from "../../../multithread_types"; import type { IRepresentationEstimator } from "../../adaptive"; import CmcdDataBuilder from "../../cmcd"; import type { IManifestRefreshSettings } from "../../fetchers"; import { ManifestFetcher, SegmentQueueCreator } from "../../fetchers"; import type { IThumbnailFetcher } from "../../fetchers/thumbnails/thumbnail_fetcher"; import SegmentSinksStore from "../../segment_sinks"; import FreezeResolver from "../common/FreezeResolver"; import TrackChoiceSetter from "./track_choice_setter"; import WorkerTextDisplayerInterface from "./worker_text_displayer_interface"; /** * Class facilitating the workflows behind loading a new content for the * RxPlayer Core: * * - Handle Manifest fetching and Manifest updates. * * - Handle the `MediaSource`'s creation and indirectly of its `SourceBuffer`s * as well as handling "MediaSource reloading". * * - initialize various modules (`segmentQueueCreator`, CmcdDataBuilder`, * `RepresentationEstimator`) linked to the initialized content. * * You can start loading a content through the `initializeNewContent` method. * * When a content is linked to the `ContentPreparer` you can inspect the * different initialized modules by calling its `getCurrentContent` method. * * @class ContentPreparer */ export default class ContentPreparer { /** * Information on the content linked to that `ContentPreparer` through its * `initializeNewContent` method. * `null` if no content is initialized. */ private _currentContent; /** * TaskCanceller which is triggered when the currently-initialized content is * not needed anymore, because we stopped it since or switched to a new content. */ private _contentCanceller; /** * TaskCanceller which is triggered when the currently-created MediaSource is * not needed anymore, either because the content has changed or because we * had to reload. */ private _currentMediaSourceCanceller; /** @see constructor */ private _hasVideo; /** * @param {Object} capabilities * @param {boolean} capabilities.hasVideo - If `true`, we're playing on an * element which has video capabilities. * If `false`, we're only able to play audio, optionally with subtitles. * * Typically this boolean is `true` for `