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. * channelsCount: ?number,
  260. * audioSamplingRate: ?number,
  261. * tilesLayout: ?string,
  262. * audioBandwidth: ?number,
  263. * videoBandwidth: ?number,
  264. * spatialAudio: boolean,
  265. * originalVideoId: ?string,
  266. * originalAudioId: ?string,
  267. * originalTextId: ?string,
  268. * originalImageId: ?string,
  269. * originalLanguage: ?string
  270. * }}
  271. *
  272. * @description
  273. * An object describing a media track. This object should be treated as
  274. * read-only as changing any values does not have any effect. This is the
  275. * public view of an audio/video paring (variant type) or text track (text
  276. * type) or image track (image type).
  277. *
  278. * @property {number} id
  279. * The unique ID of the track.
  280. * @property {boolean} active
  281. * If true, this is the track being streamed (another track may be
  282. * visible/audible in the buffer).
  283. *
  284. * @property {string} type
  285. * The type of track, either <code>'variant'</code> or <code>'text'</code>
  286. * or <code>'image'</code>.
  287. * @property {number} bandwidth
  288. * The bandwidth required to play the track, in bits/sec.
  289. *
  290. * @property {string} language
  291. * The language of the track, or <code>'und'</code> if not given. This value
  292. * is normalized as follows - language part is always lowercase and translated
  293. * to ISO-639-1 when possible, locale part is always uppercase,
  294. * i.e. <code>'en-US'</code>.
  295. * @property {?string} label
  296. * The track label, which is unique text that should describe the track.
  297. * @property {?string} kind
  298. * (only for text tracks) The kind of text track, either
  299. * <code>'caption'</code> or <code>'subtitle'</code>.
  300. * @property {?number} width
  301. * The video width provided in the manifest, if present.
  302. * @property {?number} height
  303. * The video height provided in the manifest, if present.
  304. * @property {?number} frameRate
  305. * The video framerate provided in the manifest, if present.
  306. * @property {?string} pixelAspectRatio
  307. * The video pixel aspect ratio provided in the manifest, if present.
  308. * @property {?string} hdr
  309. * The video HDR provided in the manifest, if present.
  310. * @property {?string} colorGamut
  311. * The video color gamut provided in the manifest, if present.
  312. * @property {?string} videoLayout
  313. * The video layout provided in the manifest, if present.
  314. * @property {?string} mimeType
  315. * The MIME type of the content provided in the manifest.
  316. * @property {?string} audioMimeType
  317. * The audio MIME type of the content provided in the manifest.
  318. * @property {?string} videoMimeType
  319. * The video MIME type of the content provided in the manifest.
  320. * @property {?string} codecs
  321. * The audio/video codecs string provided in the manifest, if present.
  322. * @property {?string} audioCodec
  323. * The audio codecs string provided in the manifest, if present.
  324. * @property {?string} videoCodec
  325. * The video codecs string provided in the manifest, if present.
  326. * @property {boolean} primary
  327. * True indicates that this in the primary language for the content.
  328. * This flag is based on signals from the manifest.
  329. * This can be a useful hint about which language should be the default, and
  330. * indicates which track Shaka will use when the user's language preference
  331. * cannot be satisfied.
  332. * @property {!Array.<string>} roles
  333. * The roles of the track, e.g. <code>'main'</code>, <code>'caption'</code>,
  334. * or <code>'commentary'</code>.
  335. * @property {Array.<string>} audioRoles
  336. * The roles of the audio in the track, e.g. <code>'main'</code> or
  337. * <code>'commentary'</code>. Will be null for text tracks or variant tracks
  338. * without audio.
  339. * @property {?shaka.media.ManifestParser.AccessibilityPurpose}
  340. * accessibilityPurpose
  341. * The DASH accessibility descriptor, if one was provided for this track.
  342. * For text tracks, this describes the text; otherwise, this is for the audio.
  343. * @property {boolean} forced
  344. * True indicates that this in the forced text language for the content.
  345. * This flag is based on signals from the manifest.
  346. * @property {?number} videoId
  347. * (only for variant tracks) The video stream id.
  348. * @property {?number} audioId
  349. * (only for variant tracks) The audio stream id.
  350. * @property {?number} channelsCount
  351. * The count of the audio track channels.
  352. * @property {?number} audioSamplingRate
  353. * Specifies the maximum sampling rate of the content.
  354. * @property {?string} tilesLayout
  355. * The value is a grid-item-dimension consisting of two positive decimal
  356. * integers in the format: column-x-row ('4x3'). It describes the arrangement
  357. * of Images in a Grid. The minimum valid LAYOUT is '1x1'.
  358. * @property {boolean} spatialAudio
  359. * True indicates that the content has spatial audio.
  360. * This flag is based on signals from the manifest.
  361. * @property {?number} audioBandwidth
  362. * (only for variant tracks) The audio stream's bandwidth if known.
  363. * @property {?number} videoBandwidth
  364. * (only for variant tracks) The video stream's bandwidth if known.
  365. * @property {?string} originalVideoId
  366. * (variant tracks only) The original ID of the video part of the track, if
  367. * any, as it appeared in the original manifest.
  368. * @property {?string} originalAudioId
  369. * (variant tracks only) The original ID of the audio part of the track, if
  370. * any, as it appeared in the original manifest.
  371. * @property {?string} originalTextId
  372. * (text tracks only) The original ID of the text track, if any, as it
  373. * appeared in the original manifest.
  374. * @property {?string} originalImageId
  375. * (image tracks only) The original ID of the image track, if any, as it
  376. * appeared in the original manifest.
  377. * @property {?string} originalLanguage
  378. * The original language of the track, if any, as it appeared in the original
  379. * manifest. This is the exact value provided in the manifest; for normalized
  380. * value use <code>language</code> property.
  381. * @exportDoc
  382. */
  383. shaka.extern.Track;
  384. /**
  385. * @typedef {!Array.<!shaka.extern.Track>}
  386. */
  387. shaka.extern.TrackList;
  388. /**
  389. * @typedef {{
  390. * minWidth: number,
  391. * maxWidth: number,
  392. * minHeight: number,
  393. * maxHeight: number,
  394. * minPixels: number,
  395. * maxPixels: number,
  396. *
  397. * minFrameRate: number,
  398. * maxFrameRate: number,
  399. *
  400. * minBandwidth: number,
  401. * maxBandwidth: number,
  402. *
  403. * minChannelsCount: number,
  404. * maxChannelsCount: number
  405. * }}
  406. *
  407. * @description
  408. * An object describing application restrictions on what tracks can play. All
  409. * restrictions must be fulfilled for a track to be playable/selectable.
  410. * The restrictions system behaves somewhat differently at the ABR level and the
  411. * player level, so please refer to the documentation for those specific
  412. * settings.
  413. *
  414. * @see shaka.extern.PlayerConfiguration
  415. * @see shaka.extern.AbrConfiguration
  416. *
  417. * @property {number} minWidth
  418. * The minimum width of a video track, in pixels.
  419. * @property {number} maxWidth
  420. * The maximum width of a video track, in pixels.
  421. * @property {number} minHeight
  422. * The minimum height of a video track, in pixels.
  423. * @property {number} maxHeight
  424. * The maximum height of a video track, in pixels.
  425. * @property {number} minPixels
  426. * The minimum number of total pixels in a video track (i.e.
  427. * <code>width * height</code>).
  428. * @property {number} maxPixels
  429. * The maximum number of total pixels in a video track (i.e.
  430. * <code>width * height</code>).
  431. *
  432. * @property {number} minFrameRate
  433. * The minimum framerate of a variant track.
  434. * @property {number} maxFrameRate
  435. * The maximum framerate of a variant track.
  436. *
  437. * @property {number} minBandwidth
  438. * The minimum bandwidth of a variant track, in bit/sec.
  439. * @property {number} maxBandwidth
  440. * The maximum bandwidth of a variant track, in bit/sec.
  441. *
  442. * @property {number} minChannelsCount
  443. * The minimum channels count of a variant track.
  444. * @property {number} maxChannelsCount
  445. * The maximum channels count of a variant track.
  446. * @exportDoc
  447. */
  448. shaka.extern.Restrictions;
  449. /**
  450. * @typedef {{
  451. * persistentState: boolean,
  452. * encryptionSchemes: !Array<string|null>,
  453. * videoRobustnessLevels: !Array<string>,
  454. * audioRobustnessLevels: !Array<string>
  455. * }}
  456. *
  457. * @property {boolean} persistentState
  458. * Whether this key system supports persistent state.
  459. * @property {!Array<string|null>} encryptionSchemes
  460. * An array of encryption schemes that are reported to work, through either
  461. * EME or MCap APIs. An empty array indicates that encryptionScheme queries
  462. * are not supported. This should not happen if our polyfills are installed.
  463. * @property {!Array<string>} videoRobustnessLevels
  464. * An array of video robustness levels that are reported to work. An empty
  465. * array indicates that none were tested. Not all key systems have a list of
  466. * known robustness levels built into probeSupport().
  467. * @property {!Array<string>} audioRobustnessLevels
  468. * An array of audio robustness levels that are reported to work. An empty
  469. * array indicates that none were tested. Not all key systems have a list of
  470. * known robustness levels built into probeSupport().
  471. * @exportDoc
  472. */
  473. shaka.extern.DrmSupportType;
  474. /**
  475. * @typedef {{
  476. * manifest: !Object.<string, boolean>,
  477. * media: !Object.<string, boolean>,
  478. * drm: !Object.<string, ?shaka.extern.DrmSupportType>,
  479. * hardwareResolution: shaka.extern.Resolution
  480. * }}
  481. *
  482. * @description
  483. * An object detailing browser support for various features.
  484. *
  485. * @property {!Object.<string, boolean>} manifest
  486. * A map of supported manifest types.
  487. * The keys are manifest MIME types and file extensions.
  488. * @property {!Object.<string, boolean>} media
  489. * A map of supported media types.
  490. * The keys are media MIME types.
  491. * @property {!Object.<string, ?shaka.extern.DrmSupportType>} drm
  492. * A map of supported key systems.
  493. * The keys are the key system names. The value is <code>null</code> if it is
  494. * not supported. Key systems not probed will not be in this dictionary.
  495. * @property {shaka.extern.Resolution} hardwareResolution
  496. * The maximum detected hardware resolution, which may have
  497. * height==width==Infinity for devices without a maximum resolution or
  498. * without a way to detect the maximum.
  499. *
  500. * @exportDoc
  501. */
  502. shaka.extern.SupportType;
  503. /**
  504. * @typedef {{
  505. * cueTime: ?number,
  506. * data: !Uint8Array,
  507. * frames: !Array.<shaka.extern.MetadataFrame>,
  508. * dts: ?number,
  509. * pts: ?number
  510. * }}
  511. *
  512. * @description
  513. * ID3 metadata in format defined by
  514. * https://id3.org/id3v2.3.0#Declared_ID3v2_frames
  515. * The content of the field.
  516. *
  517. * @property {?number} cueTime
  518. * @property {!Uint8Array} data
  519. * @property {!Array.<shaka.extern.MetadataFrame>} frames
  520. * @property {?number} dts
  521. * @property {?number} pts
  522. *
  523. * @exportDoc
  524. */
  525. shaka.extern.ID3Metadata;
  526. /**
  527. * @typedef {{
  528. * type: string,
  529. * size: number,
  530. * data: Uint8Array
  531. * }}
  532. *
  533. * @description metadata raw frame.
  534. * @property {string} type
  535. * @property {number} size
  536. * @property {Uint8Array} data
  537. * @exportDoc
  538. */
  539. shaka.extern.MetadataRawFrame;
  540. /**
  541. * @typedef {{
  542. * key: string,
  543. * data: (ArrayBuffer|string|number),
  544. * description: string,
  545. * mimeType: ?string,
  546. * pictureType: ?number
  547. * }}
  548. *
  549. * @description metadata frame parsed.
  550. * @property {string} key
  551. * @property {ArrayBuffer|string|number} data
  552. * @property {string} description
  553. * @property {?string} mimeType
  554. * @property {?number} pictureType
  555. * @exportDoc
  556. */
  557. shaka.extern.MetadataFrame;
  558. /**
  559. * @typedef {{
  560. * startTime: number,
  561. * endTime: ?number,
  562. * values: !Array.<shaka.extern.MetadataFrame>
  563. * }}
  564. *
  565. * @property {number} startTime
  566. * @property {?number} endTime
  567. * @property {!Array.<shaka.extern.MetadataFrame>} values
  568. * @exportDoc
  569. */
  570. shaka.extern.Interstitial;
  571. /**
  572. * @typedef {{
  573. * schemeIdUri: string,
  574. * value: string,
  575. * startTime: number,
  576. * endTime: number,
  577. * id: string,
  578. * eventElement: Element,
  579. * eventNode: ?shaka.extern.xml.Node
  580. * }}
  581. *
  582. * @description
  583. * Contains information about a region of the timeline that will cause an event
  584. * to be raised when the playhead enters or exits it. In DASH this is the
  585. * EventStream element.
  586. *
  587. * @property {string} schemeIdUri
  588. * Identifies the message scheme.
  589. * @property {string} value
  590. * Specifies the value for the region.
  591. * @property {number} startTime
  592. * The presentation time (in seconds) that the region should start.
  593. * @property {number} endTime
  594. * The presentation time (in seconds) that the region should end.
  595. * @property {string} id
  596. * Specifies an identifier for this instance of the region.
  597. * @property {Element} eventElement
  598. * <b>DEPRECATED</b>: Use eventNode instead.
  599. * The XML element that defines the Event.
  600. * @property {?shaka.extern.xml.Node} eventNode
  601. * The XML element that defines the Event.
  602. * @exportDoc
  603. */
  604. shaka.extern.TimelineRegionInfo;
  605. /**
  606. * @typedef {{
  607. * audioSamplingRate: ?number,
  608. * bandwidth: number,
  609. * codecs: string,
  610. * contentType: string,
  611. * frameRate: ?number,
  612. * height: ?number,
  613. * mimeType: ?string,
  614. * label: ?string,
  615. * roles: ?Array.<string>,
  616. * language: ?string,
  617. * channelsCount: ?number,
  618. * pixelAspectRatio: ?string,
  619. * width: ?number
  620. * }}
  621. *
  622. * @description
  623. * Contains information about the quality of an audio or video media stream.
  624. *
  625. * @property {?number} audioSamplingRate
  626. * Specifies the maximum sampling rate of the content.
  627. * @property {number} bandwidth
  628. * The bandwidth in bits per second.
  629. * @property {string} codecs
  630. * The Stream's codecs, e.g., 'avc1.4d4015' or 'vp9', which must be
  631. * compatible with the Stream's MIME type.
  632. * @property {string} contentType
  633. * The type of content, which may be "video" or "audio".
  634. * @property {?number} frameRate
  635. * The video frame rate.
  636. * @property {?number} height
  637. * The video height in pixels.
  638. * @property {string} mimeType
  639. * The MIME type.
  640. * @property {?string} label
  641. * The stream's label, when available.
  642. * @property {?Array.<string>} roles
  643. * The stream's role, when available.
  644. * @property {?string} language
  645. * The stream's language, when available.
  646. * @property {?number} channelsCount
  647. * The number of audio channels, or null if unknown.
  648. * @property {?string} pixelAspectRatio
  649. * The pixel aspect ratio value; e.g. "1:1".
  650. * @property {?number} width
  651. * The video width in pixels.
  652. * @exportDoc
  653. */
  654. shaka.extern.MediaQualityInfo;
  655. /**
  656. * @typedef {{
  657. * schemeIdUri: string,
  658. * value: string,
  659. * startTime: number,
  660. * endTime: number,
  661. * timescale: number,
  662. * presentationTimeDelta: number,
  663. * eventDuration: number,
  664. * id: number,
  665. * messageData: Uint8Array
  666. * }}
  667. *
  668. * @description
  669. * Contains information about an EMSG MP4 box.
  670. *
  671. * @property {string} schemeIdUri
  672. * Identifies the message scheme.
  673. * @property {string} value
  674. * Specifies the value for the event.
  675. * @property {number} startTime
  676. * The time that the event starts (in presentation time).
  677. * @property {number} endTime
  678. * The time that the event ends (in presentation time).
  679. * @property {number} timescale
  680. * Provides the timescale, in ticks per second.
  681. * @property {number} presentationTimeDelta
  682. * The offset that the event starts, relative to the start of the segment
  683. * this is contained in (in units of timescale).
  684. * @property {number} eventDuration
  685. * The duration of the event (in units of timescale).
  686. * @property {number} id
  687. * A field identifying this instance of the message.
  688. * @property {Uint8Array} messageData
  689. * Body of the message.
  690. * @exportDoc
  691. */
  692. shaka.extern.EmsgInfo;
  693. /**
  694. * @typedef {{
  695. * wallClockTime: number,
  696. * programStartDate: Date
  697. * }}
  698. *
  699. * @description
  700. * Contains information about an PRFT MP4 box.
  701. *
  702. * @property {number} wallClockTime
  703. * A UTC timestamp corresponding to decoding time in milliseconds.
  704. * @property {Date} programStartDate
  705. * The derived start date of the program.
  706. * @exportDoc
  707. */
  708. shaka.extern.ProducerReferenceTime;
  709. /**
  710. * @typedef {{
  711. * distinctiveIdentifierRequired: boolean,
  712. * persistentStateRequired: boolean,
  713. * videoRobustness: string,
  714. * audioRobustness: string,
  715. * serverCertificate: Uint8Array,
  716. * serverCertificateUri: string,
  717. * individualizationServer: string,
  718. * sessionType: string,
  719. * headers: !Object.<string, string>
  720. * }}
  721. *
  722. * @property {boolean} distinctiveIdentifierRequired
  723. * <i>Defaults to false.</i> <br>
  724. * True if the application requires the key system to support distinctive
  725. * identifiers.
  726. * @property {boolean} persistentStateRequired
  727. * <i>Defaults to false.</i> <br>
  728. * True if the application requires the key system to support persistent
  729. * state, e.g., for persistent license storage.
  730. * @property {string} videoRobustness
  731. * A key-system-specific string that specifies a required security level for
  732. * video.
  733. * <i>Defaults to <code>''</code>, i.e., no specific robustness required.</i>
  734. * @property {string} audioRobustness
  735. * A key-system-specific string that specifies a required security level for
  736. * audio.
  737. * <i>Defaults to <code>''</code>, i.e., no specific robustness required.</i>
  738. * @property {Uint8Array} serverCertificate
  739. * <i>Defaults to null.</i> <br>
  740. * <i>An empty certificate (<code>byteLength==0</code>) will be treated as
  741. * <code>null</code>.</i> <br>
  742. * <i>A certificate will be requested from the license server if
  743. * required.</i> <br>
  744. * A key-system-specific server certificate used to encrypt license requests.
  745. * Its use is optional and is meant as an optimization to avoid a round-trip
  746. * to request a certificate.
  747. * @property {string} serverCertificateUri
  748. * <i>Defaults to <code>''</code>.</i><br>
  749. * If given, will make a request to the given URI to get the server
  750. * certificate. This is ignored if <code>serverCertificate</code> is set.
  751. * @property {string} individualizationServer
  752. * The server that handles an <code>'individualiation-request'</code>. If the
  753. * server isn't given, it will default to the license server.
  754. * @property {string} sessionType
  755. * <i>Defaults to <code>'temporary'</code> for streaming.</i> <br>
  756. * The MediaKey session type to create streaming licenses with. This doesn't
  757. * affect offline storage.
  758. * @property {!Object.<string, string>} headers
  759. * The headers to use in the license request.
  760. *
  761. * @exportDoc
  762. */
  763. shaka.extern.AdvancedDrmConfiguration;
  764. /**
  765. * @typedef {{
  766. * sessionId: string,
  767. * sessionType: string,
  768. * initData: ?Uint8Array,
  769. * initDataType: ?string
  770. * }}
  771. *
  772. * @description
  773. * DRM Session Metadata for an active session
  774. *
  775. * @property {string} sessionId
  776. * Session id
  777. * @property {string} sessionType
  778. * Session type
  779. * @property {?Uint8Array} initData
  780. * Initialization data in the format indicated by initDataType.
  781. * @property {string} initDataType
  782. * A string to indicate what format initData is in.
  783. * @exportDoc
  784. */
  785. shaka.extern.DrmSessionMetadata;
  786. /**
  787. * @typedef {{
  788. * sessionId: string,
  789. * initData: ?Uint8Array,
  790. * initDataType: ?string
  791. * }}
  792. *
  793. * @description
  794. * DRM Session Metadata for saved persistent session
  795. *
  796. * @property {string} sessionId
  797. * Session id
  798. * @property {?Uint8Array} initData
  799. * Initialization data in the format indicated by initDataType.
  800. * @property {?string} initDataType
  801. * A string to indicate what format initData is in.
  802. * @exportDoc
  803. */
  804. shaka.extern.PersistentSessionMetadata;
  805. /**
  806. * @typedef {{
  807. * retryParameters: shaka.extern.RetryParameters,
  808. * servers: !Object.<string, string>,
  809. * clearKeys: !Object.<string, string>,
  810. * delayLicenseRequestUntilPlayed: boolean,
  811. * persistentSessionOnlinePlayback: boolean,
  812. * persistentSessionsMetadata:
  813. * !Array.<shaka.extern.PersistentSessionMetadata>,
  814. * advanced: Object.<string, shaka.extern.AdvancedDrmConfiguration>,
  815. * initDataTransform:(shaka.extern.InitDataTransform|undefined),
  816. * logLicenseExchange: boolean,
  817. * updateExpirationTime: number,
  818. * preferredKeySystems: !Array.<string>,
  819. * keySystemsMapping: !Object.<string, string>,
  820. * parseInbandPsshEnabled: boolean,
  821. * minHdcpVersion: string,
  822. * ignoreDuplicateInitData: boolean
  823. * }}
  824. *
  825. * @property {shaka.extern.RetryParameters} retryParameters
  826. * Retry parameters for license requests.
  827. * @property {!Object.<string, string>} servers
  828. * <i>Required for all but the clear key CDM.</i> <br>
  829. * A dictionary which maps key system IDs to their license servers.
  830. * For example,
  831. * <code>{'com.widevine.alpha': 'https://example.com/drm'}</code>.
  832. * @property {!Object.<string, string>} clearKeys
  833. * <i>Forces the use of the Clear Key CDM.</i>
  834. * A map of key IDs (hex or base64) to keys (hex or base64).
  835. * @property {boolean} delayLicenseRequestUntilPlayed
  836. * <i>Defaults to false.</i> <br>
  837. * True to configure drm to delay sending a license request until a user
  838. * actually starts playing content.
  839. * @property {boolean} persistentSessionOnlinePlayback
  840. * <i>Defaults to false.</i> <br>
  841. * True to configure drm to try playback with given persistent session ids
  842. * before requesting a license. Also prevents the session removal at playback
  843. * stop, as-to be able to re-use it later.
  844. * @property {!Array.<PersistentSessionMetadata>} persistentSessionsMetadata
  845. * Persistent sessions metadata to load before starting playback
  846. * @property {Object.<string, shaka.extern.AdvancedDrmConfiguration>} advanced
  847. * <i>Optional.</i> <br>
  848. * A dictionary which maps key system IDs to advanced DRM configuration for
  849. * those key systems.
  850. * @property {shaka.extern.InitDataTransform|undefined} initDataTransform
  851. * <i>Optional.</i><br>
  852. * If given, this function is called with the init data from the
  853. * manifest/media and should return the (possibly transformed) init data to
  854. * pass to the browser.
  855. * @property {boolean} logLicenseExchange
  856. * <i>Optional.</i><br>
  857. * If set to <code>true</code>, prints logs containing the license exchange.
  858. * This includes the init data, request, and response data, printed as base64
  859. * strings. Don't use in production, for debugging only; has no affect in
  860. * release builds as logging is removed.
  861. * @property {number} updateExpirationTime
  862. * <i>Defaults to 1.</i> <br>
  863. * The frequency in seconds with which to check the expiration of a session.
  864. * @property {!Array.<string>} preferredKeySystems
  865. * <i>Defaults ['com.microsoft.playready'] on Xbox One and PlayStation 4, and
  866. * an empty array for all other browsers.</i> <br>
  867. * Specifies the priorties of available DRM key systems.
  868. * @property {Object.<string, string>} keySystemsMapping
  869. * A map of key system name to key system name.
  870. * @property {boolean} parseInbandPsshEnabled
  871. * <i>Defaults to true on Xbox One, and false for all other browsers.</i><br>
  872. * When true parse DRM init data from pssh boxes in media and init segments
  873. * and ignore 'encrypted' events.
  874. * This is required when using in-band key rotation on Xbox One.
  875. * @property {string} minHdcpVersion
  876. * <i>By default (''), do not check the HDCP version.</i><br>
  877. * Indicates the minimum version of HDCP to start the playback of encrypted
  878. * streams. <b>May be ignored if not supported by the device.</b>
  879. * @property {boolean} ignoreDuplicateInitData
  880. * <i>Defaults to false on Tizen 2, and true for all other browsers.</i><br>
  881. * When true indicate that the player doesn't ignore duplicate init data.
  882. * Note: Tizen 2015 and 2016 models will send multiple webkitneedkey events
  883. * with the same init data. If the duplicates are supressed, playback
  884. * will stall without errors.
  885. * @exportDoc
  886. */
  887. shaka.extern.DrmConfiguration;
  888. /**
  889. * @typedef {function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array}
  890. *
  891. * @description
  892. * A callback function to handle custom content ID signaling for FairPlay
  893. * content.
  894. *
  895. * @exportDoc
  896. */
  897. shaka.extern.InitDataTransform;
  898. /**
  899. * @typedef {{
  900. * tagName: !string,
  901. * attributes: !Object<string, string>,
  902. * children: !Array.<shaka.extern.xml.Node | string>,
  903. * parent: ?shaka.extern.xml.Node
  904. * }}
  905. *
  906. * @description
  907. * Data structure for xml nodes as simple objects
  908. *
  909. * @property {!string} tagName
  910. * The name of the element
  911. * @property {!object} attributes
  912. * The attributes of the element
  913. * @property {!Array.<shaka.extern.xml.Node | string>} children
  914. * The child nodes or string body of the element
  915. * @property {?shaka.extern.xml.Node} parent
  916. * The parent of the current element
  917. *
  918. * @exportDoc
  919. */
  920. shaka.extern.xml.Node;
  921. /**
  922. * @typedef {{
  923. * clockSyncUri: string,
  924. * ignoreDrmInfo: boolean,
  925. * disableXlinkProcessing: boolean,
  926. * xlinkFailGracefully: boolean,
  927. * ignoreMinBufferTime: boolean,
  928. * autoCorrectDrift: boolean,
  929. * initialSegmentLimit: number,
  930. * ignoreSuggestedPresentationDelay: boolean,
  931. * ignoreEmptyAdaptationSet: boolean,
  932. * ignoreMaxSegmentDuration: boolean,
  933. * keySystemsByURI: !Object.<string, string>,
  934. * manifestPreprocessor: function(!Element),
  935. * manifestPreprocessorTXml: function(!shaka.extern.xml.Node),
  936. * sequenceMode: boolean,
  937. * enableAudioGroups: boolean,
  938. * multiTypeVariantsAllowed: boolean,
  939. * useStreamOnceInPeriodFlattening: boolean,
  940. * updatePeriod: number,
  941. * enableFastSwitching: boolean
  942. * }}
  943. *
  944. * @property {string} clockSyncUri
  945. * A default clock sync URI to be used with live streams which do not
  946. * contain any clock sync information. The <code>Date</code> header from this
  947. * URI will be used to determine the current time.
  948. * @property {boolean} ignoreDrmInfo
  949. * If true will cause DASH parser to ignore DRM information specified
  950. * by the manifest and treat it as if it signaled no particular key
  951. * system and contained no init data. Defaults to false if not provided.
  952. * @property {boolean} disableXlinkProcessing
  953. * If true, xlink-related processing will be disabled. Defaults to
  954. * <code>false</code> if not provided.
  955. * @property {boolean} xlinkFailGracefully
  956. * If true, xlink-related errors will result in a fallback to the tag's
  957. * existing contents. If false, xlink-related errors will be propagated
  958. * to the application and will result in a playback failure. Defaults to
  959. * false if not provided.
  960. * @property {boolean} ignoreMinBufferTime
  961. * If true will cause DASH parser to ignore <code>minBufferTime</code> from
  962. * manifest. It allows player config to take precedence over manifest for
  963. * <code>rebufferingGoal</code>. Defaults to <code>false</code> if not
  964. * provided.
  965. * @property {boolean} autoCorrectDrift
  966. * If <code>true</code>, ignore the <code>availabilityStartTime</code> in the
  967. * manifest and instead use the segments to determine the live edge. This
  968. * allows us to play streams that have a lot of drift. If <code>false</code>,
  969. * we can't play content where the manifest specifies segments in the future.
  970. * Defaults to <code>true</code>.
  971. * @property {number} initialSegmentLimit
  972. * The maximum number of initial segments to generate for
  973. * <code>SegmentTemplate</code> with fixed-duration segments. This is limited
  974. * to avoid excessive memory consumption with very large
  975. * <code>timeShiftBufferDepth</code> values.
  976. * @property {boolean} ignoreSuggestedPresentationDelay
  977. * If true will cause DASH parser to ignore
  978. * <code>suggestedPresentationDelay</code> from manifest. Defaults to
  979. * <code>false</code> if not provided.
  980. * @property {boolean} ignoreEmptyAdaptationSet
  981. * If true will cause DASH parser to ignore
  982. * empty <code>AdaptationSet</code> from manifest. Defaults to
  983. * <code>false</code> if not provided.
  984. * @property {boolean} ignoreMaxSegmentDuration
  985. * If true will cause DASH parser to ignore
  986. * <code>maxSegmentDuration</code> from manifest. Defaults to
  987. * <code>false</code> if not provided.
  988. * @property {Object.<string, string>} keySystemsByURI
  989. * A map of scheme URI to key system name. Defaults to default key systems
  990. * mapping handled by Shaka.
  991. * @property {function(!Element)} manifestPreprocessor
  992. * <b>DEPRECATED</b>: Use manifestPreprocessorTXml instead.
  993. * Called immediately after the DASH manifest has been parsed into an
  994. * XMLDocument. Provides a way for applications to perform efficient
  995. * preprocessing of the manifest.
  996. * @property {function(!shaka.extern.xml.Node)} manifestPreprocessorTXml
  997. * Called immediately after the DASH manifest has been parsed into an
  998. * XMLDocument. Provides a way for applications to perform efficient
  999. * preprocessing of the manifest.
  1000. * @property {boolean} sequenceMode
  1001. * If true, the media segments are appended to the SourceBuffer in
  1002. * "sequence mode" (ignoring their internal timestamps).
  1003. * <i>Defaults to <code>false</code>.</i>
  1004. * @property {boolean} enableAudioGroups
  1005. * If set, audio streams will be grouped and filtered by their parent
  1006. * adaptation set ID.
  1007. * <i>Defaults to <code>false</code>.</i>
  1008. * @property {boolean} multiTypeVariantsAllowed
  1009. * If true, the manifest parser will create variants that have multiple
  1010. * mimeTypes or codecs for video or for audio if there is no other choice.
  1011. * Meant for content where some periods are only available in one mimeType or
  1012. * codec, and other periods are only available in a different mimeType or
  1013. * codec. For example, a stream with baked-in ads where the audio codec does
  1014. * not match the main content.
  1015. * Might result in undesirable behavior if mediaSource.codecSwitchingStrategy
  1016. * is not set to SMOOTH.
  1017. * Defaults to true if SMOOTH codec switching is supported, RELOAD overwise.
  1018. * @property {boolean} useStreamOnceInPeriodFlattening
  1019. * If period combiner is used, this option ensures every stream is used
  1020. * only once in period flattening. It speeds up underlying algorithm
  1021. * but may raise issues if manifest does not have stream consistency
  1022. * between periods.
  1023. * Defaults to <code>false</code>.
  1024. * @property {number} updatePeriod
  1025. * Override the minimumUpdatePeriod of the manifest. The value is in second
  1026. * if the value is greater than the minimumUpdatePeriod, it will update the
  1027. * manifest less frequently. if you update the value during for a dynamic
  1028. * manifest, it will directly trigger a new download of the manifest
  1029. * Defaults to <code>-1</code>.
  1030. * @property {boolean} enableFastSwitching
  1031. * If false, disables fast switching track recognition.
  1032. * Defaults to <code>true</code>.
  1033. * @exportDoc
  1034. */
  1035. shaka.extern.DashManifestConfiguration;
  1036. /**
  1037. * @typedef {{
  1038. * ignoreTextStreamFailures: boolean,
  1039. * ignoreImageStreamFailures: boolean,
  1040. * defaultAudioCodec: string,
  1041. * defaultVideoCodec: string,
  1042. * ignoreManifestProgramDateTime: boolean,
  1043. * ignoreManifestProgramDateTimeForTypes: !Array<string>,
  1044. * mediaPlaylistFullMimeType: string,
  1045. * useSafariBehaviorForLive: boolean,
  1046. * liveSegmentsDelay: number,
  1047. * sequenceMode: boolean,
  1048. * ignoreManifestTimestampsInSegmentsMode: boolean,
  1049. * disableCodecGuessing: boolean,
  1050. * disableClosedCaptionsDetection: boolean,
  1051. * allowLowLatencyByteRangeOptimization: boolean
  1052. * }}
  1053. *
  1054. * @property {boolean} ignoreTextStreamFailures
  1055. * If <code>true</code>, ignore any errors in a text stream and filter out
  1056. * those streams.
  1057. * @property {boolean} ignoreImageStreamFailures
  1058. * If <code>true</code>, ignore any errors in a image stream and filter out
  1059. * those streams.
  1060. * @property {string} defaultAudioCodec
  1061. * The default audio codec if it is not specified in the HLS playlist.
  1062. * <i>Defaults to <code>'mp4a.40.2'</code>.</i>
  1063. * @property {string} defaultVideoCodec
  1064. * The default video codec if it is not specified in the HLS playlist.
  1065. * <i>Defaults to <code>'avc1.42E01E'</code>.</i>
  1066. * @property {boolean} ignoreManifestProgramDateTime
  1067. * If <code>true</code>, the HLS parser will ignore the
  1068. * <code>EXT-X-PROGRAM-DATE-TIME</code> tags in the manifest and use media
  1069. * sequence numbers instead. It also causes EXT-X-DATERANGE tags to be
  1070. * ignored. Meant for streams where <code>EXT-X-PROGRAM-DATE-TIME</code> is
  1071. * incorrect or malformed.
  1072. * <i>Defaults to <code>false</code>.</i>
  1073. * @property {!Array.<string>} ignoreManifestProgramDateTimeForTypes
  1074. * An array of strings representing types for which
  1075. * <code>EXT-X-PROGRAM-DATE-TIME</code> should be ignored. Only used if the
  1076. * the main ignoreManifestProgramDateTime is set to false.
  1077. * For example, setting this to ['text', 'video'] will cause the PDT values
  1078. * text and video streams to be ignored, while still using the PDT values for
  1079. * audio.
  1080. * <i>Defaults to an empty array.</i>
  1081. * @property {string} mediaPlaylistFullMimeType
  1082. * A string containing a full mime type, including both the basic mime type
  1083. * and also the codecs. Used when the HLS parser parses a media playlist
  1084. * directly, required since all of the mime type and codecs information is
  1085. * contained within the master playlist.
  1086. * You can use the <code>shaka.util.MimeUtils.getFullType()</code> utility to
  1087. * format this value.
  1088. * <i>Defaults to
  1089. * <code>'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'</code>.</i>
  1090. * @property {boolean} useSafariBehaviorForLive
  1091. * If this is true, playback will set the availability window to the
  1092. * presentation delay. The player will be able to buffer ahead three
  1093. * segments, but the seek window will be zero-sized, to be consistent with
  1094. * Safari. If this is false, the seek window will be the entire duration.
  1095. * <i>Defaults to <code>true</code>.</i>
  1096. * @property {number} liveSegmentsDelay
  1097. * The default presentation delay will be calculated as a number of segments.
  1098. * This is the number of segments for this calculation..
  1099. * <i>Defaults to <code>3</code>.</i>
  1100. * @property {boolean} sequenceMode
  1101. * If true, the media segments are appended to the SourceBuffer in
  1102. * "sequence mode" (ignoring their internal timestamps).
  1103. * Defaults to <code>true</code> except on WebOS 3, Tizen 2,
  1104. * Tizen 3 and PlayStation 4 whose default value is <code>false</code>.
  1105. * @property {boolean} ignoreManifestTimestampsInSegmentsMode
  1106. * If true, don't adjust the timestamp offset to account for manifest
  1107. * segment durations being out of sync with segment durations. In other
  1108. * words, assume that there are no gaps in the segments when appending
  1109. * to the SourceBuffer, even if the manifest and segment times disagree.
  1110. * Only applies when sequenceMode is <code>false</code>.
  1111. * <i>Defaults to <code>false</code>.</i>
  1112. * @property {boolean} disableCodecGuessing
  1113. * If set to true, the HLS parser won't automatically guess or assume default
  1114. * codec for playlists with no "CODECS" attribute. Instead, it will attempt to
  1115. * extract the missing information from the media segment.
  1116. * As a consequence, lazy-loading media playlists won't be possible for this
  1117. * use case, which may result in longer video startup times.
  1118. * <i>Defaults to <code>false</code>.</i>
  1119. * @property {boolean} disableClosedCaptionsDetection
  1120. * If true, disables the automatic detection of closed captions.
  1121. * Otherwise, in the absence of a EXT-X-MEDIA tag with TYPE="CLOSED-CAPTIONS",
  1122. * Shaka Player will attempt to detect captions based on the media data.
  1123. * <i>Defaults to <code>false</code>.</i>
  1124. * @property {boolean} allowLowLatencyByteRangeOptimization
  1125. * If set to true, the HLS parser will optimize operation with LL and partial
  1126. * byte range segments. More info in
  1127. * https://www.akamai.com/blog/performance/-using-ll-hls-with-byte-range-addressing-to-achieve-interoperabi
  1128. * <i>Defaults to <code>true</code>.</i>
  1129. * @exportDoc
  1130. */
  1131. shaka.extern.HlsManifestConfiguration;
  1132. /**
  1133. * @typedef {{
  1134. * manifestPreprocessor: function(!Element),
  1135. * manifestPreprocessorTXml: function(!shaka.extern.xml.Node),
  1136. * sequenceMode: boolean,
  1137. * keySystemsBySystemId: !Object.<string, string>
  1138. * }}
  1139. *
  1140. * @property {function(!Element)} manifestPreprocessor
  1141. * <b>DEPRECATED</b>: Use manifestPreprocessorTXml instead.
  1142. * Called immediately after the MSS manifest has been parsed into an
  1143. * XMLDocument. Provides a way for applications to perform efficient
  1144. * preprocessing of the manifest.
  1145. * @property {function(!shaka.extern.xml.Node)} manifestPreprocessorTXml
  1146. * Called immediately after the MSS manifest has been parsed into an
  1147. * XMLDocument. Provides a way for applications to perform efficient
  1148. * preprocessing of the manifest.
  1149. * @property {boolean} sequenceMode
  1150. * If true, the media segments are appended to the SourceBuffer in
  1151. * "sequence mode" (ignoring their internal timestamps).
  1152. * <i>Defaults to <code>false</code>.</i>
  1153. * @property {Object.<string, string>} keySystemsBySystemId
  1154. * A map of system id to key system name. Defaults to default key systems
  1155. * mapping handled by Shaka.
  1156. * @exportDoc
  1157. */
  1158. shaka.extern.MssManifestConfiguration;
  1159. /**
  1160. * @typedef {{
  1161. * retryParameters: shaka.extern.RetryParameters,
  1162. * availabilityWindowOverride: number,
  1163. * disableAudio: boolean,
  1164. * disableVideo: boolean,
  1165. * disableText: boolean,
  1166. * disableThumbnails: boolean,
  1167. * defaultPresentationDelay: number,
  1168. * segmentRelativeVttTiming: boolean,
  1169. * dash: shaka.extern.DashManifestConfiguration,
  1170. * hls: shaka.extern.HlsManifestConfiguration,
  1171. * mss: shaka.extern.MssManifestConfiguration,
  1172. * raiseFatalErrorOnManifestUpdateRequestFailure: boolean,
  1173. * continueLoadingWhenPaused: boolean
  1174. * }}
  1175. *
  1176. * @property {shaka.extern.RetryParameters} retryParameters
  1177. * Retry parameters for manifest requests.
  1178. * @property {number} availabilityWindowOverride
  1179. * A number, in seconds, that overrides the availability window in the
  1180. * manifest, or <code>NaN</code> if the default value should be used. This is
  1181. * enforced by the manifest parser, so custom manifest parsers should take
  1182. * care to honor this parameter.
  1183. * @property {boolean} disableAudio
  1184. * If <code>true</code>, the audio tracks are ignored.
  1185. * Defaults to <code>false</code>.
  1186. * @property {boolean} disableVideo
  1187. * If <code>true</code>, the video tracks are ignored.
  1188. * Defaults to <code>false</code>.
  1189. * @property {boolean} disableText
  1190. * If <code>true</code>, the text tracks are ignored.
  1191. * Defaults to <code>false</code>.
  1192. * @property {boolean} disableThumbnails
  1193. * If <code>true</code>, the image tracks are ignored.
  1194. * Defaults to <code>false</code>.
  1195. * @property {number} defaultPresentationDelay
  1196. * A default <code>presentationDelay</code> value.
  1197. * For DASH, it's a default <code>presentationDelay</code> value if
  1198. * <code>suggestedPresentationDelay</code> is missing in the MPEG DASH
  1199. * manifest. The default value is <code>1.5 * minBufferTime</code> if not
  1200. * configured or set as 0.
  1201. * For HLS, the default value is 3 segments duration if not configured or
  1202. * set as 0.
  1203. * @property {boolean} segmentRelativeVttTiming
  1204. * Option to calculate VTT text timings relative to the segment start
  1205. * instead of relative to the period start (which is the default).
  1206. * Defaults to <code>false</code>.
  1207. * @property {shaka.extern.DashManifestConfiguration} dash
  1208. * Advanced parameters used by the DASH manifest parser.
  1209. * @property {shaka.extern.HlsManifestConfiguration} hls
  1210. * Advanced parameters used by the HLS manifest parser.
  1211. * @property {shaka.extern.MssManifestConfiguration} mss
  1212. * Advanced parameters used by the MSS manifest parser.
  1213. * @property {boolean} raiseFatalErrorOnManifestUpdateRequestFailure
  1214. * If true, manifest update request failures will cause a fatal error.
  1215. * Defaults to <code>false</code> if not provided.
  1216. * @property {boolean} continueLoadingWhenPaused
  1217. * If true, live manifest will be updated with the regular intervals even if
  1218. * the video is paused.
  1219. * Defaults to <code>true</code> if not provided.
  1220. * @exportDoc
  1221. */
  1222. shaka.extern.ManifestConfiguration;
  1223. /**
  1224. * @typedef {{
  1225. * enabled: boolean,
  1226. * stabilityThreshold: number,
  1227. * rebufferIncrement: number,
  1228. * maxAttempts: number,
  1229. * maxLatency: number,
  1230. * minLatency: number
  1231. * }}
  1232. *
  1233. * @description
  1234. * Dynamic Target Latency configuration options.
  1235. *
  1236. * @property {boolean} enabled
  1237. * If <code>true</code>, dynamic latency for live sync is enabled. When
  1238. * enabled, the target latency will be adjusted closer to the min latency
  1239. * when playback is stable (see <code>stabilityThreshold</code>). If
  1240. * there are rebuffering events, then the target latency will move towards
  1241. * the max latency value in increments of <code>rebufferIncrement</code>.
  1242. * Defaults to <code>false</code>.
  1243. * @property {number} rebufferIncrement
  1244. * The value, in seconds, to increment the target latency towards
  1245. * <code>maxLatency</code> after a rebuffering event. Defaults to
  1246. * <code>0.5</code>.
  1247. * @property {number} stabilityThreshold
  1248. * Number of seconds after a rebuffering before we are considered stable and
  1249. * will move the target latency towards <code>minLatency</code>
  1250. * value. Defaults to <code>60</code>
  1251. * @property {number} maxAttempts
  1252. * Number of times that dynamic target latency will back off to
  1253. * <code>maxLatency</code> and attempt to adjust it closer to
  1254. * <code>minLatency</code>. Defaults to <code>10</code>
  1255. * @property {number} maxLatency
  1256. * The latency to use when a rebuffering event causes us to back off from
  1257. * the live edge. Defaults to <code>4</code>
  1258. * @property {number} minLatency
  1259. * The latency to work towards when the network is stable and we want to get
  1260. * closer to the live edge. Defaults to <code>1</code>
  1261. * @exportDoc
  1262. */
  1263. shaka.extern.DynamicTargetLatencyConfiguration;
  1264. /**
  1265. * @typedef {{
  1266. * enabled: boolean,
  1267. * targetLatency: number,
  1268. * targetLatencyTolerance: number,
  1269. * maxPlaybackRate: number,
  1270. * minPlaybackRate: number,
  1271. * panicMode: boolean,
  1272. * panicThreshold: number,
  1273. * dynamicTargetLatency: shaka.extern.DynamicTargetLatencyConfiguration
  1274. * }}
  1275. *
  1276. * @description
  1277. * LiveSync configuration options.
  1278. *
  1279. * @property {boolean} enabled
  1280. * Enable the live stream sync against the live edge by changing the playback
  1281. * rate. Defaults to <code>false</code>.
  1282. * Note: on some SmartTVs, if this is activated, it may not work or the sound
  1283. * may be lost when activated.
  1284. * @property {number} targetLatency
  1285. * Preferred latency, in seconds. Effective only if liveSync is true.
  1286. * Defaults to <code>0.5</code>.
  1287. * @property {number} targetLatencyTolerance
  1288. * Latency tolerance for target latency, in seconds. Effective only if
  1289. * liveSync is enabled. Defaults to <code>0.5</code>.
  1290. * @property {number} maxPlaybackRate
  1291. * Max playback rate used for latency chasing. It is recommended to use a
  1292. * value between 1 and 2. Effective only if liveSync is enabled. Defaults to
  1293. * <code>1.1</code>.
  1294. * @property {number} minPlaybackRate
  1295. * Minimum playback rate used for latency chasing. It is recommended to use a
  1296. * value between 0 and 1. Effective only if liveSync is enabled. Defaults to
  1297. * <code>0.95</code>.
  1298. * @property {boolean} panicMode
  1299. * If <code>true</code>, panic mode for live sync is enabled. When enabled,
  1300. * will set the playback rate to the <code>minPlaybackRate</code>
  1301. * until playback has continued past a rebuffering for longer than the
  1302. * <code>panicThreshold</code>. Defaults to <code>false</code>.
  1303. * @property {number} panicThreshold
  1304. * Number of seconds that playback stays in panic mode after a rebuffering.
  1305. * Defaults to <code>60</code>
  1306. * @property {shaka.extern.DynamicTargetLatencyConfiguration}
  1307. * dynamicTargetLatency
  1308. *
  1309. * The dynamic target latency config for dynamically adjusting the target
  1310. * latency to be closer to edge when network conditions are good and to back
  1311. * off when network conditions are bad.
  1312. * @exportDoc
  1313. */
  1314. shaka.extern.LiveSyncConfiguration;
  1315. /**
  1316. * @typedef {{
  1317. * retryParameters: shaka.extern.RetryParameters,
  1318. * failureCallback: function(!shaka.util.Error),
  1319. * rebufferingGoal: number,
  1320. * bufferingGoal: number,
  1321. * bufferBehind: number,
  1322. * evictionGoal: number,
  1323. * ignoreTextStreamFailures: boolean,
  1324. * alwaysStreamText: boolean,
  1325. * startAtSegmentBoundary: boolean,
  1326. * gapDetectionThreshold: number,
  1327. * gapJumpTimerTime: number,
  1328. * durationBackoff: number,
  1329. * safeSeekOffset: number,
  1330. * stallEnabled: boolean,
  1331. * stallThreshold: number,
  1332. * stallSkip: number,
  1333. * useNativeHlsForFairPlay: boolean,
  1334. * inaccurateManifestTolerance: number,
  1335. * lowLatencyMode: boolean,
  1336. * autoLowLatencyMode: boolean,
  1337. * forceHTTP: boolean,
  1338. * forceHTTPS: boolean,
  1339. * preferNativeHls: boolean,
  1340. * updateIntervalSeconds: number,
  1341. * dispatchAllEmsgBoxes: boolean,
  1342. * observeQualityChanges: boolean,
  1343. * maxDisabledTime: number,
  1344. * parsePrftBox: boolean,
  1345. * segmentPrefetchLimit: number,
  1346. * prefetchAudioLanguages: !Array<string>,
  1347. * disableAudioPrefetch: boolean,
  1348. * disableTextPrefetch: boolean,
  1349. * disableVideoPrefetch: boolean,
  1350. * liveSync: shaka.extern.LiveSyncConfiguration,
  1351. * allowMediaSourceRecoveries: boolean,
  1352. * minTimeBetweenRecoveries: number,
  1353. * vodDynamicPlaybackRate: boolean,
  1354. * vodDynamicPlaybackRateLowBufferRate: number,
  1355. * vodDynamicPlaybackRateBufferRatio: number,
  1356. * infiniteLiveStreamDuration: boolean,
  1357. * preloadNextUrlWindow: number,
  1358. * loadTimeout: number,
  1359. * clearDecodingCache: boolean,
  1360. * dontChooseCodecs: boolean,
  1361. * shouldFixTimestampOffset: boolean
  1362. * }}
  1363. *
  1364. * @description
  1365. * The StreamingEngine's configuration options.
  1366. *
  1367. * @property {shaka.extern.RetryParameters} retryParameters
  1368. * Retry parameters for segment requests.
  1369. * @property {function(!shaka.util.Error)} failureCallback
  1370. * A callback to decide what to do on a streaming failure. Default behavior
  1371. * is to retry on live streams and not on VOD.
  1372. * @property {number} rebufferingGoal
  1373. * The minimum number of seconds of content that the StreamingEngine must
  1374. * buffer before it can begin playback or can continue playback after it has
  1375. * entered into a buffering state (i.e., after it has depleted one more
  1376. * more of its buffers).
  1377. * @property {number} bufferingGoal
  1378. * The number of seconds of content that the StreamingEngine will attempt to
  1379. * buffer ahead of the playhead. This value must be greater than or equal to
  1380. * the rebuffering goal.
  1381. * @property {number} bufferBehind
  1382. * The maximum number of seconds of content that the StreamingEngine will keep
  1383. * in buffer behind the playhead when it appends a new media segment.
  1384. * The StreamingEngine will evict content to meet this limit.
  1385. * @property {number} evictionGoal
  1386. * The minimum duration in seconds of buffer overflow the StreamingEngine
  1387. * requires to start removing content from the buffer.
  1388. * Values less than <code>1.0</code> are not recommended.
  1389. * @property {boolean} ignoreTextStreamFailures
  1390. * If <code>true</code>, the player will ignore text stream failures and
  1391. * continue playing other streams.
  1392. * @property {boolean} alwaysStreamText
  1393. * If <code>true</code>, always stream text tracks, regardless of whether or
  1394. * not they are shown. This is necessary when using the browser's built-in
  1395. * controls, which are not capable of signaling display state changes back to
  1396. * Shaka Player.
  1397. * Defaults to <code>false</code>.
  1398. * @property {boolean} startAtSegmentBoundary
  1399. * If <code>true</code>, adjust the start time backwards so it is at the start
  1400. * of a segment. This affects both explicit start times and calculated start
  1401. * time for live streams. This can put us further from the live edge. Defaults
  1402. * to <code>false</code>.
  1403. * @property {number} gapDetectionThreshold
  1404. * The maximum distance (in seconds) before a gap when we'll automatically
  1405. * jump. This value defaults to <code>0.5</code>.
  1406. * @property {number} gapJumpTimerTime
  1407. * The polling time in seconds to check for gaps in the media. This value
  1408. * defaults to <code>0.25</code>.
  1409. * @property {number} durationBackoff
  1410. * By default, we will not allow seeking to exactly the duration of a
  1411. * presentation. This field is the number of seconds before duration we will
  1412. * seek to when the user tries to seek to or start playback at the duration.
  1413. * To disable this behavior, the config can be set to 0. We recommend using
  1414. * the default value unless you have a good reason not to.
  1415. * @property {number} safeSeekOffset
  1416. * The amount of seconds that should be added when repositioning the playhead
  1417. * after falling out of the availability window or seek. This gives the player
  1418. * more time to buffer before falling outside again, but increases the forward
  1419. * jump in the stream skipping more content. This is helpful for lower
  1420. * bandwidth scenarios. Defaults to 5 if not provided.
  1421. * @property {boolean} stallEnabled
  1422. * When set to <code>true</code>, the stall detector logic will run. If the
  1423. * playhead stops moving for <code>stallThreshold</code> seconds, the player
  1424. * will either seek or pause/play to resolve the stall, depending on the value
  1425. * of <code>stallSkip</code>.
  1426. * @property {number} stallThreshold
  1427. * The maximum number of seconds that may elapse without the playhead moving
  1428. * (when playback is expected) before it will be labeled as a stall.
  1429. * @property {number} stallSkip
  1430. * The number of seconds that the player will skip forward when a stall has
  1431. * been detected. If 0, the player will pause and immediately play instead of
  1432. * seeking. A value of 0 is recommended and provided as default on TV
  1433. * platforms (WebOS, Tizen, Chromecast, etc).
  1434. * @property {boolean} useNativeHlsForFairPlay
  1435. * Desktop Safari has both MediaSource and their native HLS implementation.
  1436. * Depending on the application's needs, it may prefer one over the other.
  1437. * Warning when disabled: Where single-key DRM streams work fine, multi-keys
  1438. * streams is showing unexpected behaviours (stall, audio playing with video
  1439. * freezes, ...). Use with care.
  1440. * Defaults to <code>true</code>.
  1441. * @property {number} inaccurateManifestTolerance
  1442. * The maximum difference, in seconds, between the times in the manifest and
  1443. * the times in the segments. Larger values allow us to compensate for more
  1444. * drift (up to one segment duration). Smaller values reduce the incidence of
  1445. * extra segment requests necessary to compensate for drift.
  1446. * @property {boolean} lowLatencyMode
  1447. * If <code>true</code>, low latency streaming mode is enabled. If
  1448. * lowLatencyMode is set to true, it changes the default config values for
  1449. * other things, see: docs/tutorials/config.md
  1450. * @property {boolean} autoLowLatencyMode
  1451. * If the stream is low latency and the user has not configured the
  1452. * lowLatencyMode, but if it has been configured to activate the
  1453. * lowLatencyMode if a stream of this type is detected, we automatically
  1454. * activate the lowLatencyMode. Defaults to false.
  1455. * @property {boolean} forceHTTP
  1456. * If true, if the protocol is HTTPs change it to HTTP.
  1457. * If both forceHTTP and forceHTTPS are set, forceHTTPS wins.
  1458. * @property {boolean} forceHTTPS
  1459. * If true, if the protocol is HTTP change it to HTTPs.
  1460. * If both forceHTTP and forceHTTPS are set, forceHTTPS wins.
  1461. * @property {boolean} preferNativeHls
  1462. * If true, prefer native HLS playback when possible, regardless of platform.
  1463. * @property {number} updateIntervalSeconds
  1464. * The minimum number of seconds to see if the manifest has changes.
  1465. * @property {boolean} dispatchAllEmsgBoxes
  1466. * If true, all emsg boxes are parsed and dispatched.
  1467. * @property {boolean} observeQualityChanges
  1468. * If true, monitor media quality changes and emit
  1469. * <code>shaka.Player.MediaQualityChangedEvent</code>.
  1470. * @property {number} maxDisabledTime
  1471. * The maximum time a variant can be disabled when NETWORK HTTP_ERROR
  1472. * is reached, in seconds.
  1473. * If all variants are disabled this way, NETWORK HTTP_ERROR will be thrown.
  1474. * @property {boolean} parsePrftBox
  1475. * If <code>true</code>, will raise a shaka.extern.ProducerReferenceTime
  1476. * player event (event name 'prft').
  1477. * The event will be raised only once per playback session as program
  1478. * start date will not change, and would save parsing the segment multiple
  1479. * times needlessly.
  1480. * Defaults to <code>false</code>.
  1481. * @property {number} segmentPrefetchLimit
  1482. * The maximum number of segments for each active stream to be prefetched
  1483. * ahead of playhead in parallel.
  1484. * If <code>0</code>, the segments will be fetched sequentially.
  1485. * Defaults to <code>0</code>.
  1486. * @property {!Array<string>} prefetchAudioLanguages
  1487. * The audio languages to prefetch.
  1488. * Defaults to an empty array.
  1489. * @property {boolean} disableAudioPrefetch
  1490. * If set and prefetch limit is defined, it will prevent from prefetching data
  1491. * for audio.
  1492. * Defaults to <code>false</code>.
  1493. * @property {boolean} disableTextPrefetch
  1494. * If set and prefetch limit is defined, it will prevent from prefetching data
  1495. * for text.
  1496. * Defaults to <code>false</code>.
  1497. * @property {boolean} disableVideoPrefetch
  1498. * If set and prefetch limit is defined, it will prevent from prefetching data
  1499. * for video.
  1500. * Defaults to <code>false</code>.
  1501. * @property {shaka.extern.LiveSyncConfiguration} liveSync
  1502. * The live sync configuration for keeping near the live edge.
  1503. * @property {boolean} allowMediaSourceRecoveries
  1504. * Indicate if we should recover from VIDEO_ERROR resetting Media Source.
  1505. * Defaults to <code>true</code>.
  1506. * @property {number} minTimeBetweenRecoveries
  1507. * The minimum time between recoveries when VIDEO_ERROR is reached, in
  1508. * seconds.
  1509. * Defaults to <code>5</code>.
  1510. * @property {boolean} vodDynamicPlaybackRate
  1511. * Adapt the playback rate of the player to keep the buffer full. Defaults to
  1512. * <code>false</code>.
  1513. * @property {number} vodDynamicPlaybackRateLowBufferRate
  1514. * Playback rate to use if the buffer is too small. Defaults to
  1515. * <code>0.95</code>.
  1516. * @property {number} vodDynamicPlaybackRateBufferRatio
  1517. * Ratio of the <code>bufferingGoal</code> as the low threshold for
  1518. * setting the playback rate to
  1519. * <code>vodDynamicPlaybackRateLowBufferRate</code>.
  1520. * Defaults to <code>0.5</code>.
  1521. * @property {boolean} infiniteLiveStreamDuration
  1522. * If <code>true</code>, the media source live duration
  1523. * set as a<code>Infinity</code>
  1524. * Defaults to <code> false </code>.
  1525. * @property {number} preloadNextUrlWindow
  1526. * The window of time at the end of the presentation to begin preloading the
  1527. * next URL, such as one specified by a urn:mpeg:dash:chaining:2016 element
  1528. * in DASH. Measured in seconds. If the value is 0, the next URL will not
  1529. * be preloaded at all.
  1530. * Defaults to <code> 30 </code>.
  1531. * @property {number} loadTimeout
  1532. * The maximum timeout to reject the load when using src= in case the content
  1533. * does not work correctly. Measured in seconds.
  1534. * Defaults to <code> 30 </code>.
  1535. * @property {boolean} clearDecodingCache
  1536. * Clears decodingInfo and MediaKeySystemAccess cache during player unload
  1537. * as these objects may become corrupt and cause issues during subsequent
  1538. * playbacks on some platforms.
  1539. * Defaults to <code>true</code> on PlayStation devices and to
  1540. * <code>false</code> on other devices.
  1541. * @property {boolean} dontChooseCodecs
  1542. * If true, we don't choose codecs in the player, and keep all the variants.
  1543. * Defaults to <code>false</code>.
  1544. * @property {boolean} shouldFixTimestampOffset
  1545. * If true, we will try to fix problems when the timestampOffset is less than
  1546. * the baseMediaDecodeTime. This only works when the manifest is DASH with
  1547. * MP4 segments.
  1548. * Defaults to <code>false</code> except on Tizen, WebOS whose default value
  1549. * is <code>true</code>.
  1550. * @exportDoc
  1551. */
  1552. shaka.extern.StreamingConfiguration;
  1553. /**
  1554. * @typedef {{
  1555. * codecSwitchingStrategy: shaka.config.CodecSwitchingStrategy,
  1556. * addExtraFeaturesToSourceBuffer: function(string): string,
  1557. * forceTransmux: boolean,
  1558. * insertFakeEncryptionInInit: boolean,
  1559. * modifyCueCallback: shaka.extern.TextParser.ModifyCueCallback
  1560. * }}
  1561. *
  1562. * @description
  1563. * Media source configuration.
  1564. *
  1565. * @property {shaka.config.CodecSwitchingStrategy} codecSwitchingStrategy
  1566. * Allow codec switching strategy. SMOOTH loading uses
  1567. * SourceBuffer.changeType. RELOAD uses cycling of MediaSource.
  1568. * Defaults to SMOOTH if SMOOTH codec switching is supported, RELOAD
  1569. * overwise.
  1570. * @property {function(string): string} addExtraFeaturesToSourceBuffer
  1571. * Callback to generate extra features string based on used MIME type.
  1572. * Some platforms may need to pass features when initializing the
  1573. * sourceBuffer.
  1574. * This string is ultimately appended to a MIME type in addSourceBuffer() &
  1575. * changeType().
  1576. * @property {boolean} forceTransmux
  1577. * If this is <code>true</code>, we will transmux AAC and TS content even if
  1578. * not strictly necessary for the assets to be played.
  1579. * This value defaults to <code>false</code>.
  1580. * @property {boolean} insertFakeEncryptionInInit
  1581. * If true, will apply a work-around for non-encrypted init segments on
  1582. * encrypted content for some platforms.
  1583. * <br><br>
  1584. * See https://github.com/shaka-project/shaka-player/issues/2759.
  1585. * <br><br>
  1586. * If you know you don't need this, you canset this value to
  1587. * <code>false</code> to gain a few milliseconds on loading time and seek
  1588. * time.
  1589. * <br><br>
  1590. * This value defaults to <code>true</code>.
  1591. * @property {shaka.extern.TextParser.ModifyCueCallback} modifyCueCallback
  1592. * A callback called for each cue after it is parsed, but right before it
  1593. * is appended to the presentation.
  1594. * Gives a chance for client-side editing of cue text, cue timing, etc.
  1595. * @exportDoc
  1596. */
  1597. shaka.extern.MediaSourceConfiguration;
  1598. /**
  1599. * @typedef {{
  1600. * customPlayheadTracker: boolean,
  1601. * skipPlayDetection: boolean,
  1602. * supportsMultipleMediaElements: boolean
  1603. * }}
  1604. *
  1605. * @description
  1606. * Ads configuration.
  1607. *
  1608. * @property {boolean} customPlayheadTracker
  1609. * If this is <code>true</code>, we create a custom playhead tracker for
  1610. * Client Side. This is useful because it allows you to implement the use of
  1611. * IMA on platforms that do not support multiple video elements.
  1612. * Defaults to <code>false</code> except on Tizen, WebOS, Chromecast,
  1613. * Hisense, PlayStation 4, PlayStation5, Xbox whose default value is
  1614. * <code>true</code>.
  1615. * @property {boolean} skipPlayDetection
  1616. * If this is true, we will load Client Side ads without waiting for a play
  1617. * event.
  1618. * Defaults to <code>false</code> except on Tizen, WebOS, Chromecast,
  1619. * Hisense, PlayStation 4, PlayStation5, Xbox whose default value is
  1620. * <code>true</code>.
  1621. * @property {boolean} supportsMultipleMediaElements
  1622. * If this is true, the browser supports multiple media elements.
  1623. * Defaults to <code>true</code> except on Tizen, WebOS, Chromecast,
  1624. * Hisense, PlayStation 4, PlayStation5, Xbox whose default value is
  1625. * <code>false</code>.
  1626. *
  1627. * @exportDoc
  1628. */
  1629. shaka.extern.AdsConfiguration;
  1630. /**
  1631. * @typedef {{
  1632. * enabled: boolean,
  1633. * useNetworkInformation: boolean,
  1634. * defaultBandwidthEstimate: number,
  1635. * restrictions: shaka.extern.Restrictions,
  1636. * switchInterval: number,
  1637. * bandwidthUpgradeTarget: number,
  1638. * bandwidthDowngradeTarget: number,
  1639. * advanced: shaka.extern.AdvancedAbrConfiguration,
  1640. * restrictToElementSize: boolean,
  1641. * restrictToScreenSize: boolean,
  1642. * ignoreDevicePixelRatio: boolean,
  1643. * clearBufferSwitch: boolean,
  1644. * safeMarginSwitch: number,
  1645. * cacheLoadThreshold: number,
  1646. * minTimeToSwitch: number
  1647. * }}
  1648. *
  1649. * @property {boolean} enabled
  1650. * If true, enable adaptation by the current AbrManager. Defaults to true.
  1651. * @property {boolean} useNetworkInformation
  1652. * If true, use the Network Information API in the current AbrManager, if it
  1653. * is available in the browser environment. If the Network Information API is
  1654. * used, Shaka Player will ignore the defaultBandwidthEstimate config.
  1655. * Defaults to true.
  1656. * @property {number} defaultBandwidthEstimate
  1657. * The default bandwidth estimate to use if there is not enough data, in
  1658. * bit/sec. Only used if useNetworkInformation is false, or if the Network
  1659. * Information API is not available.
  1660. * @property {shaka.extern.Restrictions} restrictions
  1661. * The restrictions to apply to ABR decisions. These are "soft" restrictions.
  1662. * Any track that fails to meet these restrictions will not be selected
  1663. * automatically, but will still appear in the track list and can still be
  1664. * selected via <code>selectVariantTrack()</code>. If no tracks meet these
  1665. * restrictions, AbrManager should not fail, but choose a low-res or
  1666. * low-bandwidth variant instead. It is the responsibility of AbrManager
  1667. * implementations to follow these rules and implement this behavior.
  1668. * @property {number} switchInterval
  1669. * The minimum amount of time that must pass between switches, in
  1670. * seconds. This keeps us from changing too often and annoying the user.
  1671. * @property {number} bandwidthUpgradeTarget
  1672. * The fraction of the estimated bandwidth which we should try to use when
  1673. * upgrading.
  1674. * @property {number} bandwidthDowngradeTarget
  1675. * The largest fraction of the estimated bandwidth we should use. We should
  1676. * downgrade to avoid this.
  1677. * @property {shaka.extern.AdvancedAbrConfiguration} advanced
  1678. * Advanced ABR configuration
  1679. * @property {boolean} restrictToElementSize
  1680. * If true, restrict the quality to media element size.
  1681. * Note: The use of ResizeObserver is required for it to work properly. If
  1682. * true without ResizeObserver, it behaves as false.
  1683. * Defaults false.
  1684. * @property {boolean} restrictToScreenSize
  1685. * If true, restrict the quality to screen size.
  1686. * Defaults false.
  1687. * @property {boolean} ignoreDevicePixelRatio
  1688. * If true,device pixel ratio is ignored when restricting the quality to
  1689. * media element size or screen size.
  1690. * Defaults false.
  1691. * @property {boolean} clearBufferSwitch
  1692. * If true, the buffer will be cleared during the switch.
  1693. * The default automatic behavior is false to have a smoother transition.
  1694. * On some device it's better to clear buffer.
  1695. * Defaults false.
  1696. * @property {number} safeMarginSwitch
  1697. * Optional amount of buffer (in seconds) to
  1698. * retain when clearing the buffer during the automatic switch.
  1699. * Useful for switching variant quickly without causing a buffering event.
  1700. * Defaults to 0 if not provided. Ignored if clearBuffer is false.
  1701. * Can cause hiccups on some browsers if chosen too small, e.g.
  1702. * The amount of two segments is a fair minimum to consider as safeMargin
  1703. * value.
  1704. * @property {number} cacheLoadThreshold
  1705. * Indicates the value in milliseconds from which a request is not
  1706. * considered cached.
  1707. * Defaults to <code>20</code>.
  1708. * @property {number} minTimeToSwitch
  1709. * Indicates the minimum time to change quality once the real bandwidth is
  1710. * available, in seconds. This time is only used on the first load.
  1711. * Defaults to <code>0</code> seconds except in Apple browsers whose default
  1712. * value is <code>0.5</code> seconds.
  1713. * @exportDoc
  1714. */
  1715. shaka.extern.AbrConfiguration;
  1716. /**
  1717. * @typedef {{
  1718. * minTotalBytes: number,
  1719. * minBytes: number,
  1720. * fastHalfLife: number,
  1721. * slowHalfLife: number
  1722. * }}
  1723. *
  1724. * @property {number} minTotalBytes
  1725. * Minimum number of bytes sampled before we trust the estimate. If we have
  1726. * not sampled much data, our estimate may not be accurate enough to trust.
  1727. * @property {number} minBytes
  1728. * Minimum number of bytes, under which samples are discarded. Our models
  1729. * do not include latency information, so connection startup time (time to
  1730. * first byte) is considered part of the download time. Because of this, we
  1731. * should ignore very small downloads which would cause our estimate to be
  1732. * too low.
  1733. * @property {number} fastHalfLife
  1734. * The quantity of prior samples (by weight) used when creating a new
  1735. * estimate, in seconds. Those prior samples make up half of the
  1736. * new estimate.
  1737. * @property {number} slowHalfLife
  1738. * The quantity of prior samples (by weight) used when creating a new
  1739. * estimate, in seconds. Those prior samples make up half of the
  1740. * new estimate.
  1741. * @exportDoc
  1742. */
  1743. shaka.extern.AdvancedAbrConfiguration;
  1744. /**
  1745. * @typedef {{
  1746. * enabled: boolean,
  1747. * useHeaders: boolean,
  1748. * sessionId: string,
  1749. * contentId: string,
  1750. * rtpSafetyFactor: number,
  1751. * includeKeys: !Array<string>
  1752. * }}
  1753. *
  1754. * @description
  1755. * Common Media Client Data (CMCD) configuration.
  1756. *
  1757. * @property {boolean} enabled
  1758. * If <code>true</code>, enable CMCD data to be sent with media requests.
  1759. * Defaults to <code>false</code>.
  1760. * @property {boolean} useHeaders
  1761. * If <code>true</code>, send CMCD data using the header transmission mode
  1762. * instead of query args. Defaults to <code>false</code>.
  1763. * @property {string} sessionId
  1764. * A GUID identifying the current playback session. A playback session
  1765. * typically ties together segments belonging to a single media asset.
  1766. * Maximum length is 64 characters. It is RECOMMENDED to conform to the UUID
  1767. * specification. By default the sessionId is automatically generated on each
  1768. * <code>load()</code> call.
  1769. * @property {string} contentId
  1770. * A unique string identifying the current content. Maximum length is 64
  1771. * characters. This value is consistent across multiple different sessions and
  1772. * devices and is defined and updated at the discretion of the service
  1773. * provider.
  1774. * @property {number} rtpSafetyFactor
  1775. * RTP safety factor.
  1776. * Defaults to <code>5</code>.
  1777. * @property {!Array<string>} includeKeys
  1778. * An array of keys to include in the CMCD data. If not provided, all keys
  1779. * will be included.
  1780. * @exportDoc
  1781. */
  1782. shaka.extern.CmcdConfiguration;
  1783. /**
  1784. * @typedef {{
  1785. * enabled: boolean,
  1786. * applyMaximumSuggestedBitrate: boolean,
  1787. * estimatedThroughputWeightRatio: number
  1788. * }}
  1789. *
  1790. * @description
  1791. * Common Media Server Data (CMSD) configuration.
  1792. *
  1793. * @property {boolean} enabled
  1794. * If <code>true</code>, enables reading CMSD data in media requests.
  1795. * Defaults to <code>true</code>.
  1796. * @property {boolean} applyMaximumSuggestedBitrate
  1797. * If true, we must apply the maximum suggested bitrate. If false, we ignore
  1798. * this.
  1799. * Defaults to <code>true</code>.
  1800. * @property {number} estimatedThroughputWeightRatio
  1801. * How much the estimatedThroughput of the CMSD data should be weighted
  1802. * against the default estimate, between 0 and 1.
  1803. * Defaults to <code>0.5</code>.
  1804. * @exportDoc
  1805. */
  1806. shaka.extern.CmsdConfiguration;
  1807. /**
  1808. * @typedef {{
  1809. * enabled: boolean,
  1810. * dynamicPerformanceScaling: boolean,
  1811. * logLevel: number,
  1812. * drawLogo: boolean
  1813. * }}
  1814. *
  1815. * @description
  1816. * Decoding for MPEG-5 Part2 LCEVC.
  1817. *
  1818. * @property {boolean} enabled
  1819. * If <code>true</code>, enable LCEVC.
  1820. * Defaults to <code>false</code>.
  1821. * @property {boolean} dynamicPerformanceScaling
  1822. * If <code>true</code>, LCEVC Dynamic Performance Scaling or dps is enabled
  1823. * to be triggered, when the system is not able to decode frames within a
  1824. * specific tolerance of the fps of the video and disables LCEVC decoding
  1825. * for some time. The base video will be shown upscaled to target resolution.
  1826. * If it is triggered again within a short period of time, the disabled
  1827. * time will be higher and if it is triggered three times in a row the LCEVC
  1828. * decoding will be disabled for that playback session.
  1829. * If dynamicPerformanceScaling is false, LCEVC decode will be forced
  1830. * and will drop frames appropriately if performance is sub optimal.
  1831. * Defaults to <code>true</code>.
  1832. * @property {number} logLevel
  1833. * Loglevel 0-5 for logging.
  1834. * NONE = 0
  1835. * ERROR = 1
  1836. * WARNING = 2
  1837. * INFO = 3
  1838. * DEBUG = 4
  1839. * VERBOSE = 5
  1840. * Defaults to <code>0</code>.
  1841. * @property {boolean} drawLogo
  1842. * If <code>true</code>, LCEVC Logo is placed on the top left hand corner
  1843. * which only appears when the LCEVC enhanced frames are being rendered.
  1844. * Defaults to true for the lib but is forced to false in this integration
  1845. * unless explicitly set to true through config.
  1846. * Defaults to <code>false</code>.
  1847. * @exportDoc
  1848. */
  1849. shaka.extern.LcevcConfiguration;
  1850. /**
  1851. * @typedef {{
  1852. * trackSelectionCallback:
  1853. * function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>,
  1854. * downloadSizeCallback: function(number):!Promise<boolean>,
  1855. * progressCallback: function(shaka.extern.StoredContent,number),
  1856. * usePersistentLicense: boolean,
  1857. * numberOfParallelDownloads: number
  1858. * }}
  1859. *
  1860. * @property {function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>}
  1861. * trackSelectionCallback
  1862. * Called inside <code>store()</code> to determine which tracks to save from a
  1863. * manifest. It is passed an array of Tracks from the manifest and it should
  1864. * return an array of the tracks to store.
  1865. * @property {function(number):!Promise<boolean>} downloadSizeCallback
  1866. * Called inside <code>store()</code> to determine if the content can be
  1867. * downloaded due to its estimated size. The estimated size of the download is
  1868. * passed and it must return if the download is allowed or not.
  1869. * @property {function(shaka.extern.StoredContent,number)} progressCallback
  1870. * Called inside <code>store()</code> to give progress info back to the app.
  1871. * It is given the current manifest being stored and the progress of it being
  1872. * stored.
  1873. * @property {boolean} usePersistentLicense
  1874. * If <code>true</code>, store protected content with a persistent license so
  1875. * that no network is required to view.
  1876. * If <code>false</code>, store protected content without a persistent
  1877. * license. A network will be required to retrieve a temporary license to
  1878. * view.
  1879. * Defaults to <code>true</code>.
  1880. * @property {number} numberOfParallelDownloads
  1881. * Number of parallel downloads.
  1882. * Note: normally browsers limit to 5 request in parallel, so putting a
  1883. * number higher than this will not help it download faster.
  1884. * Defaults to <code>5</code>.
  1885. * @exportDoc
  1886. */
  1887. shaka.extern.OfflineConfiguration;
  1888. /**
  1889. * @typedef {{
  1890. * captionsUpdatePeriod: number
  1891. * }}
  1892. *
  1893. * @description
  1894. * Text displayer configuration.
  1895. *
  1896. * @property {number} captionsUpdatePeriod
  1897. * The number of seconds to see if the captions should be updated.
  1898. * Defaults to <code>0.25</code>.
  1899. *
  1900. * @exportDoc
  1901. */
  1902. shaka.extern.TextDisplayerConfiguration;
  1903. /**
  1904. * @typedef {{
  1905. * ads: shaka.extern.AdsConfiguration,
  1906. * autoShowText: shaka.config.AutoShowText,
  1907. * drm: shaka.extern.DrmConfiguration,
  1908. * manifest: shaka.extern.ManifestConfiguration,
  1909. * streaming: shaka.extern.StreamingConfiguration,
  1910. * mediaSource: shaka.extern.MediaSourceConfiguration,
  1911. * abrFactory: shaka.extern.AbrManager.Factory,
  1912. * abr: shaka.extern.AbrConfiguration,
  1913. * cmcd: shaka.extern.CmcdConfiguration,
  1914. * cmsd: shaka.extern.CmsdConfiguration,
  1915. * lcevc: shaka.extern.LcevcConfiguration,
  1916. * offline: shaka.extern.OfflineConfiguration,
  1917. * preferredAudioLanguage: string,
  1918. * preferredAudioLabel: string,
  1919. * preferredTextLanguage: string,
  1920. * preferredVariantRole: string,
  1921. * preferredTextRole: string,
  1922. * preferredVideoCodecs: !Array.<string>,
  1923. * preferredAudioCodecs: !Array.<string>,
  1924. * preferredAudioChannelCount: number,
  1925. * preferredVideoHdrLevel: string,
  1926. * preferredVideoLayout: string,
  1927. * preferredVideoLabel: string,
  1928. * preferredDecodingAttributes: !Array.<string>,
  1929. * preferForcedSubs: boolean,
  1930. * preferSpatialAudio: boolean,
  1931. * restrictions: shaka.extern.Restrictions,
  1932. * playRangeStart: number,
  1933. * playRangeEnd: number,
  1934. * textDisplayer: shaka.extern.TextDisplayerConfiguration,
  1935. * textDisplayFactory: shaka.extern.TextDisplayer.Factory
  1936. * }}
  1937. *
  1938. * @property {shaka.extern.AdsConfiguration} ads
  1939. * Ads configuration and settings.
  1940. * @property {shaka.config.AutoShowText} autoShowText
  1941. * Controls behavior of auto-showing text tracks on load().
  1942. * @property {shaka.extern.DrmConfiguration} drm
  1943. * DRM configuration and settings.
  1944. * @property {shaka.extern.ManifestConfiguration} manifest
  1945. * Manifest configuration and settings.
  1946. * @property {shaka.extern.StreamingConfiguration} streaming
  1947. * Streaming configuration and settings.
  1948. * @property {shaka.extern.MediaSourceConfiguration} mediaSource
  1949. * Media source configuration and settings.
  1950. * @property {shaka.extern.AbrManager.Factory} abrFactory
  1951. * A factory to construct an abr manager.
  1952. * @property {shaka.extern.AbrConfiguration} abr
  1953. * ABR configuration and settings.
  1954. * @property {shaka.extern.CmcdConfiguration} cmcd
  1955. * CMCD configuration and settings. (Common Media Client Data)
  1956. * @property {shaka.extern.CmsdConfiguration} cmsd
  1957. * CMSD configuration and settings. (Common Media Server Data)
  1958. * @property {shaka.extern.LcevcConfiguration} lcevc
  1959. * MPEG-5 LCEVC configuration and settings.
  1960. * (Low Complexity Enhancement Video Codec)
  1961. * @property {shaka.extern.OfflineConfiguration} offline
  1962. * Offline configuration and settings.
  1963. * @property {string} preferredAudioLanguage
  1964. * The preferred language to use for audio tracks. If not given it will use
  1965. * the <code>'main'</code> track.
  1966. * Changing this during playback will not affect the current playback.
  1967. * @property {string} preferredAudioLabel
  1968. * The preferred label to use for audio tracks
  1969. * @property {string} preferredVideoLabel
  1970. * The preferred label to use for video tracks
  1971. * @property {string} preferredTextLanguage
  1972. * The preferred language to use for text tracks. If a matching text track
  1973. * is found, and the selected audio and text tracks have different languages,
  1974. * the text track will be shown.
  1975. * Changing this during playback will not affect the current playback.
  1976. * @property {string} preferredVariantRole
  1977. * The preferred role to use for variants.
  1978. * @property {string} preferredTextRole
  1979. * The preferred role to use for text tracks.
  1980. * @property {!Array.<string>} preferredVideoCodecs
  1981. * The list of preferred video codecs, in order of highest to lowest priority.
  1982. * @property {!Array.<string>} preferredAudioCodecs
  1983. * The list of preferred audio codecs, in order of highest to lowest priority.
  1984. * @property {number} preferredAudioChannelCount
  1985. * The preferred number of audio channels.
  1986. * @property {string} preferredVideoHdrLevel
  1987. * The preferred HDR level of the video. If possible, this will cause the
  1988. * player to filter to assets that either have that HDR level, or no HDR level
  1989. * at all.
  1990. * Can be 'SDR', 'PQ', 'HLG', 'AUTO' for auto-detect, or '' for no preference.
  1991. * Defaults to 'AUTO'.
  1992. * Note that one some platforms, such as Chrome, attempting to play PQ content
  1993. * may cause problems.
  1994. * @property {string} preferredVideoLayout
  1995. * The preferred video layout of the video.
  1996. * Can be 'CH-STEREO', 'CH-MONO', or '' for no preference.
  1997. * If the content is predominantly stereoscopic you should use 'CH-STEREO'.
  1998. * If the content is predominantly monoscopic you should use 'CH-MONO'.
  1999. * Defaults to ''.
  2000. * @property {!Array.<string>} preferredDecodingAttributes
  2001. * The list of preferred attributes of decodingInfo, in the order of their
  2002. * priorities.
  2003. * @property {boolean} preferForcedSubs
  2004. * If true, a forced text track is preferred. Defaults to false.
  2005. * If the content has no forced captions and the value is true,
  2006. * no text track is chosen.
  2007. * Changing this during playback will not affect the current playback.
  2008. * @property {boolean} preferSpatialAudio
  2009. * If true, a spatial audio track is preferred. Defaults to false.
  2010. * @property {shaka.extern.Restrictions} restrictions
  2011. * The application restrictions to apply to the tracks. These are "hard"
  2012. * restrictions. Any track that fails to meet these restrictions will not
  2013. * appear in the track list. If no tracks meet these restrictions, playback
  2014. * will fail.
  2015. * @property {number} playRangeStart
  2016. * Optional playback and seek start time in seconds. Defaults to 0 if
  2017. * not provided.
  2018. * @property {number} playRangeEnd
  2019. * Optional playback and seek end time in seconds. Defaults to the end of
  2020. * the presentation if not provided.
  2021. * @property {shaka.extern.TextDisplayerConfiguration} textDisplayer
  2022. * Text displayer configuration and settings.
  2023. * @property {shaka.extern.TextDisplayer.Factory} textDisplayFactory
  2024. * A factory to construct a text displayer. Note that, if this is changed
  2025. * during playback, it will cause the text tracks to be reloaded.
  2026. * @exportDoc
  2027. */
  2028. shaka.extern.PlayerConfiguration;
  2029. /**
  2030. * @typedef {{
  2031. * language: string,
  2032. * role: string,
  2033. * label: ?string
  2034. * }}
  2035. *
  2036. * @property {string} language
  2037. * The language code for the stream.
  2038. * @property {string} role
  2039. * The role name for the stream. If the stream has no role, <code>role</code>
  2040. * will be <code>''</code>.
  2041. * @property {?string} label
  2042. * The label of the audio stream, if it has one.
  2043. * @exportDoc
  2044. */
  2045. shaka.extern.LanguageRole;
  2046. /**
  2047. * @typedef {{
  2048. * segment: shaka.media.SegmentReference,
  2049. * imageHeight: number,
  2050. * imageWidth: number,
  2051. * height: number,
  2052. * positionX: number,
  2053. * positionY: number,
  2054. * startTime: number,
  2055. * duration: number,
  2056. * uris: !Array.<string>,
  2057. * width: number,
  2058. * sprite: boolean
  2059. * }}
  2060. *
  2061. * @property {shaka.media.SegmentReference} segment
  2062. * The segment of this thumbnail.
  2063. * @property {number} imageHeight
  2064. * The image height in px. The image height could be different to height if
  2065. * the layout is different to 1x1.
  2066. * @property {number} imageWidth
  2067. * The image width in px. The image width could be different to width if
  2068. * the layout is different to 1x1.
  2069. * @property {number} height
  2070. * The thumbnail height in px.
  2071. * @property {number} positionX
  2072. * The thumbnail left position in px.
  2073. * @property {number} positionY
  2074. * The thumbnail top position in px.
  2075. * @property {number} startTime
  2076. * The start time of the thumbnail in the presentation timeline, in seconds.
  2077. * @property {number} duration
  2078. * The duration of the thumbnail, in seconds.
  2079. * @property {!Array.<string>} uris
  2080. * An array of URIs to attempt. They will be tried in the order they are
  2081. * given.
  2082. * @property {number} width
  2083. * The thumbnail width in px.
  2084. * @property {boolean} sprite
  2085. * Indicate if the thumbnail is a sprite.
  2086. * @exportDoc
  2087. */
  2088. shaka.extern.Thumbnail;
  2089. /**
  2090. * @typedef {{
  2091. * id: string,
  2092. * title: string,
  2093. * startTime: number,
  2094. * endTime: number
  2095. * }}
  2096. *
  2097. * @property {string} id
  2098. * The id of the chapter.
  2099. * @property {string} title
  2100. * The title of the chapter.
  2101. * @property {number} startTime
  2102. * The time that describes the beginning of the range of the chapter.
  2103. * @property {number} endTime
  2104. * The time that describes the end of the range of chapter.
  2105. * @exportDoc
  2106. */
  2107. shaka.extern.Chapter;