mediaItemFor
A playable MediaItem for mpdUrl, over client. The item's uri stays the manifest's, for labels. readerPolicy limits the manifest fetch and every later fetch, as in manifest.
When every picture and sound representation of the Period is fragmented MP4, MPEG-TS or WebM, the item plays through the player's HLS path (#295, #401). The door writes an HLS master playlist with a variant for each video representation, an audio rendition for each audio set and a subtitle rendition for each subtitle set, and a media playlist for each, from the manifest's templates, timelines, lists or segment indexes: an MP4 file's sidx or a WebM file's Cues. So separate audio and video sets play together, the item seeks, and its variants are listed and chosen as an HLS item's are. Its segment readers share one measure of the network rate, which the automatic variant steps read. A subtitle set of WebVTT plays as it is, and one of TTML, or of TTML or WebVTT in MP4 segments (stpp, wvtt), is served as WebVTT, the only form FFmpeg's HLS reader takes (#402). A live (dynamic) manifest plays live: its playlists follow the time of day and the manifest is fetched again after each minimum update period.
A live manifest counts its window on the time of day its first usable UTCTiming names (direct, http-xsdate, http-iso or http-head), or else on the device's clock, and each refresh fetches it from the address its Location names (#404). Each audio and subtitle rendition is named by its set's Label, and its DASH roles say whether it is the main sound, forced subtitles, captions or a description of the picture. A set with a ContentProtection element is left out, and a Period with nothing else to show is refused.
A manifest of several Periods plays as one presentation (#403), as ad insertion and chapters stitch them: the tracks are the first Period's, each later Period gives each track the set with the same id, or at the same place, or in the same language, and the representation nearest its bandwidth. Every segment is moved onto one timeline, so time runs on across each boundary, and a live manifest that a refresh gives another Period plays on into it. Fragmented MP4 is written again for the initialization its stream began with, and H.264 and HEVC carry their own Period's parameter sets in band, so a Period of another picture size decodes at its own. An MP4 Period in another codec than the stream began with is skipped, and a Period without a set for a track leaves that track a gap there.
Otherwise the door plays one representation, as one stream: the highest bandwidth one of the first video adaptation set, or of the first set when there is no video. Its segments play as one DashMediaIo stream, which cannot seek. A representation with no segment addressing is one file, and it is read through KtorMediaIo with range requests, so it is seekable and never held in memory whole. maxSegmentBytes limits the segments of that stream; the HLS path reads segments as streams and holds none whole.
policy judges every URL the item asks for and every redirect of every request, as in manifest. A segment or file behind a refused redirect fails its read with DashUrlRefusedException.
Throws DashUnsupportedException for an encrypted manifest, and, when the HLS path cannot carry the segments, for more than one Period, because the one stream would stop after the first, for a live manifest, and for audio in an adaptation set of its own, because the one stream would play that video silent.
The player's automatic transport plays a manifest it recognises the same way, with no call to this (#400). This door is for a caller with a client of its own, or a policy other than DashUrlPolicy.Default.