Source: externs/shaka/player.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2016 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @externs
  8. */
  9. /**
  10. * @typedef {{
  11. * timestamp: number,
  12. * id: number,
  13. * type: string,
  14. * fromAdaptation: boolean,
  15. * bandwidth: ?number
  16. * }}
  17. *
  18. * @property {number} timestamp
  19. * The timestamp the choice was made, in seconds since 1970
  20. * (i.e. <code>Date.now() / 1000</code>).
  21. * @property {number} id
  22. * The id of the track that was chosen.
  23. * @property {string} type
  24. * The type of track chosen (<code>'variant'</code> or <code>'text'</code>).
  25. * @property {boolean} fromAdaptation
  26. * <code>true</code> if the choice was made by AbrManager for adaptation;
  27. * <code>false</code> if it was made by the application through
  28. * <code>selectTrack</code>.
  29. * @property {?number} bandwidth
  30. * The bandwidth of the chosen track (<code>null</code> for text).
  31. * @exportDoc
  32. */
  33. shaka.extern.TrackChoice;
  34. /**
  35. * @typedef {{
  36. * timestamp: number,
  37. * state: string,
  38. * duration: number
  39. * }}
  40. *
  41. * @property {number} timestamp
  42. * The timestamp the state was entered, in seconds since 1970
  43. * (i.e. <code>Date.now() / 1000</code>).
  44. * @property {string} state
  45. * The state the player entered. This could be <code>'buffering'</code>,
  46. * <code>'playing'</code>, <code>'paused'</code>, or <code>'ended'</code>.
  47. * @property {number} duration
  48. * The number of seconds the player was in this state. If this is the last
  49. * entry in the list, the player is still in this state, so the duration will
  50. * continue to increase.
  51. * @exportDoc
  52. */
  53. shaka.extern.StateChange;
  54. /**
  55. * @typedef {{
  56. * width: number,
  57. * height: number,
  58. * streamBandwidth: number,
  59. *
  60. * decodedFrames: number,
  61. * droppedFrames: number,
  62. * corruptedFrames: number,
  63. * estimatedBandwidth: number,
  64. *
  65. * completionPercent: number,
  66. * loadLatency: number,
  67. * manifestTimeSeconds: number,
  68. * drmTimeSeconds: number,
  69. * playTime: number,
  70. * pauseTime: number,
  71. * bufferingTime: number,
  72. * licenseTime: number,
  73. * liveLatency: number,
  74. *
  75. * maxSegmentDuration: number,
  76. *
  77. * gapsJumped: number,
  78. * stallsDetected: number,
  79. *
  80. * manifestSizeBytes: number,
  81. * bytesDownloaded: number,
  82. *
  83. * nonFatalErrorCount: number,
  84. * manifestPeriodCount: number,
  85. * manifestGapCount: number,
  86. *
  87. * switchHistory: !Array<shaka.extern.TrackChoice>,
  88. * stateHistory: !Array<shaka.extern.StateChange>
  89. * }}
  90. *
  91. * @description
  92. * Contains statistics and information about the current state of the player.
  93. * This is meant for applications that want to log quality-of-experience (QoE)
  94. * or other stats. These values will reset when <code>load()</code> is called
  95. * again.
  96. *
  97. * @property {number} width
  98. * The width of the current video track. If nothing is loaded or the content
  99. * is audio-only, NaN.
  100. * @property {number} height
  101. * The height of the current video track. If nothing is loaded or the content
  102. * is audio-only, NaN.
  103. * @property {number} streamBandwidth
  104. * The bandwidth required for the current streams (total, in bit/sec).
  105. * It takes into account the playbackrate. If nothing is loaded, NaN.
  106. *
  107. * @property {number} decodedFrames
  108. * The total number of frames decoded by the Player. If not reported by the
  109. * browser, NaN.
  110. * @property {number} droppedFrames
  111. * The total number of frames dropped by the Player. If not reported by the
  112. * browser, NaN.
  113. * @property {number} corruptedFrames
  114. * The total number of corrupted frames dropped by the browser. If not
  115. * reported by the browser, NaN.
  116. * @property {number} estimatedBandwidth
  117. * The current estimated network bandwidth (in bit/sec). If no estimate
  118. * available, NaN.
  119. *
  120. * @property {number} gapsJumped
  121. * The total number of playback gaps jumped by the GapJumpingController.
  122. * If nothing is loaded, NaN.
  123. * @property {number} stallsDetected
  124. * The total number of playback stalls detected by the StallDetector.
  125. * If nothing is loaded, NaN.
  126. *
  127. * @property {number} completionPercent
  128. * This is the greatest completion percent that the user has experienced in
  129. * playback. Also known as the "high water mark". If nothing is loaded, or
  130. * the stream is live (and therefore indefinite), NaN.
  131. * @property {number} loadLatency
  132. * This is the number of seconds it took for the video element to have enough
  133. * data to begin playback. This is measured from the time load() is called to
  134. * the time the <code>'loadeddata'</code> event is fired by the media element.
  135. * If nothing is loaded, NaN.
  136. * @property {number} manifestTimeSeconds
  137. * The amount of time it took to download and parse the manifest.
  138. * If nothing is loaded, NaN.
  139. * @property {number} drmTimeSeconds
  140. * The amount of time it took to download the first drm key, and load that key
  141. * into the drm system. If nothing is loaded or DRM is not in use, NaN.
  142. * @property {number} playTime
  143. * The total time spent in a playing state in seconds. If nothing is loaded,
  144. * NaN.
  145. * @property {number} pauseTime
  146. * The total time spent in a paused state in seconds. If nothing is loaded,
  147. * NaN.
  148. * @property {number} bufferingTime
  149. * The total time spent in a buffering state in seconds. If nothing is
  150. * loaded, NaN.
  151. * @property {number} licenseTime
  152. * The time spent on license requests during this session in seconds. If DRM
  153. * is not in use, NaN.
  154. * @property {number} liveLatency
  155. * The time between the capturing of a frame and the end user having it
  156. * displayed on their screen. If nothing is loaded or the content is VOD,
  157. * NaN.
  158. *
  159. * @property {number} maxSegmentDuration
  160. * The presentation's max segment duration in seconds. If nothing is loaded,
  161. * NaN.
  162. *
  163. * @property {number} manifestSizeBytes
  164. * Size of the manifest payload. For DASH & MSS it will match the latest
  165. * downloaded manifest. For HLS, it will match the lastly downloaded playlist.
  166. * If nothing is loaded or in src= mode, NaN.
  167. * @property {number} bytesDownloaded
  168. * The bytes downloaded during the playback. If nothing is loaded, NaN.
  169. *
  170. * @property {number} nonFatalErrorCount
  171. * The amount of non fatal errors that occurred. If nothing is loaded, NaN.
  172. * @property {number} manifestPeriodCount
  173. * The amount of periods occurred in the manifest. For DASH it represents
  174. * number of Period elements in a manifest. For HLS & MSS it is always 1.
  175. * In src= mode or if nothing is loaded, NaN.
  176. * @property {number} manifestGapCount
  177. * The amount of gaps found in a manifest. For DASH, it represents number of
  178. * discontinuities found between periods. For HLS, it is a number of EXT-X-GAP
  179. * and GAP=YES occurrences. For MSS, it is always set to 0.
  180. * If in src= mode or nothing is loaded, NaN.
  181. *
  182. * @property {!Array<shaka.extern.TrackChoice>} switchHistory
  183. * A history of the stream changes.
  184. * @property {!Array<shaka.extern.StateChange>} stateHistory
  185. * A history of the state changes.
  186. * @exportDoc
  187. */
  188. shaka.extern.Stats;
  189. /**
  190. * @typedef {{
  191. * start: number,
  192. * end: number
  193. * }}
  194. *
  195. * @description
  196. * Contains the times of a range of buffered content.
  197. *
  198. * @property {number} start
  199. * The start time of the range, in seconds.
  200. * @property {number} end
  201. * The end time of the range, in seconds.
  202. * @exportDoc
  203. */
  204. shaka.extern.BufferedRange;
  205. /**
  206. * @typedef {{
  207. * total: !Array<shaka.extern.BufferedRange>,
  208. * audio: !Array<shaka.extern.BufferedRange>,
  209. * video: !Array<shaka.extern.BufferedRange>,
  210. * text: !Array<shaka.extern.BufferedRange>
  211. * }}
  212. *
  213. * @description
  214. * Contains information about the current buffered ranges.
  215. *
  216. * @property {!Array<shaka.extern.BufferedRange>} total
  217. * The combined audio/video buffered ranges, reported by
  218. * <code>video.buffered</code>.
  219. * @property {!Array<shaka.extern.BufferedRange>} audio
  220. * The buffered ranges for audio content.
  221. * @property {!Array<shaka.extern.BufferedRange>} video
  222. * The buffered ranges for video content.
  223. * @property {!Array<shaka.extern.BufferedRange>} text
  224. * The buffered ranges for text content.
  225. * @exportDoc
  226. */
  227. shaka.extern.BufferedInfo;
  228. /**
  229. * @typedef {{
  230. * id: number,
  231. * active: boolean,
  232. *
  233. * type: string,
  234. * bandwidth: number,
  235. *
  236. * language: string,
  237. * label: ?string,
  238. * kind: ?string,
  239. * width: ?number,
  240. * height: ?number,
  241. * frameRate: ?number,
  242. * pixelAspectRatio: ?string,
  243. * hdr: ?string,
  244. * colorGamut: ?string,
  245. * videoLayout: ?string,
  246. * mimeType: ?string,
  247. * audioMimeType: ?string,
  248. * videoMimeType: ?string,
  249. * codecs: ?string,
  250. * audioCodec: ?string,
  251. * videoCodec: ?string,
  252. * primary: boolean,
  253. * roles: !Array<string>,
  254. * audioRoles: Array<string>,
  255. * accessibilityPurpose: ?shaka.media.ManifestParser.AccessibilityPurpose,
  256. * forced: boolean,
  257. * videoId: ?number,
  258. * audioId: ?number,
  259. * audioGroupId: ?string,
  260. * channelsCount: ?number,
  261. * audioSamplingRate: ?number,
  262. * tilesLayout: ?string,
  263. * audioBandwidth: ?number,
  264. * videoBandwidth: ?number,
  265. * spatialAudio: boolean,
  266. * originalVideoId: ?string,
  267. * originalAudioId: ?string,
  268. * originalTextId: ?string,
  269. * originalImageId: ?string,
  270. * originalLanguage: ?string
  271. * }}
  272. *
  273. * @description
  274. * An object describing a media track. This object should be treated as
  275. * read-only as changing any values does not have any effect. This is the
  276. * public view of an audio/video paring (variant type) or text track (text
  277. * type) or image track (image type).
  278. *
  279. * @property {number} id
  280. * The unique ID of the track.
  281. * @property {boolean} active
  282. * If true, this is the track being streamed (another track may be
  283. * visible/audible in the buffer).
  284. *
  285. * @property {string} type
  286. * The type of track, either <code>'variant'</code> or <code>'text'</code>
  287. * or <code>'image'</code>.
  288. * @property {number} bandwidth
  289. * The bandwidth required to play the track, in bits/sec.
  290. *
  291. * @property {string} language
  292. * The language of the track, or <code>'und'</code> if not given. This value
  293. * is normalized as follows - language part is always lowercase and translated
  294. * to ISO-639-1 when possible, locale part is always uppercase,
  295. * i.e. <code>'en-US'</code>.
  296. * @property {?string} label
  297. * The track label, which is unique text that should describe the track.
  298. * @property {?string} kind
  299. * (only for text tracks) The kind of text track, either
  300. * <code>'caption'</code> or <code>'subtitle'</code>.
  301. * @property {?number} width
  302. * The video width provided in the manifest, if present.
  303. * @property {?number} height
  304. * The video height provided in the manifest, if present.
  305. * @property {?number} frameRate
  306. * The video framerate provided in the manifest, if present.
  307. * @property {?string} pixelAspectRatio
  308. * The video pixel aspect ratio provided in the manifest, if present.
  309. * @property {?string} hdr
  310. * The video HDR provided in the manifest, if present.
  311. * @property {?string} colorGamut
  312. * The video color gamut provided in the manifest, if present.
  313. * @property {?string} videoLayout
  314. * The video layout provided in the manifest, if present.
  315. * @property {?string} mimeType
  316. * The MIME type of the content provided in the manifest.
  317. * @property {?string} audioMimeType
  318. * The audio MIME type of the content provided in the manifest.
  319. * @property {?string} videoMimeType
  320. * The video MIME type of the content provided in the manifest.
  321. * @property {?string} codecs
  322. * The audio/video codecs string provided in the manifest, if present.
  323. * @property {?string} audioCodec
  324. * The audio codecs string provided in the manifest, if present.
  325. * @property {?string} videoCodec
  326. * The video codecs string provided in the manifest, if present.
  327. * @property {boolean} primary
  328. * True indicates that this in the primary language for the content.
  329. * This flag is based on signals from the manifest.
  330. * This can be a useful hint about which language should be the default, and
  331. * indicates which track Shaka will use when the user's language preference
  332. * cannot be satisfied.
  333. * @property {!Array<string>} roles
  334. * The roles of the track, e.g. <code>'main'</code>, <code>'caption'</code>,
  335. * or <code>'commentary'</code>.
  336. * @property {Array<string>} audioRoles
  337. * The roles of the audio in the track, e.g. <code>'main'</code> or
  338. * <code>'commentary'</code>. Will be null for text tracks or variant tracks
  339. * without audio.
  340. * @property {?shaka.media.ManifestParser.AccessibilityPurpose
  341. * } accessibilityPurpose
  342. * The DASH accessibility descriptor, if one was provided for this track.
  343. * For text tracks, this describes the text; otherwise, this is for the audio.
  344. * @property {boolean} forced
  345. * True indicates that this in the forced text language for the content.
  346. * This flag is based on signals from the manifest.
  347. * @property {?number} videoId
  348. * (only for variant tracks) The video stream id.
  349. * @property {?number} audioId
  350. * (only for variant tracks) The audio stream id.
  351. * @property {?string} audioGroupId
  352. * (only for variant tracks)
  353. * The ID of the stream's parent element. In DASH, this will be a unique
  354. * ID that represents the representation's parent adaptation element
  355. * @property {?number} channelsCount
  356. * The count of the audio track channels.
  357. * @property {?number} audioSamplingRate
  358. * Specifies the maximum sampling rate of the content.
  359. * @property {?string} tilesLayout
  360. * The value is a grid-item-dimension consisting of two positive decimal
  361. * integers in the format: column-x-row ('4x3'). It describes the arrangement
  362. * of Images in a Grid. The minimum valid LAYOUT is '1x1'.
  363. * @property {boolean} spatialAudio
  364. * True indicates that the content has spatial audio.
  365. * This flag is based on signals from the manifest.
  366. * @property {?number} audioBandwidth
  367. * (only for variant tracks) The audio stream's bandwidth if known.
  368. * @property {?number} videoBandwidth
  369. * (only for variant tracks) The video stream's bandwidth if known.
  370. * @property {?string} originalVideoId
  371. * (variant tracks only) The original ID of the video part of the track, if
  372. * any, as it appeared in the original manifest.
  373. * @property {?string} originalAudioId
  374. * (variant tracks only) The original ID of the audio part of the track, if
  375. * any, as it appeared in the original manifest.
  376. * @property {?string} originalTextId
  377. * (text tracks only) The original ID of the text track, if any, as it
  378. * appeared in the original manifest.
  379. * @property {?string} originalImageId
  380. * (image tracks only) The original ID of the image track, if any, as it
  381. * appeared in the original manifest.
  382. * @property {?string} originalLanguage
  383. * The original language of the track, if any, as it appeared in the original
  384. * manifest. This is the exact value provided in the manifest; for normalized
  385. * value use <code>language</code> property.
  386. * @exportDoc
  387. */
  388. shaka.extern.Track;
  389. /**
  390. * @typedef {{
  391. * active: boolean,
  392. * language: string,
  393. * label: ?string,
  394. * mimeType: ?string,
  395. * codecs: ?string,
  396. * primary: boolean,
  397. * roles: !Array<string>,
  398. * accessibilityPurpose: ?shaka.media.ManifestParser.AccessibilityPurpose,
  399. * channelsCount: ?number,
  400. * audioSamplingRate: ?number,
  401. * spatialAudio: boolean,
  402. * originalLanguage: ?string
  403. * }}
  404. *
  405. * @description
  406. * An object describing a audio track. This object should be treated as
  407. * read-only as changing any values does not have any effect.
  408. *
  409. * @property {boolean} active
  410. * If true, this is the track being streamed (another track may be
  411. * visible/audible in the buffer).
  412. *
  413. * @property {string} language
  414. * The language of the track, or <code>'und'</code> if not given. This value
  415. * is normalized as follows - language part is always lowercase and translated
  416. * to ISO-639-1 when possible, locale part is always uppercase,
  417. * i.e. <code>'en-US'</code>.
  418. * @property {?string} label
  419. * The track label, which is unique text that should describe the track.
  420. * @property {?string} mimeType
  421. * The MIME type of the content provided in the manifest.
  422. * @property {?string} codecs
  423. * The audio codecs string provided in the manifest, if present.
  424. * @property {boolean} primary
  425. * True indicates that this in the primary language for the content.
  426. * This flag is based on signals from the manifest.
  427. * This can be a useful hint about which language should be the default, and
  428. * indicates which track Shaka will use when the user's language preference
  429. * cannot be satisfied.
  430. * @property {!Array<string>} roles
  431. * The roles of the track, e.g. <code>'main'</code>, <code>'caption'</code>,
  432. * or <code>'commentary'</code>.
  433. * @property {?shaka.media.ManifestParser.AccessibilityPurpose
  434. * } accessibilityPurpose
  435. * The DASH accessibility descriptor, if one was provided for this track.
  436. * @property {?number} channelsCount
  437. * The count of the audio track channels.
  438. * @property {?number} audioSamplingRate
  439. * Specifies the maximum sampling rate of the content.
  440. * @property {boolean} spatialAudio
  441. * True indicates that the content has spatial audio.
  442. * This flag is based on signals from the manifest.
  443. * @property {?string} originalLanguage
  444. * The original language of the track, if any, as it appeared in the original
  445. * manifest. This is the exact value provided in the manifest; for normalized
  446. * value use <code>language</code> property.
  447. * @exportDoc
  448. */
  449. shaka.extern.AudioTrack;
  450. /**
  451. * @typedef {!Array<!shaka.extern.Track>}
  452. */
  453. shaka.extern.TrackList;
  454. /**
  455. * @typedef {{
  456. * minWidth: number,
  457. * maxWidth: number,
  458. * minHeight: number,
  459. * maxHeight: number,
  460. * minPixels: number,
  461. * maxPixels: number,
  462. *
  463. * minFrameRate: number,
  464. * maxFrameRate: number,
  465. *
  466. * minBandwidth: number,
  467. * maxBandwidth: number,
  468. *
  469. * minChannelsCount: number,
  470. * maxChannelsCount: number
  471. * }}
  472. *
  473. * @description
  474. * An object describing application restrictions on what tracks can play. All
  475. * restrictions must be fulfilled for a track to be playable/selectable.
  476. * The restrictions system behaves somewhat differently at the ABR level and the
  477. * player level, so please refer to the documentation for those specific
  478. * settings.
  479. *
  480. * @see shaka.extern.PlayerConfiguration
  481. * @see shaka.extern.AbrConfiguration
  482. *
  483. * @property {number} minWidth
  484. * The minimum width of a video track, in pixels.
  485. * <br>
  486. * Defaults to <code>0</code>.
  487. * @property {number} maxWidth
  488. * The maximum width of a video track, in pixels.
  489. * <br>
  490. * Defaults to <code>Infinity</code>.
  491. * @property {number} minHeight
  492. * The minimum height of a video track, in pixels.
  493. * <br>
  494. * Defaults to <code>0</code>.
  495. * @property {number} maxHeight
  496. * The maximum height of a video track, in pixels.
  497. * <br>
  498. * Defaults to <code>Infinity</code>.
  499. * @property {number} minPixels
  500. * The minimum number of total pixels in a video track (i.e.
  501. * <code>width * height</code>).
  502. * <br>
  503. * Defaults to <code>0</code>.
  504. * @property {number} maxPixels
  505. * The maximum number of total pixels in a video track (i.e.
  506. * <code>width * height</code>).
  507. * <br>
  508. * Defaults to <code>Infinity</code>.
  509. *
  510. * @property {number} minFrameRate
  511. * The minimum framerate of a variant track.
  512. * <br>
  513. * Defaults to <code>0</code>.
  514. * @property {number} maxFrameRate
  515. * The maximum framerate of a variant track.
  516. * <br>
  517. * Defaults to <code>Infinity</code>.
  518. *
  519. * @property {number} minBandwidth
  520. * The minimum bandwidth of a variant track, in bit/sec.
  521. * <br>
  522. * Defaults to <code>0</code>.
  523. * @property {number} maxBandwidth
  524. * The maximum bandwidth of a variant track, in bit/sec.
  525. * <br>
  526. * Defaults to <code>Infinity</code>.
  527. *
  528. * @property {number} minChannelsCount
  529. * The minimum channels count of a variant track.
  530. * <br>
  531. * Defaults to <code>0</code>.
  532. * @property {number} maxChannelsCount
  533. * The maximum channels count of a variant track.
  534. * <br>
  535. * Defaults to <code>Infinity</code>.
  536. * @exportDoc
  537. */
  538. shaka.extern.Restrictions;
  539. /**
  540. * @typedef {{
  541. * persistentState: boolean,
  542. * encryptionSchemes: !Array<string|null>,
  543. * videoRobustnessLevels: !Array<string>,
  544. * audioRobustnessLevels: !Array<string>,
  545. * minHdcpVersions: !Array<string>
  546. * }}
  547. *
  548. * @property {boolean} persistentState
  549. * Whether this key system supports persistent state.
  550. * @property {!Array<string|null>} encryptionSchemes
  551. * An array of encryption schemes that are reported to work, through either
  552. * EME or MCap APIs. An empty array indicates that encryptionScheme queries
  553. * are not supported. This should not happen if our polyfills are installed.
  554. * @property {!Array<string>} videoRobustnessLevels
  555. * An array of video robustness levels that are reported to work. An empty
  556. * array indicates that none were tested. Not all key systems have a list of
  557. * known robustness levels built into probeSupport().
  558. * @property {!Array<string>} audioRobustnessLevels
  559. * An array of audio robustness levels that are reported to work. An empty
  560. * array indicates that none were tested. Not all key systems have a list of
  561. * known robustness levels built into probeSupport().
  562. * @property {!Array<string>} minHdcpVersions
  563. * An array of min HDCP levels that are reported to work. An empty
  564. * array indicates that none were tested. Not all key systems have support to
  565. * check min HDCP levels.
  566. * @exportDoc
  567. */
  568. shaka.extern.DrmSupportType;
  569. /**
  570. * @typedef {{
  571. * manifest: !Object<string, boolean>,
  572. * media: !Object<string, boolean>,
  573. * drm: !Object<string, ?shaka.extern.DrmSupportType>,
  574. * hardwareResolution: shaka.extern.Resolution
  575. * }}
  576. *
  577. * @description
  578. * An object detailing browser support for various features.
  579. *
  580. * @property {!Object<string, boolean>} manifest
  581. * A map of supported manifest types.
  582. * The keys are manifest MIME types and file extensions.
  583. * @property {!Object<string, boolean>} media
  584. * A map of supported media types.
  585. * The keys are media MIME types.
  586. * @property {!Object<string, ?shaka.extern.DrmSupportType>} drm
  587. * A map of supported key systems.
  588. * The keys are the key system names. The value is <code>null</code> if it is
  589. * not supported. Key systems not probed will not be in this dictionary.
  590. * @property {shaka.extern.Resolution} hardwareResolution
  591. * The maximum detected hardware resolution, which may have
  592. * height==width==Infinity for devices without a maximum resolution or
  593. * without a way to detect the maximum.
  594. *
  595. * @exportDoc
  596. */
  597. shaka.extern.SupportType;
  598. /**
  599. * @typedef {{
  600. * cueTime: ?number,
  601. * data: !Uint8Array,
  602. * frames: !Array<shaka.extern.MetadataFrame>,
  603. * dts: ?number,
  604. * pts: ?number
  605. * }}
  606. *
  607. * @description
  608. * ID3 metadata in format defined by
  609. * https://id3.org/id3v2.3.0#Declared_ID3v2_frames
  610. * The content of the field.
  611. *
  612. * @property {?number} cueTime
  613. * @property {!Uint8Array} data
  614. * @property {!Array<shaka.extern.MetadataFrame>} frames
  615. * @property {?number} dts
  616. * @property {?number} pts
  617. *
  618. * @exportDoc
  619. */
  620. shaka.extern.ID3Metadata;
  621. /**
  622. * @typedef {{
  623. * type: string,
  624. * size: number,
  625. * data: Uint8Array
  626. * }}
  627. *
  628. * @description metadata raw frame.
  629. * @property {string} type
  630. * @property {number} size
  631. * @property {Uint8Array} data
  632. * @exportDoc
  633. */
  634. shaka.extern.MetadataRawFrame;
  635. /**
  636. * @typedef {{
  637. * key: string,
  638. * data: (ArrayBuffer|string|number),
  639. * description: string,
  640. * mimeType: ?string,
  641. * pictureType: ?number
  642. * }}
  643. *
  644. * @description metadata frame parsed.
  645. * @property {string} key
  646. * @property {ArrayBuffer|string|number} data
  647. * @property {string} description
  648. * @property {?string} mimeType
  649. * @property {?number} pictureType
  650. * @exportDoc
  651. */
  652. shaka.extern.MetadataFrame;
  653. /**
  654. * @typedef {{
  655. * video: ?shaka.extern.PlaybackStreamInfo,
  656. * audio: ?shaka.extern.PlaybackStreamInfo,
  657. * text: ?shaka.extern.PlaybackStreamInfo
  658. * }}
  659. *
  660. * @description Represents the state of the current variant and text.
  661. * @property {?shaka.extern.PlaybackStreamInfo} video
  662. * @property {?shaka.extern.PlaybackStreamInfo} audio
  663. * @property {?shaka.extern.PlaybackStreamInfo} text
  664. * @exportDoc
  665. */
  666. shaka.extern.PlaybackInfo;
  667. /**
  668. * @typedef {{
  669. * codecs: string,
  670. * mimeType: string,
  671. * bandwidth: number,
  672. * width: ?number,
  673. * height: ?number
  674. * }}
  675. *
  676. * @description Represents the state of the given stream.
  677. * @property {string} codecs
  678. * @property {string} mimeType
  679. * @property {number} bandwidth
  680. * @property {?number} width
  681. * @property {?number} height
  682. * @exportDoc
  683. */
  684. shaka.extern.PlaybackStreamInfo;
  685. /**
  686. * @typedef {{
  687. * startTime: number,
  688. * endTime: ?number,
  689. * values: !Array<shaka.extern.MetadataFrame>
  690. * }}
  691. *
  692. * @property {number} startTime
  693. * @property {?number} endTime
  694. * @property {!Array<shaka.extern.MetadataFrame>} values
  695. * @exportDoc
  696. */
  697. shaka.extern.HLSInterstitial;
  698. /**
  699. * @typedef {{
  700. * schemeIdUri: string,
  701. * value: string,
  702. * startTime: number,
  703. * endTime: number,
  704. * id: string,
  705. * timescale: number,
  706. * eventElement: Element,
  707. * eventNode: ?shaka.extern.xml.Node
  708. * }}
  709. *
  710. * @description
  711. * Contains information about a region of the timeline that will cause an event
  712. * to be raised when the playhead enters or exits it. In DASH this is the
  713. * EventStream element.
  714. *
  715. * @property {string} schemeIdUri
  716. * Identifies the message scheme.
  717. * @property {string} value
  718. * Specifies the value for the region.
  719. * @property {number} startTime
  720. * The presentation time (in seconds) that the region should start.
  721. * @property {number} endTime
  722. * The presentation time (in seconds) that the region should end.
  723. * @property {string} id
  724. * Specifies an identifier for this instance of the region.
  725. * @property {number} timescale
  726. * Provides the timescale, in ticks per second.
  727. * @property {Element} eventElement
  728. * <b>DEPRECATED</b>: Use eventNode instead.
  729. * The XML element that defines the Event.
  730. * @property {?shaka.extern.xml.Node} eventNode
  731. * The XML element that defines the Event.
  732. * @exportDoc
  733. */
  734. shaka.extern.TimelineRegionInfo;
  735. /**
  736. * @typedef {{
  737. * schemeIdUri: string,
  738. * startTime: number,
  739. * endTime: number,
  740. * id: string,
  741. * emsg: shaka.extern.EmsgInfo
  742. * }}
  743. *
  744. * @description
  745. * Contains information about a region of the timeline that will cause an event
  746. * to be raised when the playhead enters or exits it.
  747. *
  748. * @property {string} schemeIdUri
  749. * Identifies the metadata type.
  750. * @property {number} startTime
  751. * The presentation time (in seconds) that the region should start.
  752. * @property {number} endTime
  753. * The presentation time (in seconds) that the region should end.
  754. * @property {string} id
  755. * Specifies an identifier for this instance of the region.
  756. * @property {shaka.extern.EmsgInfo} emsg
  757. * Specifies the EMSG info.
  758. * @exportDoc
  759. */
  760. shaka.extern.EmsgTimelineRegionInfo;
  761. /**
  762. * @typedef {{
  763. * schemeIdUri: string,
  764. * startTime: number,
  765. * endTime: number,
  766. * id: string,
  767. * payload: shaka.extern.MetadataFrame
  768. * }}
  769. *
  770. * @description
  771. * Contains information about a region of the timeline that will cause an event
  772. * to be raised when the playhead enters or exits it.
  773. *
  774. * @property {string} schemeIdUri
  775. * Identifies the metadata type.
  776. * @property {number} startTime
  777. * The presentation time (in seconds) that the region should start.
  778. * @property {number} endTime
  779. * The presentation time (in seconds) that the region should end.
  780. * @property {string} id
  781. * Specifies an identifier for this instance of the region.
  782. * @property {shaka.extern.MetadataFrame} payload
  783. * Specifies the metadata frame.
  784. * @exportDoc
  785. */
  786. shaka.extern.MetadataTimelineRegionInfo;
  787. /**
  788. * @typedef {{
  789. * audioSamplingRate: ?number,
  790. * bandwidth: number,
  791. * codecs: string,
  792. * contentType: string,
  793. * frameRate: ?number,
  794. * height: ?number,
  795. * mimeType: ?string,
  796. * label: ?string,
  797. * roles: ?Array<string>,
  798. * language: ?string,
  799. * channelsCount: ?number,
  800. * pixelAspectRatio: ?string,
  801. * width: ?number
  802. * }}
  803. *
  804. * @description
  805. * Contains information about the quality of an audio or video media stream.
  806. *
  807. * @property {?number} audioSamplingRate
  808. * Specifies the maximum sampling rate of the content.
  809. * @property {number} bandwidth
  810. * The bandwidth in bits per second.
  811. * @property {string} codecs
  812. * The Stream's codecs, e.g., 'avc1.4d4015' or 'vp9', which must be
  813. * compatible with the Stream's MIME type.
  814. * @property {string} contentType
  815. * The type of content, which may be "video" or "audio".
  816. * @property {?number} frameRate
  817. * The video frame rate.
  818. * @property {?number} height
  819. * The video height in pixels.
  820. * @property {string} mimeType
  821. * The MIME type.
  822. * @property {?string} label
  823. * The stream's label, when available.
  824. * @property {?Array<string>} roles
  825. * The stream's role, when available.
  826. * @property {?string} language
  827. * The stream's language, when available.
  828. * @property {?number} channelsCount
  829. * The number of audio channels, or null if unknown.
  830. * @property {?string} pixelAspectRatio
  831. * The pixel aspect ratio value; e.g. "1:1".
  832. * @property {?number} width
  833. * The video width in pixels.
  834. * @exportDoc
  835. */
  836. shaka.extern.MediaQualityInfo;
  837. /**
  838. * @typedef {{
  839. * schemeIdUri: string,
  840. * value: string,
  841. * startTime: number,
  842. * endTime: number,
  843. * timescale: number,
  844. * presentationTimeDelta: number,
  845. * eventDuration: number,
  846. * id: number,
  847. * messageData: Uint8Array
  848. * }}
  849. *
  850. * @description
  851. * Contains information about an EMSG MP4 box.
  852. *
  853. * @property {string} schemeIdUri
  854. * Identifies the message scheme.
  855. * @property {string} value
  856. * Specifies the value for the event.
  857. * @property {number} startTime
  858. * The time that the event starts (in presentation time).
  859. * @property {number} endTime
  860. * The time that the event ends (in presentation time).
  861. * @property {number} timescale
  862. * Provides the timescale, in ticks per second.
  863. * @property {number} presentationTimeDelta
  864. * The offset that the event starts, relative to the start of the segment
  865. * this is contained in (in units of timescale).
  866. * @property {number} eventDuration
  867. * The duration of the event (in units of timescale).
  868. * @property {number} id
  869. * A field identifying this instance of the message.
  870. * @property {Uint8Array} messageData
  871. * Body of the message.
  872. * @exportDoc
  873. */
  874. shaka.extern.EmsgInfo;
  875. /**
  876. * @typedef {{
  877. * wallClockTime: number,
  878. * programStartDate: Date
  879. * }}
  880. *
  881. * @description
  882. * Contains information about an PRFT MP4 box.
  883. *
  884. * @property {number} wallClockTime
  885. * A UTC timestamp corresponding to decoding time in milliseconds.
  886. * @property {Date} programStartDate
  887. * The derived start date of the program.
  888. * @exportDoc
  889. */
  890. shaka.extern.ProducerReferenceTime;
  891. /**
  892. * @typedef {{
  893. * distinctiveIdentifierRequired: boolean,
  894. * persistentStateRequired: boolean,
  895. * videoRobustness: Array<string>,
  896. * audioRobustness: Array<string>,
  897. * serverCertificate: Uint8Array,
  898. * serverCertificateUri: string,
  899. * individualizationServer: string,
  900. * sessionType: string,
  901. * headers: !Object<string, string>
  902. * }}
  903. *
  904. * @property {boolean} distinctiveIdentifierRequired
  905. * True if the application requires the key system to support distinctive
  906. * identifiers.
  907. * <br>
  908. * Defaults to <code>false</code>.
  909. * @property {boolean} persistentStateRequired
  910. * True if the application requires the key system to support persistent
  911. * state, e.g., for persistent license storage.
  912. * <br>
  913. * Defaults to <code>false</code>.
  914. * @property {Array<string>} videoRobustness
  915. * A key-system-specific Array of strings that specifies a required security
  916. * level for video. For multiple robustness levels, list items in priority
  917. * order.
  918. * <br>
  919. * Defaults to <code>[]</code>, i.e., no specific robustness required.
  920. * @property {Array<string>} audioRobustness
  921. * A key-system-specific Array of strings that specifies a required security
  922. * level for audio. For multiple robustness levels, list items in priority
  923. * order.
  924. * <br>
  925. * Defaults to <code>[]</code>, i.e., no specific robustness required.
  926. * @property {Uint8Array} serverCertificate
  927. * <i>An empty certificate (<code>byteLength==0</code>) will be treated as
  928. * <code>null</code>.</i> <br>
  929. * <i>A certificate will be requested from the license server if
  930. * required.</i> <br>
  931. * A key-system-specific server certificate used to encrypt license requests.
  932. * Its use is optional and is meant as an optimization to avoid a round-trip
  933. * to request a certificate.
  934. * <br>
  935. * Defaults to <code>null</code>.
  936. * @property {string} serverCertificateUri
  937. * If given, will make a request to the given URI to get the server
  938. * certificate. This is ignored if <code>serverCertificate</code> is set.
  939. * <br>
  940. * Defaults to <code>''</code>.
  941. * @property {string} individualizationServer
  942. * The server that handles an <code>'individualization-request'</code>.
  943. * If the server isn't given, it will default to the license server.
  944. * <br>
  945. * Defaults to <code>''</code>.
  946. * @property {string} sessionType
  947. * The MediaKey session type to create streaming licenses with. This doesn't
  948. * affect offline storage.
  949. * <br>
  950. * Defaults to <code>'temporary'</code>.
  951. * @property {!Object<string, string>} headers
  952. * The headers to use in the license request.
  953. * <br>
  954. * Defaults to <code>{}</code>.
  955. *
  956. * @exportDoc
  957. */
  958. shaka.extern.AdvancedDrmConfiguration;
  959. /**
  960. * @typedef {{
  961. * sessionId: string,
  962. * sessionType: string,
  963. * initData: ?Uint8Array,
  964. * initDataType: ?string
  965. * }}
  966. *
  967. * @description
  968. * DRM Session Metadata for an active session
  969. *
  970. * @property {string} sessionId
  971. * Session id
  972. * @property {string} sessionType
  973. * Session type
  974. * @property {?Uint8Array} initData
  975. * Initialization data in the format indicated by initDataType.
  976. * @property {string} initDataType
  977. * A string to indicate what format initData is in.
  978. * @exportDoc
  979. */
  980. shaka.extern.DrmSessionMetadata;
  981. /**
  982. * @typedef {{
  983. * sessionId: string,
  984. * initData: ?Uint8Array,
  985. * initDataType: ?string
  986. * }}
  987. *
  988. * @description
  989. * DRM Session Metadata for saved persistent session
  990. *
  991. * @property {string} sessionId
  992. * Session id
  993. * @property {?Uint8Array} initData
  994. * Initialization data in the format indicated by initDataType.
  995. * @property {?string} initDataType
  996. * A string to indicate what format initData is in.
  997. * @exportDoc
  998. */
  999. shaka.extern.PersistentSessionMetadata;
  1000. /**
  1001. * @typedef {{
  1002. * retryParameters: shaka.extern.RetryParameters,
  1003. * servers: !Object<string, string>,
  1004. * clearKeys: !Object<string, string>,
  1005. * delayLicenseRequestUntilPlayed: boolean,
  1006. * persistentSessionOnlinePlayback: boolean,
  1007. * persistentSessionsMetadata:
  1008. * !Array<shaka.extern.PersistentSessionMetadata>,
  1009. * advanced: Object<string, shaka.extern.AdvancedDrmConfiguration>,
  1010. * initDataTransform:(shaka.extern.InitDataTransform|undefined),
  1011. * logLicenseExchange: boolean,
  1012. * updateExpirationTime: number,
  1013. * preferredKeySystems: !Array<string>,
  1014. * keySystemsMapping: !Object<string, string>,
  1015. * parseInbandPsshEnabled: boolean,
  1016. * minHdcpVersion: string,
  1017. * ignoreDuplicateInitData: boolean,
  1018. * defaultAudioRobustnessForWidevine: string,
  1019. * defaultVideoRobustnessForWidevine: string
  1020. * }}
  1021. *
  1022. * @property {shaka.extern.RetryParameters} retryParameters
  1023. * Retry parameters for license requests.
  1024. * @property {!Object<string, string>} servers
  1025. * <i>Required for all but the clear key CDM.</i> <br>
  1026. * A dictionary which maps key system IDs to their license servers.
  1027. * For example,
  1028. * <code>{'com.widevine.alpha': 'https://example.com/drm'}</code>.
  1029. * <br>
  1030. * Defaults to <code>{}</code>.
  1031. * @property {!Object<string, string>} clearKeys
  1032. * <i>Forces the use of the Clear Key CDM.</i>
  1033. * A map of key IDs (hex or base64) to keys (hex or base64).
  1034. * <br>
  1035. * Defaults to <code>{}</code>.
  1036. * @property {boolean} delayLicenseRequestUntilPlayed
  1037. * True to configure drm to delay sending a license request until a user
  1038. * actually starts playing content.
  1039. * <br>
  1040. * Defaults to <code>false</code>.
  1041. * @property {boolean} persistentSessionOnlinePlayback
  1042. * True to configure drm to try playback with given persistent session ids
  1043. * before requesting a license. Also prevents the session removal at playback
  1044. * stop, as-to be able to re-use it later.
  1045. * <br>
  1046. * Defaults to <code>false</code>.
  1047. * @property {!Array<PersistentSessionMetadata>} persistentSessionsMetadata
  1048. * Persistent sessions metadata to load before starting playback.
  1049. * <br>
  1050. * Defaults to <code>[]</code>.
  1051. * @property {Object<string, shaka.extern.AdvancedDrmConfiguration>} advanced
  1052. * <i>Optional.</i> <br>
  1053. * A dictionary which maps key system IDs to advanced DRM configuration for
  1054. * those key systems.
  1055. * <br>
  1056. * Defaults to <code>[]</code>.
  1057. * @property {shaka.extern.InitDataTransform|undefined} initDataTransform
  1058. * <i>Optional.</i><br>
  1059. * If given, this function is called with the init data from the
  1060. * manifest/media and should return the (possibly transformed) init data to
  1061. * pass to the browser.
  1062. * @property {boolean} logLicenseExchange
  1063. * <i>Optional.</i><br>
  1064. * If set to <code>true</code>, prints logs containing the license exchange.
  1065. * This includes the init data, request, and response data, printed as base64
  1066. * strings. Don't use in production, for debugging only; has no affect in
  1067. * release builds as logging is removed.
  1068. * <br>
  1069. * Defaults to <code>false</code>.
  1070. * @property {number} updateExpirationTime
  1071. * The frequency in seconds with which to check the expiration of a session.
  1072. * <br>
  1073. * Defaults to <code>1</code>.
  1074. * @property {!Array<string>} preferredKeySystems
  1075. * Specifies the priorities of available DRM key systems.
  1076. * <br>
  1077. * Defaults <code>['com.microsoft.playready']</code> on Xbox One and
  1078. * PlayStation 4, and <code>[]</code> for all other browsers.
  1079. * @property {Object<string, string>} keySystemsMapping
  1080. * A map of key system name to key system name.
  1081. * <br>
  1082. * Defaults to <code>{}</code>.
  1083. * @property {boolean} parseInbandPsshEnabled
  1084. * When true parse DRM init data from pssh boxes in media and init segments
  1085. * and ignore 'encrypted' events.
  1086. * This is required when using in-band key rotation on Xbox One.
  1087. * <br>
  1088. * Defaults to <code>true</code> on Xbox One, and <code>false</code> for all
  1089. * other browsers.
  1090. * @property {string} minHdcpVersion
  1091. * Indicates the minimum version of HDCP to start the playback of encrypted
  1092. * streams. <b>May be ignored if not supported by the device.</b>
  1093. * <br>
  1094. * Defaults to <code>''</code>, do not check the HDCP version.
  1095. * @property {boolean} ignoreDuplicateInitData
  1096. * When true indicate that the player doesn't ignore duplicate init data.
  1097. * Note: Tizen 2015 and 2016 models will send multiple webkitneedkey events
  1098. * with the same init data. If the duplicates are suppressed, playback
  1099. * will stall without errors.
  1100. * <br>
  1101. * Defaults to <code>false</code> on Tizen 2, and <code>true</code> for all
  1102. * other browsers.
  1103. * @property {string} defaultAudioRobustnessForWidevine
  1104. * Specify the default audio security level for Widevine when audio robustness
  1105. * is not specified.
  1106. * <br>
  1107. * Defaults to <code>'SW_SECURE_CRYPTO'</code>.
  1108. * @property {string} defaultVideoRobustnessForWidevine
  1109. * Specify the default video security level for Widevine when video robustness
  1110. * is not specified.
  1111. * <br>
  1112. * Defaults to <code>'SW_SECURE_DECODE'</code>.
  1113. * @exportDoc
  1114. */
  1115. shaka.extern.DrmConfiguration;
  1116. /**
  1117. * @typedef {function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array}
  1118. *
  1119. * @description
  1120. * A callback function to handle custom content ID signaling for FairPlay
  1121. * content.
  1122. *
  1123. * @exportDoc
  1124. */
  1125. shaka.extern.InitDataTransform;
  1126. /**
  1127. * @typedef {{
  1128. * tagName: !string,
  1129. * attributes: !Object<string, string>,
  1130. * children: !Array<shaka.extern.xml.Node | string>,
  1131. * parent: ?shaka.extern.xml.Node
  1132. * }}
  1133. *
  1134. * @description
  1135. * Data structure for xml nodes as simple objects
  1136. *
  1137. * @property {!string} tagName
  1138. * The name of the element
  1139. * @property {!object} attributes
  1140. * The attributes of the element
  1141. * @property {!Array<shaka.extern.xml.Node | string>} children
  1142. * The child nodes or string body of the element
  1143. * @property {?shaka.extern.xml.Node} parent
  1144. * The parent of the current element
  1145. *
  1146. * @exportDoc
  1147. */
  1148. shaka.extern.xml.Node;
  1149. /**
  1150. * @typedef {{
  1151. * clockSyncUri: string,
  1152. * disableXlinkProcessing: boolean,
  1153. * xlinkFailGracefully: boolean,
  1154. * ignoreMinBufferTime: boolean,
  1155. * autoCorrectDrift: boolean,
  1156. * initialSegmentLimit: number,
  1157. * ignoreSuggestedPresentationDelay: boolean,
  1158. * ignoreEmptyAdaptationSet: boolean,
  1159. * ignoreMaxSegmentDuration: boolean,
  1160. * keySystemsByURI: !Object<string, string>,
  1161. * manifestPreprocessor: function(!Element),
  1162. * manifestPreprocessorTXml: function(!shaka.extern.xml.Node),
  1163. * sequenceMode: boolean,
  1164. * multiTypeVariantsAllowed: boolean,
  1165. * useStreamOnceInPeriodFlattening: boolean,
  1166. * enableFastSwitching: boolean
  1167. * }}
  1168. *
  1169. * @property {string} clockSyncUri
  1170. * A default clock sync URI to be used with live streams which do not
  1171. * contain any clock sync information. The <code>Date</code> header from this
  1172. * URI will be used to determine the current time.
  1173. * <br>
  1174. * Defaults to <code>''</code>.
  1175. * @property {boolean} disableXlinkProcessing
  1176. * If true, xlink-related processing will be disabled.
  1177. * <br>
  1178. * Defaults to <code>true</code>.
  1179. * @property {boolean} xlinkFailGracefully
  1180. * If true, xlink-related errors will result in a fallback to the tag's
  1181. * existing contents. If false, xlink-related errors will be propagated
  1182. * to the application and will result in a playback failure.
  1183. * <br>
  1184. * Defaults to <code>false</code>.
  1185. * @property {boolean} ignoreMinBufferTime
  1186. * If true will cause DASH parser to ignore <code>minBufferTime</code> from
  1187. * manifest.
  1188. * <br>
  1189. * Defaults to <code>false</code>.
  1190. * @property {boolean} autoCorrectDrift
  1191. * If <code>true</code>, ignore the <code>availabilityStartTime</code> in the
  1192. * manifest and instead use the segments to determine the live edge. This
  1193. * allows us to play streams that have a lot of drift. If <code>false</code>,
  1194. * we can't play content where the manifest specifies segments in the future.
  1195. * <br>
  1196. * Defaults to <code>true</code>.
  1197. * @property {number} initialSegmentLimit
  1198. * The maximum number of initial segments to generate for
  1199. * <code>SegmentTemplate</code> with fixed-duration segments. This is limited
  1200. * to avoid excessive memory consumption with very large
  1201. * <code>timeShiftBufferDepth</code> values.
  1202. * <br>
  1203. * Defaults to <code>1000</code>.
  1204. * @property {boolean} ignoreSuggestedPresentationDelay
  1205. * If true will cause DASH parser to ignore
  1206. * <code>suggestedPresentationDelay</code> from manifest.
  1207. * <br>
  1208. * Defaults to <code>false</code>.
  1209. * @property {boolean} ignoreEmptyAdaptationSet
  1210. * If true will cause DASH parser to ignore
  1211. * empty <code>AdaptationSet</code> from manifest.
  1212. * <br>
  1213. * Defaults to <code>false</code>.
  1214. * @property {boolean} ignoreMaxSegmentDuration
  1215. * If true will cause DASH parser to ignore
  1216. * <code>maxSegmentDuration</code> from manifest.
  1217. * <br>
  1218. * Defaults to <code>false</code>.
  1219. * @property {Object<string, string>} keySystemsByURI
  1220. * A map of scheme URI to key system name. Defaults to default key systems
  1221. * mapping handled by Shaka.
  1222. * @property {function(!Element)} manifestPreprocessor
  1223. * <b>DEPRECATED</b>: Use manifestPreprocessorTXml instead.
  1224. * Called immediately after the DASH manifest has been parsed into an
  1225. * XMLDocument. Provides a way for applications to perform efficient
  1226. * preprocessing of the manifest.
  1227. * @property {function(!shaka.extern.xml.Node)} manifestPreprocessorTXml
  1228. * Called immediately after the DASH manifest has been parsed into an
  1229. * XMLDocument. Provides a way for applications to perform efficient
  1230. * preprocessing of the manifest.
  1231. * @property {boolean} sequenceMode
  1232. * If true, the media segments are appended to the SourceBuffer in
  1233. * "sequence mode" (ignoring their internal timestamps).
  1234. * <br>
  1235. * Defaults to <code>false</code>.
  1236. * @property {boolean} multiTypeVariantsAllowed
  1237. * If true, the manifest parser will create variants that have multiple
  1238. * mimeTypes or codecs for video or for audio if there is no other choice.
  1239. * Meant for content where some periods are only available in one mimeType or
  1240. * codec, and other periods are only available in a different mimeType or
  1241. * codec. For example, a stream with baked-in ads where the audio codec does
  1242. * not match the main content.
  1243. * Might result in undesirable behavior if mediaSource.codecSwitchingStrategy
  1244. * is not set to SMOOTH.
  1245. * <br>
  1246. * Defaults to true if SMOOTH codec switching is supported, RELOAD overwise.
  1247. * @property {boolean} useStreamOnceInPeriodFlattening
  1248. * If period combiner is used, this option ensures every stream is used
  1249. * only once in period flattening. It speeds up underlying algorithm
  1250. * but may raise issues if manifest does not have stream consistency
  1251. * between periods.
  1252. * <br>
  1253. * Defaults to <code>false</code>.
  1254. * @property {boolean} enableFastSwitching
  1255. * If false, disables fast switching track recognition.
  1256. * <br>
  1257. * Defaults to <code>true</code>.
  1258. * @exportDoc
  1259. */
  1260. shaka.extern.DashManifestConfiguration;
  1261. /**
  1262. * @typedef {{
  1263. * ignoreTextStreamFailures: boolean,
  1264. * ignoreImageStreamFailures: boolean,
  1265. * defaultAudioCodec: string,
  1266. * defaultVideoCodec: string,
  1267. * ignoreManifestProgramDateTime: boolean,
  1268. * ignoreManifestProgramDateTimeForTypes: !Array<string>,
  1269. * mediaPlaylistFullMimeType: string,
  1270. * liveSegmentsDelay: number,
  1271. * sequenceMode: boolean,
  1272. * ignoreManifestTimestampsInSegmentsMode: boolean,
  1273. * disableCodecGuessing: boolean,
  1274. * disableClosedCaptionsDetection: boolean,
  1275. * allowLowLatencyByteRangeOptimization: boolean,
  1276. * allowRangeRequestsToGuessMimeType: boolean
  1277. * }}
  1278. *
  1279. * @property {boolean} ignoreTextStreamFailures
  1280. * If <code>true</code>, ignore any errors in a text stream and filter out
  1281. * those streams.
  1282. * <br>
  1283. * Defaults to <code>false</code>.
  1284. * @property {boolean} ignoreImageStreamFailures
  1285. * If <code>true</code>, ignore any errors in a image stream and filter out
  1286. * those streams.
  1287. * <br>
  1288. * Defaults to <code>false</code>.
  1289. * @property {string} defaultAudioCodec
  1290. * The default audio codec if it is not specified in the HLS playlist.
  1291. * <br>
  1292. * Defaults to <code>'mp4a.40.2'</code>.
  1293. * @property {string} defaultVideoCodec
  1294. * The default video codec if it is not specified in the HLS playlist.
  1295. * <br>
  1296. * Defaults to <code>'avc1.42E01E'</code>.
  1297. * @property {boolean} ignoreManifestProgramDateTime
  1298. * If <code>true</code>, the HLS parser will ignore the
  1299. * <code>EXT-X-PROGRAM-DATE-TIME</code> tags in the manifest and use media
  1300. * sequence numbers instead. It also causes EXT-X-DATERANGE tags to be
  1301. * ignored. Meant for streams where <code>EXT-X-PROGRAM-DATE-TIME</code> is
  1302. * incorrect or malformed.
  1303. * <br>
  1304. * Defaults to <code>false</code>.
  1305. * @property {!Array<string>} ignoreManifestProgramDateTimeForTypes
  1306. * An array of strings representing types for which
  1307. * <code>EXT-X-PROGRAM-DATE-TIME</code> should be ignored. Only used if the
  1308. * the main ignoreManifestProgramDateTime is set to false.
  1309. * For example, setting this to ['text', 'video'] will cause the PDT values
  1310. * text and video streams to be ignored, while still using the PDT values for
  1311. * audio.
  1312. * <br>
  1313. * Defaults to <code>[]</code>.
  1314. * @property {string} mediaPlaylistFullMimeType
  1315. * A string containing a full mime type, including both the basic mime type
  1316. * and also the codecs. Used when the HLS parser parses a media playlist
  1317. * directly, required since all of the mime type and codecs information is
  1318. * contained within the master playlist.
  1319. * You can use the <code>shaka.util.MimeUtils.getFullType()</code> utility to
  1320. * format this value.
  1321. * <br>
  1322. * Defaults to <code>'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'</code>.
  1323. * @property {number} liveSegmentsDelay
  1324. * The default presentation delay will be calculated as a number of segments.
  1325. * This is the number of segments for this calculation.
  1326. * <br>
  1327. * Defaults to <code>3</code>.
  1328. * @property {boolean} sequenceMode
  1329. * If true, the media segments are appended to the SourceBuffer in
  1330. * "sequence mode" (ignoring their internal timestamps).
  1331. * <br>
  1332. * Defaults to <code>true</code> except on WebOS 3, Tizen 2,
  1333. * Tizen 3 and PlayStation 4 whose default value is <code>false</code>.
  1334. * @property {boolean} ignoreManifestTimestampsInSegmentsMode
  1335. * If true, don't adjust the timestamp offset to account for manifest
  1336. * segment durations being out of sync with segment durations. In other
  1337. * words, assume that there are no gaps in the segments when appending
  1338. * to the SourceBuffer, even if the manifest and segment times disagree.
  1339. * Only applies when sequenceMode is <code>false</code>.
  1340. * <br>
  1341. * Defaults to <code>false</code>.
  1342. * @property {boolean} disableCodecGuessing
  1343. * If set to true, the HLS parser won't automatically guess or assume default
  1344. * codec for playlists with no "CODECS" attribute. Instead, it will attempt to
  1345. * extract the missing information from the media segment.
  1346. * As a consequence, lazy-loading media playlists won't be possible for this
  1347. * use case, which may result in longer video startup times.
  1348. * <br>
  1349. * Defaults to <code>false</code>.
  1350. * @property {boolean} disableClosedCaptionsDetection
  1351. * If true, disables the automatic detection of closed captions.
  1352. * Otherwise, in the absence of a EXT-X-MEDIA tag with TYPE="CLOSED-CAPTIONS",
  1353. * Shaka Player will attempt to detect captions based on the media data.
  1354. * <br>
  1355. * Defaults to <code>false</code>.
  1356. * @property {boolean} allowLowLatencyByteRangeOptimization
  1357. * If set to true, the HLS parser will optimize operation with LL and partial
  1358. * byte range segments. More info in
  1359. * https://www.akamai.com/blog/performance/-using-ll-hls-with-byte-range-addressing-to-achieve-interoperabi
  1360. * <br>
  1361. * Defaults to <code>true</code>.
  1362. * @property {boolean} allowRangeRequestsToGuessMimeType
  1363. * If set to true, the HLS parser will use range request (only first byte) to
  1364. * guess the mime type.
  1365. * <br>
  1366. * Defaults to <code>false</code>.
  1367. * @exportDoc
  1368. */
  1369. shaka.extern.HlsManifestConfiguration;
  1370. /**
  1371. * @typedef {{
  1372. * manifestPreprocessor: function(!Element),
  1373. * manifestPreprocessorTXml: function(!shaka.extern.xml.Node),
  1374. * sequenceMode: boolean,
  1375. * keySystemsBySystemId: !Object<string, string>
  1376. * }}
  1377. *
  1378. * @property {function(!Element)} manifestPreprocessor
  1379. * <b>DEPRECATED</b>: Use manifestPreprocessorTXml instead.
  1380. * Called immediately after the MSS manifest has been parsed into an
  1381. * XMLDocument. Provides a way for applications to perform efficient
  1382. * preprocessing of the manifest.
  1383. * @property {function(!shaka.extern.xml.Node)} manifestPreprocessorTXml
  1384. * Called immediately after the MSS manifest has been parsed into an
  1385. * XMLDocument. Provides a way for applications to perform efficient
  1386. * preprocessing of the manifest.
  1387. * @property {boolean} sequenceMode
  1388. * If true, the media segments are appended to the SourceBuffer in
  1389. * "sequence mode" (ignoring their internal timestamps).
  1390. * <br>
  1391. * Defaults to <code>false</code>.
  1392. * @property {Object<string, string>} keySystemsBySystemId
  1393. * A map of system id to key system name. Defaults to default key systems
  1394. * mapping handled by Shaka.
  1395. * @exportDoc
  1396. */
  1397. shaka.extern.MssManifestConfiguration;
  1398. /**
  1399. * @typedef {{
  1400. * retryParameters: shaka.extern.RetryParameters,
  1401. * availabilityWindowOverride: number,
  1402. * disableAudio: boolean,
  1403. * disableVideo: boolean,
  1404. * disableText: boolean,
  1405. * disableThumbnails: boolean,
  1406. * disableIFrames: boolean,
  1407. * defaultPresentationDelay: number,
  1408. * segmentRelativeVttTiming: boolean,
  1409. * dash: shaka.extern.DashManifestConfiguration,
  1410. * hls: shaka.extern.HlsManifestConfiguration,
  1411. * mss: shaka.extern.MssManifestConfiguration,
  1412. * raiseFatalErrorOnManifestUpdateRequestFailure: boolean,
  1413. * continueLoadingWhenPaused: boolean,
  1414. * ignoreSupplementalCodecs: boolean,
  1415. * updatePeriod: number,
  1416. * ignoreDrmInfo: boolean
  1417. * }}
  1418. *
  1419. * @property {shaka.extern.RetryParameters} retryParameters
  1420. * Retry parameters for manifest requests.
  1421. * @property {number} availabilityWindowOverride
  1422. * A number, in seconds, that overrides the availability window in the
  1423. * manifest, or <code>NaN</code> if the default value should be used. This is
  1424. * enforced by the manifest parser, so custom manifest parsers should take
  1425. * care to honor this parameter.
  1426. * <br>
  1427. * Defaults to <code>NaN</code>.
  1428. * @property {boolean} disableAudio
  1429. * If <code>true</code>, the audio tracks are ignored.
  1430. * <br>
  1431. * Defaults to <code>false</code>.
  1432. * @property {boolean} disableVideo
  1433. * If <code>true</code>, the video tracks are ignored.
  1434. * <br>
  1435. * Defaults to <code>false</code>.
  1436. * @property {boolean} disableText
  1437. * If <code>true</code>, the text tracks are ignored.
  1438. * <br>
  1439. * Defaults to <code>false</code>.
  1440. * @property {boolean} disableThumbnails
  1441. * If <code>true</code>, the image tracks are ignored.
  1442. * <br>
  1443. * Defaults to <code>false</code>.
  1444. * @property {boolean} disableIFrames
  1445. * If <code>true</code>, the I-Frames tracks are ignored.
  1446. * <br>
  1447. * Defaults to <code>false</code>.
  1448. * @property {number} defaultPresentationDelay
  1449. * For DASH, it's a default <code>presentationDelay</code> value if
  1450. * <code>suggestedPresentationDelay</code> is missing in the MPEG DASH
  1451. * manifest. The default value is the lower of <code>1.5 *
  1452. * minBufferTime</code> and <code>segmentAvailabilityDuration</code> if not
  1453. * configured or set as 0.
  1454. * For HLS, the default value is 3 segments duration if not configured or
  1455. * set as 0.
  1456. * <br>
  1457. * Defaults to <code>0</code>.
  1458. * @property {boolean} segmentRelativeVttTiming
  1459. * Option to calculate VTT text timings relative to the segment start
  1460. * instead of relative to the period start (which is the default).
  1461. * <br>
  1462. * Defaults to <code>false</code>.
  1463. * @property {shaka.extern.DashManifestConfiguration} dash
  1464. * Advanced parameters used by the DASH manifest parser.
  1465. * @property {shaka.extern.HlsManifestConfiguration} hls
  1466. * Advanced parameters used by the HLS manifest parser.
  1467. * @property {shaka.extern.MssManifestConfiguration} mss
  1468. * Advanced parameters used by the MSS manifest parser.
  1469. * @property {boolean} raiseFatalErrorOnManifestUpdateRequestFailure
  1470. * If true, manifest update request failures will cause a fatal error.
  1471. * <br>
  1472. * Defaults to <code>false</code>.
  1473. * @property {boolean} continueLoadingWhenPaused
  1474. * If true, live manifest will be updated with the regular intervals even if
  1475. * the video is paused.
  1476. * <br>
  1477. * Defaults to <code>true</code>.
  1478. * @property {boolean} ignoreSupplementalCodecs
  1479. * If true, ignores supplemental codecs.
  1480. * <br>
  1481. * Defaults to <code>false</code>.
  1482. * @property {number} updatePeriod
  1483. * For DASH:
  1484. * Override the minimumUpdatePeriod of the manifest. The value is in seconds.
  1485. * If the value is greater than the minimumUpdatePeriod, it will update the
  1486. * manifest less frequently. If you update the value during for a dynamic
  1487. * manifest, it will directly trigger a new download of the manifest.
  1488. * <br>
  1489. * For HLS:
  1490. * Override the update period of the playlist. The value is in seconds.
  1491. * If the value is less than 0, the period will be determined based on the
  1492. * segment length. If the value is greater than 0, it will update the target
  1493. * duration. If you update the value during the live, it will directly
  1494. * trigger a new download of the manifest.
  1495. * <br>
  1496. * Defaults to <code>-1</code>.
  1497. * @property {boolean} ignoreDrmInfo
  1498. * If true will cause DASH/HLS parser to ignore DRM information specified
  1499. * by the manifest and treat it as if it signaled no particular key
  1500. * system and contained no init data.
  1501. * <br>
  1502. * Defaults to <code>false</code>.
  1503. * @exportDoc
  1504. */
  1505. shaka.extern.ManifestConfiguration;
  1506. /**
  1507. * @typedef {{
  1508. * enabled: boolean,
  1509. * stabilityThreshold: number,
  1510. * rebufferIncrement: number,
  1511. * maxAttempts: number,
  1512. * maxLatency: number,
  1513. * minLatency: number
  1514. * }}
  1515. *
  1516. * @description
  1517. * Dynamic Target Latency configuration options.
  1518. *
  1519. * @property {boolean} enabled
  1520. * If <code>true</code>, dynamic latency for live sync is enabled. When
  1521. * enabled, the target latency will be adjusted closer to the min latency
  1522. * when playback is stable (see <code>stabilityThreshold</code>). If
  1523. * there are rebuffering events, then the target latency will move towards
  1524. * the max latency value in increments of <code>rebufferIncrement</code>.
  1525. * <br>
  1526. * Defaults to <code>false</code>
  1527. * @property {number} rebufferIncrement
  1528. * The value, in seconds, to increment the target latency towards
  1529. * <code>maxLatency</code> after a rebuffering event.
  1530. * <br>
  1531. * Defaults to <code>0.5</code>
  1532. * @property {number} stabilityThreshold
  1533. * Number of seconds after a rebuffering before we are considered stable and
  1534. * will move the target latency towards <code>minLatency</code>
  1535. * value.
  1536. * <br>
  1537. * Defaults to <code>60</code>.
  1538. * @property {number} maxAttempts
  1539. * Number of times that dynamic target latency will back off to
  1540. * <code>maxLatency</code> and attempt to adjust it closer to
  1541. * <code>minLatency</code>.
  1542. * <br>
  1543. * Defaults to <code>10</code>.
  1544. * @property {number} maxLatency
  1545. * The latency to use when a rebuffering event causes us to back off from
  1546. * the live edge.
  1547. * <br>
  1548. * Defaults to <code>4</code>.
  1549. * @property {number} minLatency
  1550. * The latency to work towards when the network is stable and we want to get
  1551. * closer to the live edge.
  1552. * <br>
  1553. * Defaults to <code>1</code>.
  1554. * @exportDoc
  1555. */
  1556. shaka.extern.DynamicTargetLatencyConfiguration;
  1557. /**
  1558. * @typedef {{
  1559. * enabled: boolean,
  1560. * targetLatency: number,
  1561. * targetLatencyTolerance: number,
  1562. * maxPlaybackRate: number,
  1563. * minPlaybackRate: number,
  1564. * panicMode: boolean,
  1565. * panicThreshold: number,
  1566. * dynamicTargetLatency: shaka.extern.DynamicTargetLatencyConfiguration
  1567. * }}
  1568. *
  1569. * @description
  1570. * LiveSync configuration options.
  1571. *
  1572. * @property {boolean} enabled
  1573. * Enable the live stream sync against the live edge by changing the playback
  1574. * rate.
  1575. * Note: on some SmartTVs, if this is activated, it may not work or the sound
  1576. * may be lost when activated.
  1577. * <br>
  1578. * Defaults to <code>false</code>.
  1579. * @property {number} targetLatency
  1580. * Preferred latency, in seconds. Effective only if liveSync is true.
  1581. * <br>
  1582. * Defaults to <code>0.5</code>.
  1583. * @property {number} targetLatencyTolerance
  1584. * Latency tolerance for target latency, in seconds. Effective only if
  1585. * liveSync is enabled.
  1586. * <br>
  1587. * Defaults to <code>0.5</code>.
  1588. * @property {number} maxPlaybackRate
  1589. * Max playback rate used for latency chasing. It is recommended to use a
  1590. * value between 1 and 2. Effective only if liveSync is enabled.
  1591. * <br>
  1592. * Defaults to <code>1.1</code>.
  1593. * @property {number} minPlaybackRate
  1594. * Minimum playback rate used for latency chasing. It is recommended to use a
  1595. * value between 0 and 1. Effective only if liveSync is enabled.
  1596. * <br>
  1597. * Defaults to <code>0.95</code>.
  1598. * @property {boolean} panicMode
  1599. * If <code>true</code>, panic mode for live sync is enabled. When enabled,
  1600. * will set the playback rate to the <code>minPlaybackRate</code>
  1601. * until playback has continued past a rebuffering for longer than the
  1602. * <code>panicThreshold</code>.
  1603. * <br>
  1604. * Defaults to <code>false</code>.
  1605. * @property {number} panicThreshold
  1606. * Number of seconds that playback stays in panic mode after a rebuffering.
  1607. * <br>
  1608. * Defaults to <code>60</code>.
  1609. * @property {shaka.extern.DynamicTargetLatencyConfiguration
  1610. * } dynamicTargetLatency
  1611. *
  1612. * The dynamic target latency config for dynamically adjusting the target
  1613. * latency to be closer to edge when network conditions are good and to back
  1614. * off when network conditions are bad.
  1615. * @exportDoc
  1616. */
  1617. shaka.extern.LiveSyncConfiguration;
  1618. /**
  1619. * @typedef {{
  1620. * retryParameters: shaka.extern.RetryParameters,
  1621. * failureCallback: function(!shaka.util.Error),
  1622. * rebufferingGoal: number,
  1623. * bufferingGoal: number,
  1624. * bufferBehind: number,
  1625. * evictionGoal: number,
  1626. * ignoreTextStreamFailures: boolean,
  1627. * alwaysStreamText: boolean,
  1628. * startAtSegmentBoundary: boolean,
  1629. * gapDetectionThreshold: number,
  1630. * gapPadding: number,
  1631. * gapJumpTimerTime: number,
  1632. * durationBackoff: number,
  1633. * safeSeekOffset: number,
  1634. * safeSeekEndOffset: number,
  1635. * stallEnabled: boolean,
  1636. * stallThreshold: number,
  1637. * stallSkip: number,
  1638. * useNativeHlsForFairPlay: boolean,
  1639. * inaccurateManifestTolerance: number,
  1640. * lowLatencyMode: boolean,
  1641. * forceHTTP: boolean,
  1642. * forceHTTPS: boolean,
  1643. * minBytesForProgressEvents: number,
  1644. * preferNativeDash: boolean,
  1645. * preferNativeHls: boolean,
  1646. * updateIntervalSeconds: number,
  1647. * observeQualityChanges: boolean,
  1648. * maxDisabledTime: number,
  1649. * segmentPrefetchLimit: number,
  1650. * prefetchAudioLanguages: !Array<string>,
  1651. * disableAudioPrefetch: boolean,
  1652. * disableTextPrefetch: boolean,
  1653. * disableVideoPrefetch: boolean,
  1654. * liveSync: shaka.extern.LiveSyncConfiguration,
  1655. * allowMediaSourceRecoveries: boolean,
  1656. * minTimeBetweenRecoveries: number,
  1657. * vodDynamicPlaybackRate: boolean,
  1658. * vodDynamicPlaybackRateLowBufferRate: number,
  1659. * vodDynamicPlaybackRateBufferRatio: number,
  1660. * preloadNextUrlWindow: number,
  1661. * loadTimeout: number,
  1662. * clearDecodingCache: boolean,
  1663. * dontChooseCodecs: boolean,
  1664. * shouldFixTimestampOffset: boolean,
  1665. * avoidEvictionOnQuotaExceededError: boolean,
  1666. * crossBoundaryStrategy: shaka.config.CrossBoundaryStrategy
  1667. * }}
  1668. *
  1669. * @description
  1670. * The StreamingEngine's configuration options.
  1671. *
  1672. * @property {shaka.extern.RetryParameters} retryParameters
  1673. * Retry parameters for segment requests.
  1674. * @property {function(!shaka.util.Error)} failureCallback
  1675. * A callback to decide what to do on a streaming failure. Default behavior
  1676. * is to retry on live streams and not on VOD.
  1677. * @property {number} rebufferingGoal
  1678. * The minimum number of seconds of content that the StreamingEngine must
  1679. * buffer before it can begin playback or can continue playback after it has
  1680. * entered into a buffering state (i.e., after it has depleted one more
  1681. * more of its buffers).
  1682. * When the value is 0, the playback rate is not used to control the buffer.
  1683. * <br>
  1684. * Defaults to <code>0</code>.
  1685. * @property {number} bufferingGoal
  1686. * The number of seconds of content that the StreamingEngine will attempt to
  1687. * buffer ahead of the playhead. This value must be greater than or equal to
  1688. * the rebuffering goal.
  1689. * <br>
  1690. * Defaults to <code>10</code>.
  1691. * @property {number} bufferBehind
  1692. * The maximum number of seconds of content that the StreamingEngine will keep
  1693. * in buffer behind the playhead when it appends a new media segment.
  1694. * The StreamingEngine will evict content to meet this limit.
  1695. * <br>
  1696. * Defaults to <code>30</code>.
  1697. * @property {number} evictionGoal
  1698. * The minimum duration in seconds of buffer overflow the StreamingEngine
  1699. * requires to start removing content from the buffer.
  1700. * Values less than <code>1.0</code> are not recommended.
  1701. * <br>
  1702. * Defaults to <code>1.0</code>.
  1703. * @property {boolean} ignoreTextStreamFailures
  1704. * If <code>true</code>, the player will ignore text stream failures and
  1705. * continue playing other streams.
  1706. * <br>
  1707. * Defaults to <code>false</code>.
  1708. * @property {boolean} alwaysStreamText
  1709. * If <code>true</code>, always stream text tracks, regardless of whether or
  1710. * not they are shown. This is necessary when using the browser's built-in
  1711. * controls, which are not capable of signaling display state changes back to
  1712. * Shaka Player.
  1713. * Defaults to <code>false</code>.
  1714. * @property {boolean} startAtSegmentBoundary
  1715. * If <code>true</code>, adjust the start time backwards so it is at the start
  1716. * of a segment. This affects both explicit start times and calculated start
  1717. * time for live streams. This can put us further from the live edge.
  1718. * <br>
  1719. * Defaults to <code>false</code>.
  1720. * @property {number} gapDetectionThreshold
  1721. * The maximum distance (in seconds) before a gap when we'll automatically
  1722. * jump.
  1723. * <br>
  1724. * Defaults to <code>0.5</code>.
  1725. * @property {number} gapPadding
  1726. * Padding added only for Xbox, Legacy Edge and Tizen.
  1727. * Based on our research (specific to Tizen), the gapPadding value must be
  1728. * greater than your GOP length.
  1729. * It’s crucial to verify this value according to your actual stream.
  1730. * <br>
  1731. * Defaults to <code>0.01</code> for Xbox and Legacy Edge, Tizen at 2.
  1732. * @property {number} gapJumpTimerTime
  1733. * The polling time in seconds to check for gaps in the media.
  1734. * <br>
  1735. * Defaults to <code>0.25</code>.
  1736. * @property {number} durationBackoff
  1737. * By default, we will not allow seeking to exactly the duration of a
  1738. * presentation. This field is the number of seconds before duration we will
  1739. * seek to when the user tries to seek to or start playback at the duration.
  1740. * To disable this behavior, the config can be set to 0. We recommend using
  1741. * the default value unless you have a good reason not to.
  1742. * <br>
  1743. * Defaults to <code>1</code>.
  1744. * @property {number} safeSeekOffset
  1745. * The amount of seconds that should be added when repositioning the playhead
  1746. * after falling out of the availability window or seek. This gives the player
  1747. * more time to buffer before falling outside again, but increases the forward
  1748. * jump in the stream skipping more content. This is helpful for lower
  1749. * bandwidth scenarios.
  1750. * <br>
  1751. * Defaults to <code>5</code>.
  1752. * @property {number} safeSeekEndOffset
  1753. * The amount of seconds that should be added when repositioning the playhead
  1754. * after falling out of the seekable end range. This is helpful for live
  1755. * stream with a lot of GAP. This will reposition the playback in the past
  1756. * and avoid to be block at the edge and buffer at the next GAP
  1757. * <br>
  1758. * Defaults to <code>0</code>.
  1759. * @property {boolean} stallEnabled
  1760. * When set to <code>true</code>, the stall detector logic will run. If the
  1761. * playhead stops moving for <code>stallThreshold</code> seconds, the player
  1762. * will either seek or pause/play to resolve the stall, depending on the value
  1763. * of <code>stallSkip</code>.
  1764. * <br>
  1765. * Defaults to <code>true</code>.
  1766. * @property {number} stallThreshold
  1767. * The maximum number of seconds that may elapse without the playhead moving
  1768. * (when playback is expected) before it will be labeled as a stall.
  1769. * <br>
  1770. * Defaults to <code>1</code>.
  1771. * @property {number} stallSkip
  1772. * The number of seconds that the player will skip forward when a stall has
  1773. * been detected. If 0, the player will pause and immediately play instead of
  1774. * seeking. A value of 0 is recommended and provided as default on TV
  1775. * platforms (WebOS, Tizen, Chromecast, etc).
  1776. * <br>
  1777. * Defaults to <code>0.1</code> except on Tizen, WebOS, Chromecast,
  1778. * Hisense whose default value is <code>0</code>.
  1779. * @property {boolean} useNativeHlsForFairPlay
  1780. * Desktop Safari has both MediaSource and their native HLS implementation.
  1781. * Depending on the application's needs, it may prefer one over the other.
  1782. * Warning when disabled: Where single-key DRM streams work fine, multi-keys
  1783. * streams is showing unexpected behaviours (stall, audio playing with video
  1784. * freezes, ...). Use with care.
  1785. * <br>
  1786. * Defaults to <code>true</code>.
  1787. * @property {number} inaccurateManifestTolerance
  1788. * The maximum difference, in seconds, between the times in the manifest and
  1789. * the times in the segments. Larger values allow us to compensate for more
  1790. * drift (up to one segment duration). Smaller values reduce the incidence of
  1791. * extra segment requests necessary to compensate for drift.
  1792. * <br>
  1793. * Defaults to <code>2</code>.
  1794. * @property {boolean} lowLatencyMode
  1795. * If <code>true</code>, low latency streaming mode is enabled. If
  1796. * lowLatencyMode is set to true, it changes the default config values for
  1797. * other things, see: docs/tutorials/config.md
  1798. * <br>
  1799. * Defaults to <code>false</code>.
  1800. * @property {boolean} forceHTTP
  1801. * If true, if the protocol is HTTPs change it to HTTP.
  1802. * If both forceHTTP and forceHTTPS are set, forceHTTPS wins.
  1803. * <br>
  1804. * Defaults to <code>false</code>.
  1805. * @property {boolean} forceHTTPS
  1806. * If true, if the protocol is HTTP change it to HTTPs.
  1807. * If both forceHTTP and forceHTTPS are set, forceHTTPS wins.
  1808. * <br>
  1809. * Defaults to <code>false</code>.
  1810. * @property {number} minBytesForProgressEvents
  1811. * Defines minimum number of bytes that should be used to emit progress event,
  1812. * if possible. To avoid issues around feeding ABR with request history, this
  1813. * value should be greater than or equal to `abr.advanced.minBytes`.
  1814. * By default equals 16e3 (the same value as `abr.advanced.minBytes`).
  1815. * @property {boolean} preferNativeDash
  1816. * If true, prefer native DASH playback when possible, regardless of platform.
  1817. * <br>
  1818. * Defaults to <code>false</code>.
  1819. * @property {boolean} preferNativeHls
  1820. * If true, prefer native HLS playback when possible, regardless of platform.
  1821. * <br>
  1822. * Defaults to <code>false</code>.
  1823. * @property {number} updateIntervalSeconds
  1824. * The minimum number of seconds to see if the manifest has changes.
  1825. * <br>
  1826. * Defaults to <code>1</code>.
  1827. * @property {boolean} observeQualityChanges
  1828. * If true, monitor media quality changes and emit
  1829. * <code>shaka.Player.MediaQualityChangedEvent</code>.
  1830. * <br>
  1831. * Defaults to <code>false</code>.
  1832. * @property {number} maxDisabledTime
  1833. * The maximum time a variant can be disabled when NETWORK HTTP_ERROR
  1834. * is reached, in seconds.
  1835. * If all variants are disabled this way, NETWORK HTTP_ERROR will be thrown.
  1836. * <br>
  1837. * Defaults to <code>30</code>.
  1838. * @property {number} segmentPrefetchLimit
  1839. * The maximum number of segments for each active stream to be prefetched
  1840. * ahead of playhead in parallel.
  1841. * If <code>0</code>, the segments will be fetched sequentially.
  1842. * <br>
  1843. * Defaults to <code>1</code>.
  1844. * @property {!Array<string>} prefetchAudioLanguages
  1845. * The audio languages to prefetch.
  1846. * <br>
  1847. * Defaults to <code>[]</code>.
  1848. * @property {boolean} disableAudioPrefetch
  1849. * If set and prefetch limit is defined, it will prevent from prefetching data
  1850. * for audio.
  1851. * <br>
  1852. * Defaults to <code>false</code>.
  1853. * @property {boolean} disableTextPrefetch
  1854. * If set and prefetch limit is defined, it will prevent from prefetching data
  1855. * for text.
  1856. * <br>
  1857. * Defaults to <code>false</code>.
  1858. * @property {boolean} disableVideoPrefetch
  1859. * If set and prefetch limit is defined, it will prevent from prefetching data
  1860. * for video.
  1861. * <br>
  1862. * Defaults to <code>false</code>.
  1863. * @property {shaka.extern.LiveSyncConfiguration} liveSync
  1864. * The live sync configuration for keeping near the live edge.
  1865. * @property {boolean} allowMediaSourceRecoveries
  1866. * Indicate if we should recover from VIDEO_ERROR resetting Media Source.
  1867. * <br>
  1868. * Defaults to <code>true</code>.
  1869. * @property {number} minTimeBetweenRecoveries
  1870. * The minimum time between recoveries when VIDEO_ERROR is reached, in
  1871. * seconds.
  1872. * <br>
  1873. * Defaults to <code>5</code>.
  1874. * @property {boolean} vodDynamicPlaybackRate
  1875. * Adapt the playback rate of the player to keep the buffer full.
  1876. * <br>
  1877. * Defaults to <code>false</code>.
  1878. * @property {number} vodDynamicPlaybackRateLowBufferRate
  1879. * Playback rate to use if the buffer is too small.
  1880. * <br>
  1881. * Defaults to <code>0.95</code>.
  1882. * @property {number} vodDynamicPlaybackRateBufferRatio
  1883. * Ratio of the <code>bufferingGoal</code> as the low threshold for
  1884. * setting the playback rate to
  1885. * <code>vodDynamicPlaybackRateLowBufferRate</code>.
  1886. * <br>
  1887. * Defaults to <code>0.5</code>.
  1888. * @property {number} preloadNextUrlWindow
  1889. * The window of time at the end of the presentation to begin preloading the
  1890. * next URL, such as one specified by a urn:mpeg:dash:chaining:2016 element
  1891. * in DASH. Measured in seconds. If the value is 0, the next URL will not
  1892. * be preloaded at all.
  1893. * <br>
  1894. * Defaults to <code>30</code>.
  1895. * @property {number} loadTimeout
  1896. * The maximum timeout to reject the load when using src= in case the content
  1897. * does not work correctly. Measured in seconds.
  1898. * <br>
  1899. * Defaults to <code>30</code>.
  1900. * @property {boolean} clearDecodingCache
  1901. * Clears decodingInfo and MediaKeySystemAccess cache during player unload
  1902. * as these objects may become corrupt and cause issues during subsequent
  1903. * playbacks on some platforms.
  1904. * <br>
  1905. * Defaults to <code>true</code> on PlayStation devices and to
  1906. * <code>false</code> on other devices.
  1907. * @property {boolean} dontChooseCodecs
  1908. * If true, we don't choose codecs in the player, and keep all the variants.
  1909. * <br>
  1910. * Defaults to <code>false</code>.
  1911. * @property {boolean} shouldFixTimestampOffset
  1912. * If true, we will try to fix problems when the timestampOffset is less than
  1913. * the baseMediaDecodeTime. This only works when the manifest is DASH with
  1914. * MP4 segments.
  1915. * <br>
  1916. * Defaults to <code>false</code> except on Tizen, WebOS whose default value
  1917. * is <code>true</code>.
  1918. * @property {boolean} avoidEvictionOnQuotaExceededError
  1919. * Avoid evict content on QuotaExceededError.
  1920. * <br>
  1921. * Defaults to <code>false</code>.
  1922. * @property {shaka.config.CrossBoundaryStrategy} crossBoundaryStrategy
  1923. * Allows MSE to be reset when crossing a boundary. Optionally, we can stop
  1924. * resetting MSE when MSE passed an encrypted boundary.
  1925. * Defaults to <code>KEEP</code> except on Tizen 3 where the default value
  1926. * is <code>RESET_TO_ENCRYPTED</code> and WebOS 3 where the default value
  1927. * is <code>RESET</code>.
  1928. * @exportDoc
  1929. */
  1930. shaka.extern.StreamingConfiguration;
  1931. /**
  1932. * @typedef {{
  1933. * codecSwitchingStrategy: shaka.config.CodecSwitchingStrategy,
  1934. * addExtraFeaturesToSourceBuffer: function(string): string,
  1935. * forceTransmux: boolean,
  1936. * insertFakeEncryptionInInit: boolean,
  1937. * modifyCueCallback: shaka.extern.TextParser.ModifyCueCallback,
  1938. * dispatchAllEmsgBoxes: boolean
  1939. * }}
  1940. *
  1941. * @description
  1942. * Media source configuration.
  1943. *
  1944. * @property {shaka.config.CodecSwitchingStrategy} codecSwitchingStrategy
  1945. * Allow codec switching strategy. SMOOTH loading uses
  1946. * SourceBuffer.changeType. RELOAD uses cycling of MediaSource.
  1947. * <br>
  1948. * Defaults to SMOOTH if SMOOTH codec switching is supported, RELOAD
  1949. * overwise.
  1950. * @property {function(string): string} addExtraFeaturesToSourceBuffer
  1951. * Callback to generate extra features string based on used MIME type.
  1952. * Some platforms may need to pass features when initializing the
  1953. * sourceBuffer.
  1954. * This string is ultimately appended to a MIME type in addSourceBuffer() &
  1955. * changeType().
  1956. * @property {boolean} forceTransmux
  1957. * If this is <code>true</code>, we will transmux AAC and TS content even if
  1958. * not strictly necessary for the assets to be played.
  1959. * <br>
  1960. * Defaults to <code>false</code>.
  1961. * @property {boolean} insertFakeEncryptionInInit
  1962. * If true, will apply a work-around for non-encrypted init segments on
  1963. * encrypted content for some platforms.
  1964. * <br><br>
  1965. * See https://github.com/shaka-project/shaka-player/issues/2759.
  1966. * <br><br>
  1967. * If you know you don't need this, you can set this value to
  1968. * <code>false</code> to gain a few milliseconds on loading time and seek
  1969. * time.
  1970. * <br><br>
  1971. * <br>
  1972. * Defaults to <code>true</code>.
  1973. * @property {shaka.extern.TextParser.ModifyCueCallback} modifyCueCallback
  1974. * A callback called for each cue after it is parsed, but right before it
  1975. * is appended to the presentation.
  1976. * Gives a chance for client-side editing of cue text, cue timing, etc.
  1977. * @property {boolean} dispatchAllEmsgBoxes
  1978. * If true, all emsg boxes are parsed and dispatched.
  1979. * <br>
  1980. * Defaults to <code>false</code>.
  1981. * @exportDoc
  1982. */
  1983. shaka.extern.MediaSourceConfiguration;
  1984. /**
  1985. * @typedef {{
  1986. * customPlayheadTracker: boolean,
  1987. * skipPlayDetection: boolean,
  1988. * supportsMultipleMediaElements: boolean,
  1989. * disableHLSInterstitial: boolean,
  1990. * disableDASHInterstitial: boolean,
  1991. * allowPreloadOnDomElements: boolean
  1992. * }}
  1993. *
  1994. * @description
  1995. * Ads configuration.
  1996. *
  1997. * @property {boolean} customPlayheadTracker
  1998. * If this is <code>true</code>, we create a custom playhead tracker for
  1999. * Client Side. This is useful because it allows you to implement the use of
  2000. * IMA on platforms that do not support multiple video elements.
  2001. * <br>
  2002. * Defaults to <code>false</code> except on Tizen, WebOS, Chromecast,
  2003. * Hisense, PlayStation 4, PlayStation5, Xbox, Vizio whose default value is
  2004. * <code>true</code>.
  2005. * @property {boolean} skipPlayDetection
  2006. * If this is true, we will load Client Side ads without waiting for a play
  2007. * event.
  2008. * <br>
  2009. * Defaults to <code>false</code> except on Tizen, WebOS, Chromecast,
  2010. * Hisense, PlayStation 4, PlayStation5, Xbox, Vizio whose default value is
  2011. * <code>true</code>.
  2012. * @property {boolean} supportsMultipleMediaElements
  2013. * If this is true, the browser supports multiple media elements.
  2014. * <br>
  2015. * Defaults to <code>true</code> except on Tizen, WebOS, Chromecast,
  2016. * Hisense, PlayStation 4, PlayStation5, Xbox, Vizio whose default value is
  2017. * <code>false</code>.
  2018. * @property {boolean} disableHLSInterstitial
  2019. * If this is true, we ignore HLS interstitial events.
  2020. * <br>
  2021. * Defaults to <code>false</code>.
  2022. * @property {boolean} disableDASHInterstitial
  2023. * If this is true, we ignore DASH interstitial events.
  2024. * <br>
  2025. * Defaults to <code>false</code>.
  2026. * @property {boolean} allowPreloadOnDomElements
  2027. * If this is true, we will use HTMLLinkElement to preload some resources.
  2028. * <br>
  2029. * Defaults to <code>true</code>.
  2030. *
  2031. * @exportDoc
  2032. */
  2033. shaka.extern.AdsConfiguration;
  2034. /**
  2035. * @typedef {{
  2036. * enabled: boolean,
  2037. * useNetworkInformation: boolean,
  2038. * defaultBandwidthEstimate: number,
  2039. * restrictions: shaka.extern.Restrictions,
  2040. * switchInterval: number,
  2041. * bandwidthUpgradeTarget: number,
  2042. * bandwidthDowngradeTarget: number,
  2043. * advanced: shaka.extern.AdvancedAbrConfiguration,
  2044. * restrictToElementSize: boolean,
  2045. * restrictToScreenSize: boolean,
  2046. * ignoreDevicePixelRatio: boolean,
  2047. * clearBufferSwitch: boolean,
  2048. * safeMarginSwitch: number,
  2049. * cacheLoadThreshold: number,
  2050. * minTimeToSwitch: number,
  2051. * preferNetworkInformationBandwidth: boolean
  2052. * }}
  2053. *
  2054. * @property {boolean} enabled
  2055. * If true, enable adaptation by the current AbrManager.
  2056. * <br>
  2057. * Defaults to <code>true</code>.
  2058. * @property {boolean} useNetworkInformation
  2059. * If true, use the Network Information API in the current AbrManager, if it
  2060. * is available in the browser environment. If the Network Information API is
  2061. * used, Shaka Player will ignore the defaultBandwidthEstimate config.
  2062. * <br>
  2063. * Defaults to <code>true</code>.
  2064. * @property {number} defaultBandwidthEstimate
  2065. * The default bandwidth estimate to use if there is not enough data, in
  2066. * bit/sec. Only used if useNetworkInformation is false, or if the Network
  2067. * Information API is not available.
  2068. * <br>
  2069. * Defaults to <code>1e6</code>.
  2070. * @property {shaka.extern.Restrictions} restrictions
  2071. * The restrictions to apply to ABR decisions. These are "soft" restrictions.
  2072. * Any track that fails to meet these restrictions will not be selected
  2073. * automatically, but will still appear in the track list and can still be
  2074. * selected via <code>selectVariantTrack()</code>. If no tracks meet these
  2075. * restrictions, AbrManager should not fail, but choose a low-res or
  2076. * low-bandwidth variant instead. It is the responsibility of AbrManager
  2077. * implementations to follow these rules and implement this behavior.
  2078. * @property {number} switchInterval
  2079. * The minimum amount of time that must pass between switches, in
  2080. * seconds. This keeps us from changing too often and annoying the user.
  2081. * <br>
  2082. * Defaults to <code>8</code>.
  2083. * @property {number} bandwidthUpgradeTarget
  2084. * The fraction of the estimated bandwidth which we should try to use when
  2085. * upgrading.
  2086. * <br>
  2087. * Defaults to <code>0.85</code>.
  2088. * @property {number} bandwidthDowngradeTarget
  2089. * The largest fraction of the estimated bandwidth we should use. We should
  2090. * downgrade to avoid this.
  2091. * <br>
  2092. * Defaults to <code>0.95</code>.
  2093. * @property {shaka.extern.AdvancedAbrConfiguration} advanced
  2094. * Advanced ABR configuration
  2095. * @property {boolean} restrictToElementSize
  2096. * If true, restrict the quality to media element size.
  2097. * Note: The use of ResizeObserver is required for it to work properly. If
  2098. * true without ResizeObserver, it behaves as false.
  2099. * <br>
  2100. * Defaults to <code>false</code>.
  2101. * @property {boolean} restrictToScreenSize
  2102. * If true, restrict the quality to screen size.
  2103. * <br>
  2104. * Defaults to <code>false</code>.
  2105. * @property {boolean} ignoreDevicePixelRatio
  2106. * If true,device pixel ratio is ignored when restricting the quality to
  2107. * media element size or screen size.
  2108. * <br>
  2109. * Defaults to <code>false</code>.
  2110. * @property {boolean} clearBufferSwitch
  2111. * If true, the buffer will be cleared during the switch.
  2112. * The default automatic behavior is false to have a smoother transition.
  2113. * On some device it's better to clear buffer.
  2114. * <br>
  2115. * Defaults to <code>false</code>.
  2116. * @property {number} safeMarginSwitch
  2117. * Optional amount of buffer (in seconds) to
  2118. * retain when clearing the buffer during the automatic switch.
  2119. * Useful for switching variant quickly without causing a buffering event.
  2120. * Ignored if clearBuffer is false.
  2121. * Can cause hiccups on some browsers if chosen too small, e.g.
  2122. * The amount of two segments is a fair minimum to consider as safeMargin
  2123. * value.
  2124. * <br>
  2125. * Defaults to <code>o</code>.
  2126. * @property {number} cacheLoadThreshold
  2127. * Indicates the value in milliseconds from which a request is not
  2128. * considered cached.
  2129. * <br>
  2130. * Defaults to <code>20</code>.
  2131. * @property {number} minTimeToSwitch
  2132. * Indicates the minimum time to change quality once the real bandwidth is
  2133. * available, in seconds. This time is only used on the first load.
  2134. * <br>
  2135. * Defaults to <code>0</code> seconds except in Apple browsers whose default
  2136. * value is <code>0.5</code> seconds.
  2137. * @property {boolean} preferNetworkInformationBandwidth
  2138. * If true, use the Network Information API bandwidth estimation in the
  2139. * current AbrManager, if it is available in the browser environment. This
  2140. * way Shaka Player will never estimate the bandwidth and we will always
  2141. * trust the information provided by the browser.
  2142. * <br>
  2143. * Defaults to <code>false</code>.
  2144. * @exportDoc
  2145. */
  2146. shaka.extern.AbrConfiguration;
  2147. /**
  2148. * @typedef {{
  2149. * minTotalBytes: number,
  2150. * minBytes: number,
  2151. * fastHalfLife: number,
  2152. * slowHalfLife: number
  2153. * }}
  2154. *
  2155. * @property {number} minTotalBytes
  2156. * Minimum number of bytes sampled before we trust the estimate. If we have
  2157. * not sampled much data, our estimate may not be accurate enough to trust.
  2158. * <br>
  2159. * Defaults to <code>128e3</code>.
  2160. * @property {number} minBytes
  2161. * Minimum number of bytes, under which samples are discarded. Our models
  2162. * do not include latency information, so connection startup time (time to
  2163. * first byte) is considered part of the download time. Because of this, we
  2164. * should ignore very small downloads which would cause our estimate to be
  2165. * too low.
  2166. * <br>
  2167. * Defaults to <code>16e3</code>.
  2168. * @property {number} fastHalfLife
  2169. * The quantity of prior samples (by weight) used when creating a new
  2170. * estimate, in seconds. Those prior samples make up half of the
  2171. * new estimate.
  2172. * <br>
  2173. * Defaults to <code>2</code>.
  2174. * @property {number} slowHalfLife
  2175. * The quantity of prior samples (by weight) used when creating a new
  2176. * estimate, in seconds. Those prior samples make up half of the
  2177. * new estimate.
  2178. * <br>
  2179. * Defaults to <code>5</code>.
  2180. * @exportDoc
  2181. */
  2182. shaka.extern.AdvancedAbrConfiguration;
  2183. /**
  2184. * @typedef {{
  2185. * enabled: boolean,
  2186. * useHeaders: boolean,
  2187. * sessionId: string,
  2188. * contentId: string,
  2189. * rtpSafetyFactor: number,
  2190. * includeKeys: !Array<string>,
  2191. * version: number
  2192. * }}
  2193. *
  2194. * @description
  2195. * Common Media Client Data (CMCD) configuration.
  2196. *
  2197. * @property {boolean} enabled
  2198. * If <code>true</code>, enable CMCD data to be sent with media requests.
  2199. * <br>
  2200. * Defaults to <code>false</code>.
  2201. * @property {boolean} useHeaders
  2202. * If <code>true</code>, send CMCD data using the header transmission mode
  2203. * instead of query args.
  2204. * <br>
  2205. * Defaults to <code>false</code>.
  2206. * @property {string} sessionId
  2207. * A GUID identifying the current playback session. A playback session
  2208. * typically ties together segments belonging to a single media asset.
  2209. * Maximum length is 64 characters. It is RECOMMENDED to conform to the UUID
  2210. * specification.
  2211. * <br>
  2212. * By default the sessionId is automatically generated on each
  2213. * <code>load()</code> call.
  2214. * @property {string} contentId
  2215. * A unique string identifying the current content. Maximum length is 64
  2216. * characters. This value is consistent across multiple different sessions and
  2217. * devices and is defined and updated at the discretion of the service
  2218. * provider.
  2219. * <br>
  2220. * Defaults to <code>'false'</code>.
  2221. * @property {number} rtpSafetyFactor
  2222. * RTP safety factor.
  2223. * <br>
  2224. * Defaults to <code>5</code>.
  2225. * @property {!Array<string>} includeKeys
  2226. * An array of keys to include in the CMCD data. If not provided, all keys
  2227. * will be included.
  2228. * <br>
  2229. * Defaults to <code>[]</code>.
  2230. * @property {number} version
  2231. * The CMCD version.
  2232. * Valid values are <code>1</code> or <code>2</code>, corresponding to CMCD v1
  2233. * and CMCD v2 specifications, respectively.
  2234. * <br>
  2235. * Defaults to <code>1</code>.
  2236. * @exportDoc
  2237. */
  2238. shaka.extern.CmcdConfiguration;
  2239. /**
  2240. * @typedef {{
  2241. * enabled: boolean,
  2242. * applyMaximumSuggestedBitrate: boolean,
  2243. * estimatedThroughputWeightRatio: number
  2244. * }}
  2245. *
  2246. * @description
  2247. * Common Media Server Data (CMSD) configuration.
  2248. *
  2249. * @property {boolean} enabled
  2250. * If <code>true</code>, enables reading CMSD data in media requests.
  2251. * <br>
  2252. * Defaults to <code>true</code>.
  2253. * @property {boolean} applyMaximumSuggestedBitrate
  2254. * If true, we must apply the maximum suggested bitrate. If false, we ignore
  2255. * this.
  2256. * <br>
  2257. * Defaults to <code>true</code>.
  2258. * @property {number} estimatedThroughputWeightRatio
  2259. * How much the estimatedThroughput of the CMSD data should be weighted
  2260. * against the default estimate, between 0 and 1.
  2261. * <br>
  2262. * Defaults to <code>0.5</code>.
  2263. * @exportDoc
  2264. */
  2265. shaka.extern.CmsdConfiguration;
  2266. /**
  2267. * @typedef {{
  2268. * enabled: boolean,
  2269. * dynamicPerformanceScaling: boolean,
  2270. * logLevel: number,
  2271. * drawLogo: boolean
  2272. * }}
  2273. *
  2274. * @description
  2275. * Decoding for MPEG-5 Part2 LCEVC.
  2276. *
  2277. * @property {boolean} enabled
  2278. * If <code>true</code>, enable LCEVC.
  2279. * Defaults to <code>false</code>.
  2280. * @property {boolean} dynamicPerformanceScaling
  2281. * If <code>true</code>, LCEVC Dynamic Performance Scaling or dps is enabled
  2282. * to be triggered, when the system is not able to decode frames within a
  2283. * specific tolerance of the fps of the video and disables LCEVC decoding
  2284. * for some time. The base video will be shown upscaled to target resolution.
  2285. * If it is triggered again within a short period of time, the disabled
  2286. * time will be higher and if it is triggered three times in a row the LCEVC
  2287. * decoding will be disabled for that playback session.
  2288. * If dynamicPerformanceScaling is false, LCEVC decode will be forced
  2289. * and will drop frames appropriately if performance is sub optimal.
  2290. * <br>
  2291. * Defaults to <code>true</code>.
  2292. * @property {number} logLevel
  2293. * Loglevel 0-5 for logging.
  2294. * NONE = 0
  2295. * ERROR = 1
  2296. * WARNING = 2
  2297. * INFO = 3
  2298. * DEBUG = 4
  2299. * VERBOSE = 5
  2300. * <br>
  2301. * Defaults to <code>0</code>.
  2302. * @property {boolean} drawLogo
  2303. * If <code>true</code>, LCEVC Logo is placed on the top left hand corner
  2304. * which only appears when the LCEVC enhanced frames are being rendered.
  2305. * Defaults to true for the lib but is forced to false in this integration
  2306. * unless explicitly set to true through config.
  2307. * <br>
  2308. * Defaults to <code>false</code>.
  2309. * @exportDoc
  2310. */
  2311. shaka.extern.LcevcConfiguration;
  2312. /**
  2313. * @typedef {{
  2314. * trackSelectionCallback:
  2315. * function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>,
  2316. * downloadSizeCallback: function(number):!Promise<boolean>,
  2317. * progressCallback: function(shaka.extern.StoredContent,number),
  2318. * usePersistentLicense: boolean,
  2319. * numberOfParallelDownloads: number
  2320. * }}
  2321. *
  2322. * @property {function(shaka.extern.TrackList):
  2323. * !Promise<shaka.extern.TrackList>} trackSelectionCallback
  2324. * Called inside <code>store()</code> to determine which tracks to save from a
  2325. * manifest. It is passed an array of Tracks from the manifest and it should
  2326. * return an array of the tracks to store.
  2327. * @property {function(number):!Promise<boolean>} downloadSizeCallback
  2328. * Called inside <code>store()</code> to determine if the content can be
  2329. * downloaded due to its estimated size. The estimated size of the download is
  2330. * passed and it must return if the download is allowed or not.
  2331. * @property {function(shaka.extern.StoredContent,number)} progressCallback
  2332. * Called inside <code>store()</code> to give progress info back to the app.
  2333. * It is given the current manifest being stored and the progress of it being
  2334. * stored.
  2335. * @property {boolean} usePersistentLicense
  2336. * If <code>true</code>, store protected content with a persistent license so
  2337. * that no network is required to view.
  2338. * If <code>false</code>, store protected content without a persistent
  2339. * license. A network will be required to retrieve a temporary license to
  2340. * view.
  2341. * <br>
  2342. * Defaults to <code>true</code>.
  2343. * @property {number} numberOfParallelDownloads
  2344. * Number of parallel downloads. If the value is 0, downloads will be
  2345. * sequential for each stream.
  2346. * Note: normally browsers limit to 5 request in parallel, so putting a
  2347. * number higher than this will not help it download faster.
  2348. * <br>
  2349. * Defaults to <code>5</code>.
  2350. * @exportDoc
  2351. */
  2352. shaka.extern.OfflineConfiguration;
  2353. /**
  2354. * @typedef {{
  2355. * captionsUpdatePeriod: number,
  2356. * fontScaleFactor: number
  2357. * }}
  2358. *
  2359. * @description
  2360. * Text displayer configuration.
  2361. *
  2362. * @property {number} captionsUpdatePeriod
  2363. * The number of seconds to see if the captions should be updated.
  2364. * <br>
  2365. * Defaults to <code>0.25</code>.
  2366. * @property {number} fontScaleFactor
  2367. * The font scale factor used to increase or decrease the font size.
  2368. * <br>
  2369. * Defaults to <code>1</code>.
  2370. * @exportDoc
  2371. */
  2372. shaka.extern.TextDisplayerConfiguration;
  2373. /**
  2374. * @typedef {{
  2375. * ads: shaka.extern.AdsConfiguration,
  2376. * autoShowText: shaka.config.AutoShowText,
  2377. * drm: shaka.extern.DrmConfiguration,
  2378. * manifest: shaka.extern.ManifestConfiguration,
  2379. * streaming: shaka.extern.StreamingConfiguration,
  2380. * mediaSource: shaka.extern.MediaSourceConfiguration,
  2381. * abrFactory: shaka.extern.AbrManager.Factory,
  2382. * adaptationSetCriteriaFactory: shaka.media.AdaptationSetCriteria.Factory,
  2383. * abr: shaka.extern.AbrConfiguration,
  2384. * cmcd: shaka.extern.CmcdConfiguration,
  2385. * cmsd: shaka.extern.CmsdConfiguration,
  2386. * lcevc: shaka.extern.LcevcConfiguration,
  2387. * offline: shaka.extern.OfflineConfiguration,
  2388. * ignoreHardwareResolution: boolean,
  2389. * preferredAudioLanguage: string,
  2390. * preferredAudioLabel: string,
  2391. * preferredTextLanguage: string,
  2392. * preferredVariantRole: string,
  2393. * preferredTextRole: string,
  2394. * preferredVideoCodecs: !Array<string>,
  2395. * preferredAudioCodecs: !Array<string>,
  2396. * preferredTextFormats: !Array<string>,
  2397. * preferredAudioChannelCount: number,
  2398. * preferredVideoHdrLevel: string,
  2399. * preferredVideoLayout: string,
  2400. * preferredVideoLabel: string,
  2401. * preferredDecodingAttributes: !Array<string>,
  2402. * preferForcedSubs: boolean,
  2403. * preferSpatialAudio: boolean,
  2404. * restrictions: shaka.extern.Restrictions,
  2405. * playRangeStart: number,
  2406. * playRangeEnd: number,
  2407. * textDisplayer: shaka.extern.TextDisplayerConfiguration,
  2408. * textDisplayFactory: shaka.extern.TextDisplayer.Factory
  2409. * }}
  2410. *
  2411. * @property {shaka.extern.AdsConfiguration} ads
  2412. * Ads configuration and settings.
  2413. * @property {shaka.config.AutoShowText} autoShowText
  2414. * Controls behavior of auto-showing text tracks on load().
  2415. * <br>
  2416. * Defaults to
  2417. * {@link shaka.config.AutoShowText#IF_SUBTITLES_MAY_BE_NEEDED}.
  2418. * @property {shaka.extern.DrmConfiguration} drm
  2419. * DRM configuration and settings.
  2420. * @property {shaka.extern.ManifestConfiguration} manifest
  2421. * Manifest configuration and settings.
  2422. * @property {shaka.extern.StreamingConfiguration} streaming
  2423. * Streaming configuration and settings.
  2424. * @property {shaka.extern.MediaSourceConfiguration} mediaSource
  2425. * Media source configuration and settings.
  2426. * @property {shaka.extern.AbrManager.Factory} abrFactory
  2427. * A factory to construct an abr manager.
  2428. * @property {shaka.media.AdaptationSetCriteria.Factory
  2429. * } adaptationSetCriteriaFactory
  2430. * A factory to construct an adaptation set criteria.
  2431. * @property {shaka.extern.AbrConfiguration} abr
  2432. * ABR configuration and settings.
  2433. * @property {shaka.extern.CmcdConfiguration} cmcd
  2434. * CMCD configuration and settings. (Common Media Client Data)
  2435. * @property {shaka.extern.CmsdConfiguration} cmsd
  2436. * CMSD configuration and settings. (Common Media Server Data)
  2437. * @property {shaka.extern.LcevcConfiguration} lcevc
  2438. * MPEG-5 LCEVC configuration and settings.
  2439. * (Low Complexity Enhancement Video Codec)
  2440. * @property {shaka.extern.OfflineConfiguration} offline
  2441. * Offline configuration and settings.
  2442. * @property {boolean} ignoreHardwareResolution
  2443. * Do not detect the hardware resolution. For some niche cases where content
  2444. * is only available at resolutions beyond the device's native resolution,
  2445. * and you are confident it can be decoded and downscaled, this flag can
  2446. * allow playback when it would otherwise fail.
  2447. * @property {string} preferredAudioLanguage
  2448. * The preferred language to use for audio tracks. If not given it will use
  2449. * the <code>'main'</code> track.
  2450. * Changing this during playback will not affect the current playback.
  2451. * <br>
  2452. * Defaults to <code>''</code>.
  2453. * @property {string} preferredAudioLabel
  2454. * The preferred label to use for audio tracks.
  2455. * <br>
  2456. * Defaults to <code>''</code>.
  2457. * @property {string} preferredVideoLabel
  2458. * The preferred label to use for video tracks.
  2459. * <br>
  2460. * Defaults to <code>''</code>.
  2461. * @property {string} preferredTextLanguage
  2462. * The preferred language to use for text tracks. If a matching text track
  2463. * is found, and the selected audio and text tracks have different languages,
  2464. * the text track will be shown.
  2465. * Changing this during playback will not affect the current playback.
  2466. * <br>
  2467. * Defaults to <code>''</code>.
  2468. * @property {string} preferredVariantRole
  2469. * The preferred role to use for variants.
  2470. * <br>
  2471. * Defaults to <code>''</code>.
  2472. * @property {string} preferredTextRole
  2473. * The preferred role to use for text tracks.
  2474. * <br>
  2475. * Defaults to <code>''</code>.
  2476. * @property {!Array<string>} preferredVideoCodecs
  2477. * The list of preferred video codecs, in order of highest to lowest priority.
  2478. * This is used to do a filtering of the variants available for the player.
  2479. * <br>
  2480. * Defaults to <code>[]</code>.
  2481. * @property {!Array<string>} preferredAudioCodecs
  2482. * The list of preferred audio codecs, in order of highest to lowest priority.
  2483. * This is used to do a filtering of the variants available for the player.
  2484. * <br>
  2485. * Defaults to <code>[]</code>.
  2486. * @property {!Array<string>} preferredTextFormats
  2487. * The list of preferred text formats, in order of highest to lowest priority.
  2488. * This is used to do a filtering of the text tracks available for the player.
  2489. * <br>
  2490. * Defaults to <code>[]</code>.
  2491. * @property {number} preferredAudioChannelCount
  2492. * The preferred number of audio channels.
  2493. * <br>
  2494. * Defaults to <code>2</code>.
  2495. * @property {string} preferredVideoHdrLevel
  2496. * The preferred HDR level of the video. If possible, this will cause the
  2497. * player to filter to assets that either have that HDR level, or no HDR level
  2498. * at all.
  2499. * Can be 'SDR', 'PQ', 'HLG', 'AUTO' for auto-detect, or '' for no preference.
  2500. * Note that one some platforms, such as Chrome, attempting to play PQ content
  2501. * may cause problems.
  2502. * <br>
  2503. * Defaults to <code>'AUTO'</code>.
  2504. * @property {string} preferredVideoLayout
  2505. * The preferred video layout of the video.
  2506. * Can be 'CH-STEREO', 'CH-MONO', or '' for no preference.
  2507. * If the content is predominantly stereoscopic you should use 'CH-STEREO'.
  2508. * If the content is predominantly monoscopic you should use 'CH-MONO'.
  2509. * <br>
  2510. * Defaults to <code>''</code>.
  2511. * @property {!Array<string>} preferredDecodingAttributes
  2512. * The list of preferred attributes of decodingInfo, in the order of their
  2513. * priorities.
  2514. * This is used to do a filtering of the variants available for the player.
  2515. * <br>
  2516. * Defaults to <code>[]</code>.
  2517. * @property {boolean} preferForcedSubs
  2518. * If true, a forced text track is preferred.
  2519. * If the content has no forced captions and the value is true,
  2520. * no text track is chosen.
  2521. * Changing this during playback will not affect the current playback.
  2522. * <br>
  2523. * Defaults to <code>false</code>.
  2524. * @property {boolean} preferSpatialAudio
  2525. * If true, a spatial audio track is preferred.
  2526. * <br>
  2527. * Defaults to <code>false</code>.
  2528. * @property {shaka.extern.Restrictions} restrictions
  2529. * The application restrictions to apply to the tracks. These are "hard"
  2530. * restrictions. Any track that fails to meet these restrictions will not
  2531. * appear in the track list. If no tracks meet these restrictions, playback
  2532. * will fail.
  2533. * @property {number} playRangeStart
  2534. * Optional playback and seek start time in seconds. Defaults to 0 if
  2535. * not provided.
  2536. * <br>
  2537. * Defaults to <code>0</code>.
  2538. * @property {number} playRangeEnd
  2539. * Optional playback and seek end time in seconds. Defaults to the end of
  2540. * the presentation if not provided.
  2541. * <br>
  2542. * Defaults to <code>Infinity</code>.
  2543. * @property {shaka.extern.TextDisplayerConfiguration} textDisplayer
  2544. * Text displayer configuration and settings.
  2545. * @property {shaka.extern.TextDisplayer.Factory} textDisplayFactory
  2546. * A factory to construct a text displayer. Note that, if this is changed
  2547. * during playback, it will cause the text tracks to be reloaded.
  2548. * @exportDoc
  2549. */
  2550. shaka.extern.PlayerConfiguration;
  2551. /**
  2552. * @typedef {{
  2553. * language: string,
  2554. * role: string,
  2555. * label: ?string
  2556. * }}
  2557. *
  2558. * @property {string} language
  2559. * The language code for the stream.
  2560. * @property {string} role
  2561. * The role name for the stream. If the stream has no role, <code>role</code>
  2562. * will be <code>''</code>.
  2563. * @property {?string} label
  2564. * The label of the audio stream, if it has one.
  2565. * @exportDoc
  2566. */
  2567. shaka.extern.LanguageRole;
  2568. /**
  2569. * @typedef {{
  2570. * segment: shaka.media.SegmentReference,
  2571. * imageHeight: number,
  2572. * imageWidth: number,
  2573. * height: number,
  2574. * positionX: number,
  2575. * positionY: number,
  2576. * startTime: number,
  2577. * duration: number,
  2578. * uris: !Array<string>,
  2579. * width: number,
  2580. * sprite: boolean,
  2581. * mimeType: ?string,
  2582. * codecs: ?string
  2583. * }}
  2584. *
  2585. * @property {shaka.media.SegmentReference} segment
  2586. * The segment of this thumbnail.
  2587. * @property {number} imageHeight
  2588. * The image height in px. The image height could be different to height if
  2589. * the layout is different to 1x1.
  2590. * @property {number} imageWidth
  2591. * The image width in px. The image width could be different to width if
  2592. * the layout is different to 1x1.
  2593. * @property {number} height
  2594. * The thumbnail height in px.
  2595. * @property {number} positionX
  2596. * The thumbnail left position in px.
  2597. * @property {number} positionY
  2598. * The thumbnail top position in px.
  2599. * @property {number} startTime
  2600. * The start time of the thumbnail in the presentation timeline, in seconds.
  2601. * @property {number} duration
  2602. * The duration of the thumbnail, in seconds.
  2603. * @property {!Array<string>} uris
  2604. * An array of URIs to attempt. They will be tried in the order they are
  2605. * given.
  2606. * @property {number} width
  2607. * The thumbnail width in px.
  2608. * @property {boolean} sprite
  2609. * Indicate if the thumbnail is a sprite.
  2610. * @property {?string} mimeType
  2611. * The thumbnail MIME type, if present.
  2612. * @property {?string} codecs
  2613. * The thumbnail codecs, if present.
  2614. * @exportDoc
  2615. */
  2616. shaka.extern.Thumbnail;
  2617. /**
  2618. * @typedef {{
  2619. * id: string,
  2620. * title: string,
  2621. * startTime: number,
  2622. * endTime: number
  2623. * }}
  2624. *
  2625. * @property {string} id
  2626. * The id of the chapter.
  2627. * @property {string} title
  2628. * The title of the chapter.
  2629. * @property {number} startTime
  2630. * The time that describes the beginning of the range of the chapter.
  2631. * @property {number} endTime
  2632. * The time that describes the end of the range of chapter.
  2633. * @exportDoc
  2634. */
  2635. shaka.extern.Chapter;
  2636. /**
  2637. * @typedef {{
  2638. * uri: string,
  2639. * language: string,
  2640. * kind: string,
  2641. * mime: string,
  2642. * codecs: (string|undefined)
  2643. * }}
  2644. *
  2645. * @property {string} uri
  2646. * The URI of the text.
  2647. * @property {string} language
  2648. * The language of the text (e.g. 'en').
  2649. * @property {string} kind
  2650. * The kind of text (e.g. 'subtitles').
  2651. * @property {?string} mime
  2652. * The MIME type of the text (e.g. 'text/vtt')
  2653. * @property {?string} codecs
  2654. * The codecs string, if needed to refine the MIME type.
  2655. * @exportDoc
  2656. */
  2657. shaka.extern.ExtraText;