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