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. * switchHistory: !Array.<shaka.extern.TrackChoice>,
  81. * stateHistory: !Array.<shaka.extern.StateChange>
  82. * }}
  83. *
  84. * @description
  85. * Contains statistics and information about the current state of the player.
  86. * This is meant for applications that want to log quality-of-experience (QoE)
  87. * or other stats. These values will reset when <code>load()</code> is called
  88. * again.
  89. *
  90. * @property {number} width
  91. * The width of the current video track.
  92. * @property {number} height
  93. * The height of the current video track.
  94. * @property {number} streamBandwidth
  95. * The bandwidth required for the current streams (total, in bit/sec).
  96. * It takes into account the playbackrate.
  97. *
  98. * @property {number} decodedFrames
  99. * The total number of frames decoded by the Player. This may be
  100. * <code>NaN</code> if this is not supported by the browser.
  101. * @property {number} droppedFrames
  102. * The total number of frames dropped by the Player. This may be
  103. * <code>NaN</code> if this is not supported by the browser.
  104. * @property {number} corruptedFrames
  105. * The total number of corrupted frames dropped by the browser. This may be
  106. * <code>NaN</code> if this is not supported by the browser.
  107. * @property {number} estimatedBandwidth
  108. * The current estimated network bandwidth (in bit/sec).
  109. *
  110. * @property {number} gapsJumped
  111. * The total number of playback gaps jumped by the GapJumpingController.
  112. * @property {number} stallsDetected
  113. * The total number of playback stalls detected by the StallDetector.
  114. *
  115. * @property {number} completionPercent
  116. * This is the greatest completion percent that the user has experienced in
  117. * playback. Also known as the "high water mark". Is NaN when there is no
  118. * known duration, such as for livestreams.
  119. * @property {number} loadLatency
  120. * This is the number of seconds it took for the video element to have enough
  121. * data to begin playback. This is measured from the time load() is called to
  122. * the time the <code>'loadeddata'</code> event is fired by the media element.
  123. * @property {number} manifestTimeSeconds
  124. * The amount of time it took to download and parse the manifest.
  125. * @property {number} drmTimeSeconds
  126. * The amount of time it took to download the first drm key.
  127. * @property {number} playTime
  128. * The total time spent in a playing state in seconds.
  129. * @property {number} pauseTime
  130. * The total time spent in a paused state in seconds.
  131. * @property {number} bufferingTime
  132. * The total time spent in a buffering state in seconds.
  133. * @property {number} licenseTime
  134. * The time spent on license requests during this session in seconds, or NaN.
  135. * @property {number} liveLatency
  136. * The time between the capturing of a frame and the end user having it
  137. * displayed on their screen.
  138. *
  139. * @property {number} maxSegmentDuration
  140. * The presentation's max segment duration in seconds, or NaN.
  141. *
  142. * @property {!Array.<shaka.extern.TrackChoice>} switchHistory
  143. * A history of the stream changes.
  144. * @property {!Array.<shaka.extern.StateChange>} stateHistory
  145. * A history of the state changes.
  146. * @exportDoc
  147. */
  148. shaka.extern.Stats;
  149. /**
  150. * @typedef {{
  151. * start: number,
  152. * end: number
  153. * }}
  154. *
  155. * @description
  156. * Contains the times of a range of buffered content.
  157. *
  158. * @property {number} start
  159. * The start time of the range, in seconds.
  160. * @property {number} end
  161. * The end time of the range, in seconds.
  162. * @exportDoc
  163. */
  164. shaka.extern.BufferedRange;
  165. /**
  166. * @typedef {{
  167. * total: !Array.<shaka.extern.BufferedRange>,
  168. * audio: !Array.<shaka.extern.BufferedRange>,
  169. * video: !Array.<shaka.extern.BufferedRange>,
  170. * text: !Array.<shaka.extern.BufferedRange>
  171. * }}
  172. *
  173. * @description
  174. * Contains information about the current buffered ranges.
  175. *
  176. * @property {!Array.<shaka.extern.BufferedRange>} total
  177. * The combined audio/video buffered ranges, reported by
  178. * <code>video.buffered</code>.
  179. * @property {!Array.<shaka.extern.BufferedRange>} audio
  180. * The buffered ranges for audio content.
  181. * @property {!Array.<shaka.extern.BufferedRange>} video
  182. * The buffered ranges for video content.
  183. * @property {!Array.<shaka.extern.BufferedRange>} text
  184. * The buffered ranges for text content.
  185. * @exportDoc
  186. */
  187. shaka.extern.BufferedInfo;
  188. /**
  189. * @typedef {{
  190. * id: number,
  191. * active: boolean,
  192. *
  193. * type: string,
  194. * bandwidth: number,
  195. *
  196. * language: string,
  197. * label: ?string,
  198. * kind: ?string,
  199. * width: ?number,
  200. * height: ?number,
  201. * frameRate: ?number,
  202. * pixelAspectRatio: ?string,
  203. * hdr: ?string,
  204. * mimeType: ?string,
  205. * audioMimeType: ?string,
  206. * videoMimeType: ?string,
  207. * codecs: ?string,
  208. * audioCodec: ?string,
  209. * videoCodec: ?string,
  210. * primary: boolean,
  211. * roles: !Array.<string>,
  212. * audioRoles: Array.<string>,
  213. * forced: boolean,
  214. * videoId: ?number,
  215. * audioId: ?number,
  216. * channelsCount: ?number,
  217. * audioSamplingRate: ?number,
  218. * tilesLayout: ?string,
  219. * audioBandwidth: ?number,
  220. * videoBandwidth: ?number,
  221. * spatialAudio: boolean,
  222. * originalVideoId: ?string,
  223. * originalAudioId: ?string,
  224. * originalTextId: ?string,
  225. * originalImageId: ?string
  226. * }}
  227. *
  228. * @description
  229. * An object describing a media track. This object should be treated as
  230. * read-only as changing any values does not have any effect. This is the
  231. * public view of an audio/video paring (variant type) or text track (text
  232. * type) or image track (image type).
  233. *
  234. * @property {number} id
  235. * The unique ID of the track.
  236. * @property {boolean} active
  237. * If true, this is the track being streamed (another track may be
  238. * visible/audible in the buffer).
  239. *
  240. * @property {string} type
  241. * The type of track, either <code>'variant'</code> or <code>'text'</code>
  242. * or <code>'image'</code>.
  243. * @property {number} bandwidth
  244. * The bandwidth required to play the track, in bits/sec.
  245. *
  246. * @property {string} language
  247. * The language of the track, or <code>'und'</code> if not given. This is the
  248. * exact value provided in the manifest; it may need to be normalized.
  249. * @property {?string} label
  250. * The track label, which is unique text that should describe the track.
  251. * @property {?string} kind
  252. * (only for text tracks) The kind of text track, either
  253. * <code>'caption'</code> or <code>'subtitle'</code>.
  254. * @property {?number} width
  255. * The video width provided in the manifest, if present.
  256. * @property {?number} height
  257. * The video height provided in the manifest, if present.
  258. * @property {?number} frameRate
  259. * The video framerate provided in the manifest, if present.
  260. * @property {?string} pixelAspectRatio
  261. * The video pixel aspect ratio provided in the manifest, if present.
  262. * @property {?string} hdr
  263. * The video HDR provided in the manifest, if present.
  264. * @property {?string} mimeType
  265. * The MIME type of the content provided in the manifest.
  266. * @property {?string} audioMimeType
  267. * The audio MIME type of the content provided in the manifest.
  268. * @property {?string} videoMimeType
  269. * The video MIME type of the content provided in the manifest.
  270. * @property {?string} codecs
  271. * The audio/video codecs string provided in the manifest, if present.
  272. * @property {?string} audioCodec
  273. * The audio codecs string provided in the manifest, if present.
  274. * @property {?string} videoCodec
  275. * The video codecs string provided in the manifest, if present.
  276. * @property {boolean} primary
  277. * True indicates that this in the primary language for the content.
  278. * This flag is based on signals from the manifest.
  279. * This can be a useful hint about which language should be the default, and
  280. * indicates which track Shaka will use when the user's language preference
  281. * cannot be satisfied.
  282. * @property {!Array.<string>} roles
  283. * The roles of the track, e.g. <code>'main'</code>, <code>'caption'</code>,
  284. * or <code>'commentary'</code>.
  285. * @property {Array.<string>} audioRoles
  286. * The roles of the audio in the track, e.g. <code>'main'</code> or
  287. * <code>'commentary'</code>. Will be null for text tracks or variant tracks
  288. * without audio.
  289. * @property {boolean} forced
  290. * True indicates that this in the forced text language for the content.
  291. * This flag is based on signals from the manifest.
  292. * @property {?number} videoId
  293. * (only for variant tracks) The video stream id.
  294. * @property {?number} audioId
  295. * (only for variant tracks) The audio stream id.
  296. * @property {?number} channelsCount
  297. * The count of the audio track channels.
  298. * @property {?number} audioSamplingRate
  299. * Specifies the maximum sampling rate of the content.
  300. * @property {?string} tilesLayout
  301. * The value is a grid-item-dimension consisting of two positive decimal
  302. * integers in the format: column-x-row ('4x3'). It describes the arrangement
  303. * of Images in a Grid. The minimum valid LAYOUT is '1x1'.
  304. * @property {boolean} spatialAudio
  305. * True indicates that the content has spatial audio.
  306. * This flag is based on signals from the manifest.
  307. * @property {?number} audioBandwidth
  308. * (only for variant tracks) The audio stream's bandwidth if known.
  309. * @property {?number} videoBandwidth
  310. * (only for variant tracks) The video stream's bandwidth if known.
  311. * @property {?string} originalVideoId
  312. * (variant tracks only) The original ID of the video part of the track, if
  313. * any, as it appeared in the original manifest.
  314. * @property {?string} originalAudioId
  315. * (variant tracks only) The original ID of the audio part of the track, if
  316. * any, as it appeared in the original manifest.
  317. * @property {?string} originalTextId
  318. * (text tracks only) The original ID of the text track, if any, as it
  319. * appeared in the original manifest.
  320. * @property {?string} originalImageId
  321. * (image tracks only) The original ID of the image track, if any, as it
  322. * appeared in the original manifest.
  323. * @exportDoc
  324. */
  325. shaka.extern.Track;
  326. /**
  327. * @typedef {!Array.<!shaka.extern.Track>}
  328. */
  329. shaka.extern.TrackList;
  330. /**
  331. * @typedef {{
  332. * minWidth: number,
  333. * maxWidth: number,
  334. * minHeight: number,
  335. * maxHeight: number,
  336. * minPixels: number,
  337. * maxPixels: number,
  338. *
  339. * minFrameRate: number,
  340. * maxFrameRate: number,
  341. *
  342. * minBandwidth: number,
  343. * maxBandwidth: number
  344. * }}
  345. *
  346. * @description
  347. * An object describing application restrictions on what tracks can play. All
  348. * restrictions must be fulfilled for a track to be playable/selectable.
  349. * The restrictions system behaves somewhat differently at the ABR level and the
  350. * player level, so please refer to the documentation for those specific
  351. * settings.
  352. *
  353. * @see shaka.extern.PlayerConfiguration
  354. * @see shaka.extern.AbrConfiguration
  355. *
  356. * @property {number} minWidth
  357. * The minimum width of a video track, in pixels.
  358. * @property {number} maxWidth
  359. * The maximum width of a video track, in pixels.
  360. * @property {number} minHeight
  361. * The minimum height of a video track, in pixels.
  362. * @property {number} maxHeight
  363. * The maximum height of a video track, in pixels.
  364. * @property {number} minPixels
  365. * The minimum number of total pixels in a video track (i.e.
  366. * <code>width * height</code>).
  367. * @property {number} maxPixels
  368. * The maximum number of total pixels in a video track (i.e.
  369. * <code>width * height</code>).
  370. *
  371. * @property {number} minFrameRate
  372. * The minimum framerate of a variant track.
  373. * @property {number} maxFrameRate
  374. * The maximum framerate of a variant track.
  375. *
  376. * @property {number} minBandwidth
  377. * The minimum bandwidth of a variant track, in bit/sec.
  378. * @property {number} maxBandwidth
  379. * The maximum bandwidth of a variant track, in bit/sec.
  380. * @exportDoc
  381. */
  382. shaka.extern.Restrictions;
  383. /**
  384. * @typedef {{
  385. * persistentState: boolean
  386. * }}
  387. *
  388. * @property {boolean} persistentState
  389. * Whether this key system supports persistent state.
  390. * @exportDoc
  391. */
  392. shaka.extern.DrmSupportType;
  393. /**
  394. * @typedef {{
  395. * manifest: !Object.<string, boolean>,
  396. * media: !Object.<string, boolean>,
  397. * drm: !Object.<string, ?shaka.extern.DrmSupportType>
  398. * }}
  399. *
  400. * @description
  401. * An object detailing browser support for various features.
  402. *
  403. * @property {!Object.<string, boolean>} manifest
  404. * A map of supported manifest types.
  405. * The keys are manifest MIME types and file extensions.
  406. * @property {!Object.<string, boolean>} media
  407. * A map of supported media types.
  408. * The keys are media MIME types.
  409. * @property {!Object.<string, ?shaka.extern.DrmSupportType>} drm
  410. * A map of supported key systems.
  411. * The keys are the key system names. The value is <code>null</code> if it is
  412. * not supported. Key systems not probed will not be in this dictionary.
  413. *
  414. * @exportDoc
  415. */
  416. shaka.extern.SupportType;
  417. /**
  418. * @typedef {{
  419. * cueTime: ?number,
  420. * data: !Uint8Array,
  421. * frames: !Array.<shaka.extern.MetadataFrame>,
  422. * dts: ?number,
  423. * pts: ?number
  424. * }}
  425. *
  426. * @description
  427. * ID3 metadata in format defined by
  428. * https://id3.org/id3v2.3.0#Declared_ID3v2_frames
  429. * The content of the field.
  430. *
  431. * @property {?number} cueTime
  432. * @property {!Uint8Array} data
  433. * @property {!Array.<shaka.extern.MetadataFrame>} frames
  434. * @property {?number} dts
  435. * @property {?number} pts
  436. *
  437. * @exportDoc
  438. */
  439. shaka.extern.ID3Metadata;
  440. /**
  441. * @typedef {{
  442. * type: string,
  443. * size: number,
  444. * data: Uint8Array
  445. * }}
  446. *
  447. * @description metadata raw frame.
  448. * @property {string} type
  449. * @property {number} size
  450. * @property {Uint8Array} data
  451. * @exportDoc
  452. */
  453. shaka.extern.MetadataRawFrame;
  454. /**
  455. * @typedef {{
  456. * key: string,
  457. * data: (ArrayBuffer|string),
  458. * description: string
  459. * }}
  460. *
  461. * @description metadata frame parsed.
  462. * @property {string} key
  463. * @property {ArrayBuffer|string} data
  464. * @property {string} description
  465. * @exportDoc
  466. */
  467. shaka.extern.MetadataFrame;
  468. /**
  469. * @typedef {{
  470. * schemeIdUri: string,
  471. * value: string,
  472. * startTime: number,
  473. * endTime: number,
  474. * id: string,
  475. * eventElement: Element
  476. * }}
  477. *
  478. * @description
  479. * Contains information about a region of the timeline that will cause an event
  480. * to be raised when the playhead enters or exits it. In DASH this is the
  481. * EventStream element.
  482. *
  483. * @property {string} schemeIdUri
  484. * Identifies the message scheme.
  485. * @property {string} value
  486. * Specifies the value for the region.
  487. * @property {number} startTime
  488. * The presentation time (in seconds) that the region should start.
  489. * @property {number} endTime
  490. * The presentation time (in seconds) that the region should end.
  491. * @property {string} id
  492. * Specifies an identifier for this instance of the region.
  493. * @property {Element} eventElement
  494. * The XML element that defines the Event.
  495. * @exportDoc
  496. */
  497. shaka.extern.TimelineRegionInfo;
  498. /**
  499. * @typedef {{
  500. * audioSamplingRate: ?number,
  501. * bandwidth: number,
  502. * codecs: string,
  503. * contentType: string,
  504. * frameRate: ?number,
  505. * height: ?number,
  506. * mimeType: ?string,
  507. * channelsCount: ?number,
  508. * pixelAspectRatio: ?string,
  509. * width: ?number
  510. * }}
  511. *
  512. * @description
  513. * Contains information about the quality of an audio or video media stream.
  514. *
  515. * @property {?number} audioSamplingRate
  516. * Specifies the maximum sampling rate of the content.
  517. * @property {number} bandwidth
  518. * The bandwidth in bits per second.
  519. * @property {string} codecs
  520. * The Stream's codecs, e.g., 'avc1.4d4015' or 'vp9', which must be
  521. * compatible with the Stream's MIME type.
  522. * @property {string} contentType
  523. * The type of content, which may be "video" or "audio".
  524. * @property {?number} frameRate
  525. * The video frame rate.
  526. * @property {?number} height
  527. * The video height in pixels.
  528. * @property {string} mimeType
  529. * The MIME type.
  530. * @property {?number} channelsCount
  531. * The number of audio channels, or null if unknown.
  532. * @property {?string} pixelAspectRatio
  533. * The pixel aspect ratio value; e.g "1:1".
  534. * @property {?number} width
  535. * The video width in pixels.
  536. * @exportDoc
  537. */
  538. shaka.extern.MediaQualityInfo;
  539. /**
  540. * @typedef {{
  541. * schemeIdUri: string,
  542. * value: string,
  543. * startTime: number,
  544. * endTime: number,
  545. * timescale: number,
  546. * presentationTimeDelta: number,
  547. * eventDuration: number,
  548. * id: number,
  549. * messageData: Uint8Array
  550. * }}
  551. *
  552. * @description
  553. * Contains information about an EMSG MP4 box.
  554. *
  555. * @property {string} schemeIdUri
  556. * Identifies the message scheme.
  557. * @property {string} value
  558. * Specifies the value for the event.
  559. * @property {number} startTime
  560. * The time that the event starts (in presentation time).
  561. * @property {number} endTime
  562. * The time that the event ends (in presentation time).
  563. * @property {number} timescale
  564. * Provides the timescale, in ticks per second.
  565. * @property {number} presentationTimeDelta
  566. * The offset that the event starts, relative to the start of the segment
  567. * this is contained in (in units of timescale).
  568. * @property {number} eventDuration
  569. * The duration of the event (in units of timescale).
  570. * @property {number} id
  571. * A field identifying this instance of the message.
  572. * @property {Uint8Array} messageData
  573. * Body of the message.
  574. * @exportDoc
  575. */
  576. shaka.extern.EmsgInfo;
  577. /**
  578. * @typedef {{
  579. * wallClockTime: number,
  580. * programStartDate: Date
  581. * }}
  582. *
  583. * @description
  584. * Contains information about an PRFT MP4 box.
  585. *
  586. * @property {number} wallClockTime
  587. * A UTC timestamp corresponding to decoding time in milliseconds.
  588. * @property {Date} programStartDate
  589. * The derived start date of the program.
  590. * @exportDoc
  591. */
  592. shaka.extern.ProducerReferenceTime;
  593. /**
  594. * @typedef {{
  595. * distinctiveIdentifierRequired: boolean,
  596. * persistentStateRequired: boolean,
  597. * videoRobustness: string,
  598. * audioRobustness: string,
  599. * serverCertificate: Uint8Array,
  600. * serverCertificateUri: string,
  601. * individualizationServer: string,
  602. * sessionType: string
  603. * }}
  604. *
  605. * @property {boolean} distinctiveIdentifierRequired
  606. * <i>Defaults to false.</i> <br>
  607. * True if the application requires the key system to support distinctive
  608. * identifiers.
  609. * @property {boolean} persistentStateRequired
  610. * <i>Defaults to false.</i> <br>
  611. * True if the application requires the key system to support persistent
  612. * state, e.g., for persistent license storage.
  613. * @property {string} videoRobustness
  614. * A key-system-specific string that specifies a required security level for
  615. * video.
  616. * <i>Defaults to <code>''</code>, i.e., no specific robustness required.</i>
  617. * @property {string} audioRobustness
  618. * A key-system-specific string that specifies a required security level for
  619. * audio.
  620. * <i>Defaults to <code>''</code>, i.e., no specific robustness required.</i>
  621. * @property {Uint8Array} serverCertificate
  622. * <i>Defaults to null.</i> <br>
  623. * <i>An empty certificate (<code>byteLength==0</code>) will be treated as
  624. * <code>null</code>.</i> <br>
  625. * <i>A certificate will be requested from the license server if
  626. * required.</i> <br>
  627. * A key-system-specific server certificate used to encrypt license requests.
  628. * Its use is optional and is meant as an optimization to avoid a round-trip
  629. * to request a certificate.
  630. * @property {string} serverCertificateUri
  631. * <i>Defaults to <code>''</code>.</i><br>
  632. * If given, will make a request to the given URI to get the server
  633. * certificate. This is ignored if <code>serverCertificate</code> is set.
  634. * @property {string} individualizationServer
  635. * The server that handles an <code>'individualiation-request'</code>. If the
  636. * server isn't given, it will default to the license server.
  637. * @property {string} sessionType
  638. * <i>Defaults to <code>'temporary'</code> for streaming.</i> <br>
  639. * The MediaKey session type to create streaming licenses with. This doesn't
  640. * affect offline storage.
  641. *
  642. * @exportDoc
  643. */
  644. shaka.extern.AdvancedDrmConfiguration;
  645. /**
  646. * @typedef {{
  647. * retryParameters: shaka.extern.RetryParameters,
  648. * servers: !Object.<string, string>,
  649. * clearKeys: !Object.<string, string>,
  650. * delayLicenseRequestUntilPlayed: boolean,
  651. * advanced: Object.<string, shaka.extern.AdvancedDrmConfiguration>,
  652. * initDataTransform:
  653. * ((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
  654. * undefined),
  655. * logLicenseExchange: boolean,
  656. * updateExpirationTime: number,
  657. * preferredKeySystems: !Array.<string>,
  658. * keySystemsMapping: !Object.<string, string>,
  659. * parseInbandPsshEnabled: boolean
  660. * }}
  661. *
  662. * @property {shaka.extern.RetryParameters} retryParameters
  663. * Retry parameters for license requests.
  664. * @property {!Object.<string, string>} servers
  665. * <i>Required for all but the clear key CDM.</i> <br>
  666. * A dictionary which maps key system IDs to their license servers.
  667. * For example,
  668. * <code>{'com.widevine.alpha': 'https://example.com/drm'}</code>.
  669. * @property {!Object.<string, string>} clearKeys
  670. * <i>Forces the use of the Clear Key CDM.</i>
  671. * A map of key IDs (hex or base64) to keys (hex or base64).
  672. * @property {boolean} delayLicenseRequestUntilPlayed
  673. * <i>Defaults to false.</i> <br>
  674. * True to configure drm to delay sending a license request until a user
  675. * actually starts playing content.
  676. * @property {Object.<string, shaka.extern.AdvancedDrmConfiguration>} advanced
  677. * <i>Optional.</i> <br>
  678. * A dictionary which maps key system IDs to advanced DRM configuration for
  679. * those key systems.
  680. * @property
  681. * {((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
  682. * undefined)}
  683. * initDataTransform
  684. * <i>Optional.</i><br>
  685. * If given, this function is called with the init data from the
  686. * manifest/media and should return the (possibly transformed) init data to
  687. * pass to the browser.
  688. * @property {boolean} logLicenseExchange
  689. * <i>Optional.</i><br>
  690. * If set to <code>true</code>, prints logs containing the license exchange.
  691. * This includes the init data, request, and response data, printed as base64
  692. * strings. Don't use in production, for debugging only; has no affect in
  693. * release builds as logging is removed.
  694. * @property {number} updateExpirationTime
  695. * <i>Defaults to 1.</i> <br>
  696. * The frequency in seconds with which to check the expiration of a session.
  697. * @property {!Array.<string>} preferredKeySystems
  698. * <i>Defaults to an empty array. </i> <br>
  699. * Specifies the priorties of available DRM key systems.
  700. * @property {Object.<string, string>} keySystemsMapping
  701. * A map of key system name to key system name.
  702. * @property {boolean} parseInbandPsshEnabled
  703. * <i>Defaults to true on Xbox One, and false for all other browsers.</i><br>
  704. * When true parse DRM init data from pssh boxes in media and init segments
  705. * and ignore 'encrypted' events.
  706. * This is required when using in-band key rotation on Xbox One.
  707. *
  708. * @exportDoc
  709. */
  710. shaka.extern.DrmConfiguration;
  711. /**
  712. * @typedef {{
  713. * clockSyncUri: string,
  714. * ignoreDrmInfo: boolean,
  715. * disableXlinkProcessing: boolean,
  716. * xlinkFailGracefully: boolean,
  717. * ignoreMinBufferTime: boolean,
  718. * autoCorrectDrift: boolean,
  719. * initialSegmentLimit: number,
  720. * ignoreSuggestedPresentationDelay: boolean,
  721. * ignoreEmptyAdaptationSet: boolean,
  722. * ignoreMaxSegmentDuration: boolean,
  723. * keySystemsByURI: !Object.<string, string>,
  724. * manifestPreprocessor: function(!Element),
  725. * sequenceMode: boolean
  726. * }}
  727. *
  728. * @property {string} clockSyncUri
  729. * A default clock sync URI to be used with live streams which do not
  730. * contain any clock sync information. The <code>Date</code> header from this
  731. * URI will be used to determine the current time.
  732. * @property {boolean} ignoreDrmInfo
  733. * If true will cause DASH parser to ignore DRM information specified
  734. * by the manifest and treat it as if it signaled no particular key
  735. * system and contained no init data. Defaults to false if not provided.
  736. * @property {boolean} disableXlinkProcessing
  737. * If true, xlink-related processing will be disabled. Defaults to
  738. * <code>false</code> if not provided.
  739. * @property {boolean} xlinkFailGracefully
  740. * If true, xlink-related errors will result in a fallback to the tag's
  741. * existing contents. If false, xlink-related errors will be propagated
  742. * to the application and will result in a playback failure. Defaults to
  743. * false if not provided.
  744. * @property {boolean} ignoreMinBufferTime
  745. * If true will cause DASH parser to ignore <code>minBufferTime</code> from
  746. * manifest. It allows player config to take precedence over manifest for
  747. * <code>rebufferingGoal</code>. Defaults to <code>false</code> if not
  748. * provided.
  749. * @property {boolean} autoCorrectDrift
  750. * If <code>true</code>, ignore the <code>availabilityStartTime</code> in the
  751. * manifest and instead use the segments to determine the live edge. This
  752. * allows us to play streams that have a lot of drift. If <code>false</code>,
  753. * we can't play content where the manifest specifies segments in the future.
  754. * Defaults to <code>true</code>.
  755. * @property {number} initialSegmentLimit
  756. * The maximum number of initial segments to generate for
  757. * <code>SegmentTemplate</code> with fixed-duration segments. This is limited
  758. * to avoid excessive memory consumption with very large
  759. * <code>timeShiftBufferDepth</code> values.
  760. * @property {boolean} ignoreSuggestedPresentationDelay
  761. * If true will cause DASH parser to ignore
  762. * <code>suggestedPresentationDelay</code> from manifest. Defaults to
  763. * <code>false</code> if not provided.
  764. * @property {boolean} ignoreEmptyAdaptationSet
  765. * If true will cause DASH parser to ignore
  766. * empty <code>AdaptationSet</code> from manifest. Defaults to
  767. * <code>false</code> if not provided.
  768. * @property {boolean} ignoreMaxSegmentDuration
  769. * If true will cause DASH parser to ignore
  770. * <code>maxSegmentDuration</code> from manifest. Defaults to
  771. * <code>false</code> if not provided.
  772. * @property {Object.<string, string>} keySystemsByURI
  773. * A map of scheme URI to key system name. Defaults to default key systems
  774. * mapping handled by Shaka.
  775. * @property {function(!Element)} manifestPreprocessor
  776. * Called immediately after the DASH manifest has been parsed into an
  777. * XMLDocument. Provides a way for applications to perform efficient
  778. * preprocessing of the manifest.
  779. * @property {boolean} sequenceMode
  780. * If true, the media segments are appended to the SourceBuffer in
  781. * "sequence mode" (ignoring their internal timestamps).
  782. * <i>Defaults to <code>false</code>.</i>
  783. * @exportDoc
  784. */
  785. shaka.extern.DashManifestConfiguration;
  786. /**
  787. * @typedef {{
  788. * ignoreTextStreamFailures: boolean,
  789. * ignoreImageStreamFailures: boolean,
  790. * defaultAudioCodec: string,
  791. * defaultVideoCodec: string,
  792. * ignoreManifestProgramDateTime: boolean,
  793. * mediaPlaylistFullMimeType: string,
  794. * useSafariBehaviorForLive: boolean,
  795. * liveSegmentsDelay: number
  796. * }}
  797. *
  798. * @property {boolean} ignoreTextStreamFailures
  799. * If <code>true</code>, ignore any errors in a text stream and filter out
  800. * those streams.
  801. * @property {boolean} ignoreImageStreamFailures
  802. * If <code>true</code>, ignore any errors in a image stream and filter out
  803. * those streams.
  804. * @property {string} defaultAudioCodec
  805. * The default audio codec if it is not specified in the HLS playlist.
  806. * <i>Defaults to <code>'mp4a.40.2'</code>.</i>
  807. * @property {string} defaultVideoCodec
  808. * The default video codec if it is not specified in the HLS playlist.
  809. * <i>Defaults to <code>'avc1.42E01E'</code>.</i>
  810. * @property {boolean} ignoreManifestProgramDateTime
  811. * If <code>true</code>, the HLS parser will ignore the
  812. * <code>EXT-X-PROGRAM-DATE-TIME</code> tags in the manifest and use media
  813. * sequence numbers instead.
  814. * Meant for streams where <code>EXT-X-PROGRAM-DATE-TIME</code> is incorrect
  815. * or malformed.
  816. * <i>Defaults to <code>false</code>.</i>
  817. * @property {string} mediaPlaylistFullMimeType
  818. * A string containing a full mime type, including both the basic mime type
  819. * and also the codecs. Used when the HLS parser parses a media playlist
  820. * directly, required since all of the mime type and codecs information is
  821. * contained within the master playlist.
  822. * You can use the <code>shaka.util.MimeUtils.getFullType()</code> utility to
  823. * format this value.
  824. * <i>Defaults to
  825. * <code>'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'</code>.</i>
  826. * @property {boolean} useSafariBehaviorForLive
  827. * If this is true, playback will set the availability window to the
  828. * presentation delay. The player will be able to buffer ahead three
  829. * segments, but the seek window will be zero-sized, to be consistent with
  830. * Safari. If this is false, the seek window will be the entire duration.
  831. * <i>Defaults to <code>true</code>.</i>
  832. * @property {number} liveSegmentsDelay
  833. * The default presentation delay will be calculated as a number of segments.
  834. * This is the number of segments for this calculation..
  835. * <i>Defaults to <code>3</code>.</i>
  836. * @exportDoc
  837. */
  838. shaka.extern.HlsManifestConfiguration;
  839. /**
  840. * @typedef {{
  841. * retryParameters: shaka.extern.RetryParameters,
  842. * availabilityWindowOverride: number,
  843. * disableAudio: boolean,
  844. * disableVideo: boolean,
  845. * disableText: boolean,
  846. * disableThumbnails: boolean,
  847. * defaultPresentationDelay: number,
  848. * segmentRelativeVttTiming: boolean,
  849. * dash: shaka.extern.DashManifestConfiguration,
  850. * hls: shaka.extern.HlsManifestConfiguration
  851. * }}
  852. *
  853. * @property {shaka.extern.RetryParameters} retryParameters
  854. * Retry parameters for manifest requests.
  855. * @property {number} availabilityWindowOverride
  856. * A number, in seconds, that overrides the availability window in the
  857. * manifest, or <code>NaN</code> if the default value should be used. This is
  858. * enforced by the manifest parser, so custom manifest parsers should take
  859. * care to honor this parameter.
  860. * @property {boolean} disableAudio
  861. * If <code>true</code>, the audio tracks are ignored.
  862. * Defaults to <code>false</code>.
  863. * @property {boolean} disableVideo
  864. * If <code>true</code>, the video tracks are ignored.
  865. * Defaults to <code>false</code>.
  866. * @property {boolean} disableText
  867. * If <code>true</code>, the text tracks are ignored.
  868. * Defaults to <code>false</code>.
  869. * @property {boolean} disableThumbnails
  870. * If <code>true</code>, the image tracks are ignored.
  871. * Defaults to <code>false</code>.
  872. * @property {number} defaultPresentationDelay
  873. * A default <code>presentationDelay</code> value.
  874. * For DASH, it's a default <code>presentationDelay</code> value if
  875. * <code>suggestedPresentationDelay</code> is missing in the MPEG DASH
  876. * manifest. The default value is <code>1.5 * minBufferTime</code> if not
  877. * configured or set as 0.
  878. * For HLS, the default value is 3 segments duration if not configured or
  879. * set as 0.
  880. * @property {boolean} segmentRelativeVttTiming
  881. * Option to calculate VTT text timings relative to the segment start
  882. * instead of relative to the period start (which is the default).
  883. * Defaults to <code>false</code>.
  884. * @property {shaka.extern.DashManifestConfiguration} dash
  885. * Advanced parameters used by the DASH manifest parser.
  886. * @property {shaka.extern.HlsManifestConfiguration} hls
  887. * Advanced parameters used by the HLS manifest parser.
  888. *
  889. * @exportDoc
  890. */
  891. shaka.extern.ManifestConfiguration;
  892. /**
  893. * @typedef {{
  894. * retryParameters: shaka.extern.RetryParameters,
  895. * failureCallback: function(!shaka.util.Error),
  896. * rebufferingGoal: number,
  897. * bufferingGoal: number,
  898. * bufferBehind: number,
  899. * ignoreTextStreamFailures: boolean,
  900. * alwaysStreamText: boolean,
  901. * startAtSegmentBoundary: boolean,
  902. * gapDetectionThreshold: number,
  903. * durationBackoff: number,
  904. * forceTransmux: boolean,
  905. * safeSeekOffset: number,
  906. * stallEnabled: boolean,
  907. * stallThreshold: number,
  908. * stallSkip: number,
  909. * useNativeHlsOnSafari: boolean,
  910. * inaccurateManifestTolerance: number,
  911. * lowLatencyMode: boolean,
  912. * autoLowLatencyMode: boolean,
  913. * forceHTTPS: boolean,
  914. * preferNativeHls: boolean,
  915. * updateIntervalSeconds: number,
  916. * dispatchAllEmsgBoxes: boolean,
  917. * observeQualityChanges: boolean,
  918. * maxDisabledTime: number,
  919. * parsePrftBox: boolean
  920. * }}
  921. *
  922. * @description
  923. * The StreamingEngine's configuration options.
  924. *
  925. * @property {shaka.extern.RetryParameters} retryParameters
  926. * Retry parameters for segment requests.
  927. * @property {function(!shaka.util.Error)} failureCallback
  928. * A callback to decide what to do on a streaming failure. Default behavior
  929. * is to retry on live streams and not on VOD.
  930. * @property {number} rebufferingGoal
  931. * The minimum number of seconds of content that the StreamingEngine must
  932. * buffer before it can begin playback or can continue playback after it has
  933. * entered into a buffering state (i.e., after it has depleted one more
  934. * more of its buffers).
  935. * @property {number} bufferingGoal
  936. * The number of seconds of content that the StreamingEngine will attempt to
  937. * buffer ahead of the playhead. This value must be greater than or equal to
  938. * the rebuffering goal.
  939. * @property {number} bufferBehind
  940. * The maximum number of seconds of content that the StreamingEngine will keep
  941. * in buffer behind the playhead when it appends a new media segment.
  942. * The StreamingEngine will evict content to meet this limit.
  943. * @property {boolean} ignoreTextStreamFailures
  944. * If <code>true</code>, the player will ignore text stream failures and
  945. * continue playing other streams.
  946. * @property {boolean} alwaysStreamText
  947. * If <code>true</code>, always stream text tracks, regardless of whether or
  948. * not they are shown. This is necessary when using the browser's built-in
  949. * controls, which are not capable of signaling display state changes back to
  950. * Shaka Player.
  951. * Defaults to <code>false</code>.
  952. * @property {boolean} startAtSegmentBoundary
  953. * If <code>true</code>, adjust the start time backwards so it is at the start
  954. * of a segment. This affects both explicit start times and calculated start
  955. * time for live streams. This can put us further from the live edge. Defaults
  956. * to <code>false</code>.
  957. * @property {number} gapDetectionThreshold
  958. * TThe maximum distance (in seconds) before a gap when we'll automatically
  959. * jump. This value defaults to <code>0.1</code>, except in Edge Legacy,
  960. * Tizen, Chromecast that value defaults value is <code>0.5</code>
  961. * @property {number} durationBackoff
  962. * By default, we will not allow seeking to exactly the duration of a
  963. * presentation. This field is the number of seconds before duration we will
  964. * seek to when the user tries to seek to or start playback at the duration.
  965. * To disable this behavior, the config can be set to 0. We recommend using
  966. * the default value unless you have a good reason not to.
  967. * @property {boolean} forceTransmux
  968. * If this is <code>true</code>, we will transmux AAC and TS content even if
  969. * not strictly necessary for the assets to be played. Shaka Player
  970. * currently only supports CEA 708 captions by transmuxing, so this value is
  971. * necessary for enabling them on platforms with native TS support like Edge
  972. * or Chromecast. This value defaults to <code>false</code>.
  973. * @property {number} safeSeekOffset
  974. * The amount of seconds that should be added when repositioning the playhead
  975. * after falling out of the availability window or seek. This gives the player
  976. * more time to buffer before falling outside again, but increases the forward
  977. * jump in the stream skipping more content. This is helpful for lower
  978. * bandwidth scenarios. Defaults to 5 if not provided.
  979. * @property {boolean} stallEnabled
  980. * When set to <code>true</code>, the stall detector logic will run. If the
  981. * playhead stops moving for <code>stallThreshold</code> seconds, the player
  982. * will either seek or pause/play to resolve the stall, depending on the value
  983. * of <code>stallSkip</code>.
  984. * @property {number} stallThreshold
  985. * The maximum number of seconds that may elapse without the playhead moving
  986. * (when playback is expected) before it will be labeled as a stall.
  987. * @property {number} stallSkip
  988. * The number of seconds that the player will skip forward when a stall has
  989. * been detected. If 0, the player will pause and immediately play instead of
  990. * seeking. A value of 0 is recommended and provided as default on TV
  991. * platforms (WebOS, Tizen, Chromecast, etc).
  992. * @property {boolean} useNativeHlsOnSafari
  993. * Desktop Safari has both MediaSource and their native HLS implementation.
  994. * Depending on the application's needs, it may prefer one over the other.
  995. * Warning when disabled: Where single-key DRM streams work fine, multi-keys
  996. * streams is showing unexpected behaviours (stall, audio playing with video
  997. * freezes, ...). Use with care.
  998. * @property {number} inaccurateManifestTolerance
  999. * The maximum difference, in seconds, between the times in the manifest and
  1000. * the times in the segments. Larger values allow us to compensate for more
  1001. * drift (up to one segment duration). Smaller values reduce the incidence of
  1002. * extra segment requests necessary to compensate for drift.
  1003. * @property {boolean} lowLatencyMode
  1004. * If <code>true</code>, low latency streaming mode is enabled. If
  1005. * lowLatencyMode is set to true, inaccurateManifestTolerance is set to 0
  1006. * unless specified, and rebufferingGoal to 0.01 unless specified at the same
  1007. * time.
  1008. * @property {boolean} autoLowLatencyMode
  1009. * If the stream is low latency and the user has not configured the
  1010. * lowLatencyMode, but if it has been configured to activate the
  1011. * lowLatencyMode if a stream of this type is detected, we automatically
  1012. * activate the lowLatencyMode. Defaults to false.
  1013. * @property {boolean} forceHTTPS
  1014. * If true, if the protocol is HTTP change it to HTTPs.
  1015. * @property {boolean} preferNativeHls
  1016. * If true, prefer native HLS playback when possible, regardless of platform.
  1017. * @property {number} updateIntervalSeconds
  1018. * The minimum number of seconds to see if the manifest has changes.
  1019. * @property {boolean} dispatchAllEmsgBoxes
  1020. * If true, all emsg boxes are parsed and dispatched.
  1021. * @property {boolean} observeQualityChanges
  1022. * If true, monitor media quality changes and emit
  1023. * <code.shaka.Player.MediaQualityChangedEvent</code>.
  1024. * @property {number} maxDisabledTime
  1025. * The maximum time a variant can be disabled when NETWORK HTTP_ERROR
  1026. * is reached, in seconds.
  1027. * If all variants are disabled this way, NETWORK HTTP_ERROR will be thrown.
  1028. * @property {boolean} parsePrftBox
  1029. * If <code>true</code>, will raise a shaka.extern.ProducerReferenceTime
  1030. * player event (event name 'prft').
  1031. * The event will be raised only once per playback session as program
  1032. * start date will not change, and would save parsing the segment multiple
  1033. * times needlessly.
  1034. * Defaults to <code>false</code>.
  1035. * @exportDoc
  1036. */
  1037. shaka.extern.StreamingConfiguration;
  1038. /**
  1039. * @typedef {{
  1040. * sourceBufferExtraFeatures: string
  1041. * }}
  1042. *
  1043. * @description
  1044. * Media source configuration.
  1045. *
  1046. * @property {string} sourceBufferExtraFeatures
  1047. * Some platforms may need to pass features when initializing the
  1048. * sourceBuffer.
  1049. * This string is ultimately appended to MIME types in addSourceBuffer().
  1050. * @exportDoc
  1051. */
  1052. shaka.extern.MediaSourceConfiguration;
  1053. /**
  1054. * @typedef {{
  1055. * enabled: boolean,
  1056. * useNetworkInformation: boolean,
  1057. * defaultBandwidthEstimate: number,
  1058. * restrictions: shaka.extern.Restrictions,
  1059. * switchInterval: number,
  1060. * bandwidthUpgradeTarget: number,
  1061. * bandwidthDowngradeTarget: number,
  1062. * advanced: shaka.extern.AdvancedAbrConfiguration,
  1063. * restrictToElementSize: boolean,
  1064. * restrictToScreenSize: boolean,
  1065. * ignoreDevicePixelRatio: boolean
  1066. * }}
  1067. *
  1068. * @property {boolean} enabled
  1069. * If true, enable adaptation by the current AbrManager. Defaults to true.
  1070. * @property {boolean} useNetworkInformation
  1071. * If true, use Network Information API in the current AbrManager.
  1072. * Defaults to true.
  1073. * @property {number} defaultBandwidthEstimate
  1074. * The default bandwidth estimate to use if there is not enough data, in
  1075. * bit/sec.
  1076. * @property {shaka.extern.Restrictions} restrictions
  1077. * The restrictions to apply to ABR decisions. These are "soft" restrictions.
  1078. * Any track that fails to meet these restrictions will not be selected
  1079. * automatically, but will still appear in the track list and can still be
  1080. * selected via <code>selectVariantTrack()</code>. If no tracks meet these
  1081. * restrictions, AbrManager should not fail, but choose a low-res or
  1082. * low-bandwidth variant instead. It is the responsibility of AbrManager
  1083. * implementations to follow these rules and implement this behavior.
  1084. * @property {number} switchInterval
  1085. * The minimum amount of time that must pass between switches, in
  1086. * seconds. This keeps us from changing too often and annoying the user.
  1087. * @property {number} bandwidthUpgradeTarget
  1088. * The fraction of the estimated bandwidth which we should try to use when
  1089. * upgrading.
  1090. * @property {number} bandwidthDowngradeTarget
  1091. * The largest fraction of the estimated bandwidth we should use. We should
  1092. * downgrade to avoid this.
  1093. * @property {shaka.extern.AdvancedAbrConfiguration} advanced
  1094. * Advanced ABR configuration
  1095. * @property {boolean} restrictToElementSize
  1096. * If true, restrict the quality to media element size.
  1097. * Note: The use of ResizeObserver is required for it to work properly. If
  1098. * true without ResizeObserver, it behaves as false.
  1099. * Defaults false.
  1100. * @property {boolean} restrictToScreenSize
  1101. * If true, restrict the quality to screen size.
  1102. * Defaults false.
  1103. * @property {boolean} ignoreDevicePixelRatio
  1104. * If true,device pixel ratio is ignored when restricting the quality to
  1105. * media element size or screen size.
  1106. * Defaults false.
  1107. * @exportDoc
  1108. */
  1109. shaka.extern.AbrConfiguration;
  1110. /**
  1111. * @typedef {{
  1112. * minTotalBytes: number,
  1113. * minBytes: number,
  1114. * fastHalfLife: number,
  1115. * slowHalfLife: number
  1116. * }}
  1117. *
  1118. * @property {number} minTotalBytes
  1119. * Minimum number of bytes sampled before we trust the estimate. If we have
  1120. * not sampled much data, our estimate may not be accurate enough to trust.
  1121. * @property {number} minBytes
  1122. * Minimum number of bytes, under which samples are discarded. Our models
  1123. * do not include latency information, so connection startup time (time to
  1124. * first byte) is considered part of the download time. Because of this, we
  1125. * should ignore very small downloads which would cause our estimate to be
  1126. * too low.
  1127. * @property {number} fastHalfLife
  1128. * The quantity of prior samples (by weight) used when creating a new
  1129. * estimate, in seconds. Those prior samples make up half of the
  1130. * new estimate.
  1131. * @property {number} slowHalfLife
  1132. * The quantity of prior samples (by weight) used when creating a new
  1133. * estimate, in seconds. Those prior samples make up half of the
  1134. * new estimate.
  1135. * @exportDoc
  1136. */
  1137. shaka.extern.AdvancedAbrConfiguration;
  1138. /**
  1139. * @typedef {{
  1140. * enabled: boolean,
  1141. * useHeaders: boolean,
  1142. * sessionId: string,
  1143. * contentId: string
  1144. * }}
  1145. *
  1146. * @description
  1147. * Common Media Client Data (CMCD) configuration.
  1148. *
  1149. * @property {boolean} enabled
  1150. * If <code>true</code>, enable CMCD data to be sent with media requests.
  1151. * Defaults to <code>false</code>.
  1152. * @property {boolean} useHeaders
  1153. * If <code>true</code>, send CMCD data using the header transmission mode
  1154. * instead of query args. Defaults to <code>false</code>.
  1155. * @property {string} sessionId
  1156. * A GUID identifying the current playback session. A playback session
  1157. * typically ties together segments belonging to a single media asset.
  1158. * Maximum length is 64 characters. It is RECOMMENDED to conform to the UUID
  1159. * specification. By default the sessionId is automatically generated on each
  1160. * <code>load()</code> call.
  1161. * @property {string} contentId
  1162. * A unique string identifying the current content. Maximum length is 64
  1163. * characters. This value is consistent across multiple different sessions and
  1164. * devices and is defined and updated at the discretion of the service
  1165. * provider.
  1166. * @exportDoc
  1167. */
  1168. shaka.extern.CmcdConfiguration;
  1169. /**
  1170. * @typedef {{
  1171. * enabled: boolean,
  1172. * dynamicPerformanceScaling: boolean,
  1173. * logLevel: number,
  1174. * drawLogo: boolean
  1175. * }}
  1176. *
  1177. * @description
  1178. * Decoding for MPEG-5 Part2 LCEVC.
  1179. *
  1180. * @property {boolean} enabled
  1181. * If <code>true</code>, enable LCEVC.
  1182. * Defaults to <code>false</code>.
  1183. * @property {boolean} dynamicPerformanceScaling
  1184. * If <code>true</code>, LCEVC Dynamic Performance Scaling or dps is enabled
  1185. * to be triggered, when the system is not able to decode frames within a
  1186. * specific tolerance of the fps of the video and disables LCEVC decoding
  1187. * for some time. The base video will be shown upscaled to target resolution.
  1188. * If it is triggered again within a short period of time, the disabled
  1189. * time will be higher and if it is triggered three times in a row the LCEVC
  1190. * decoding will be disabled for that playback session.
  1191. * If dynamicPerformanceScaling is false, LCEVC decode will be forced
  1192. * and will drop frames appropriately if performance is sub optimal.
  1193. * Defaults to <code>true</code>.
  1194. * @property {number} logLevel
  1195. * Loglevel 0-5 for logging.
  1196. * NONE = 0
  1197. * ERROR = 1
  1198. * WARNING = 2
  1199. * INFO = 3
  1200. * DEBUG = 4
  1201. * VERBOSE = 5
  1202. * Defaults to <code>0</code>.
  1203. * @property {boolean} drawLogo
  1204. * If <code>true</code>, LCEVC Logo is placed on the top left hand corner
  1205. * which only appears when the LCEVC enhanced frames are being rendered.
  1206. * Defaults to true for the lib but is forced to false in this integration
  1207. * unless explicitly set to true through config.
  1208. * Defaults to <code>false</code>.
  1209. * @exportDoc
  1210. */
  1211. shaka.extern.LcevcConfiguration;
  1212. /**
  1213. * @typedef {{
  1214. * trackSelectionCallback:
  1215. * function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>,
  1216. * downloadSizeCallback: function(number):!Promise<boolean>,
  1217. * progressCallback: function(shaka.extern.StoredContent,number),
  1218. * usePersistentLicense: boolean,
  1219. * numberOfParallelDownloads: number
  1220. * }}
  1221. *
  1222. * @property {function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>}
  1223. * trackSelectionCallback
  1224. * Called inside <code>store()</code> to determine which tracks to save from a
  1225. * manifest. It is passed an array of Tracks from the manifest and it should
  1226. * return an array of the tracks to store.
  1227. * @property {function(number):!Promise<boolean>} downloadSizeCallback
  1228. * Called inside <code>store()</code> to determine if the content can be
  1229. * downloaded due to its estimated size. The estimated size of the download is
  1230. * passed and it must return if the download is allowed or not.
  1231. * @property {function(shaka.extern.StoredContent,number)} progressCallback
  1232. * Called inside <code>store()</code> to give progress info back to the app.
  1233. * It is given the current manifest being stored and the progress of it being
  1234. * stored.
  1235. * @property {boolean} usePersistentLicense
  1236. * If <code>true</code>, store protected content with a persistent license so
  1237. * that no network is required to view.
  1238. * If <code>false</code>, store protected content without a persistent
  1239. * license. A network will be required to retrieve a temporary license to
  1240. * view.
  1241. * Defaults to <code>true</code>.
  1242. * @property {number} numberOfParallelDownloads
  1243. * Number of parallel downloads.
  1244. * Note: normally browsers limit to 5 request in parallel, so putting a
  1245. * number higher than this will not help it download faster.
  1246. * Defaults to <code>5</code>.
  1247. * @exportDoc
  1248. */
  1249. shaka.extern.OfflineConfiguration;
  1250. /**
  1251. * @typedef {{
  1252. * autoShowText: shaka.config.AutoShowText,
  1253. * drm: shaka.extern.DrmConfiguration,
  1254. * manifest: shaka.extern.ManifestConfiguration,
  1255. * streaming: shaka.extern.StreamingConfiguration,
  1256. * mediaSource: shaka.extern.MediaSourceConfiguration,
  1257. * abrFactory: shaka.extern.AbrManager.Factory,
  1258. * abr: shaka.extern.AbrConfiguration,
  1259. * cmcd: shaka.extern.CmcdConfiguration,
  1260. * lcevc: shaka.extern.LcevcConfiguration,
  1261. * offline: shaka.extern.OfflineConfiguration,
  1262. * preferredAudioLanguage: string,
  1263. * preferredTextLanguage: string,
  1264. * preferredVariantRole: string,
  1265. * preferredTextRole: string,
  1266. * preferredVideoCodecs: !Array.<string>,
  1267. * preferredAudioCodecs: !Array.<string>,
  1268. * preferredAudioChannelCount: number,
  1269. * preferredDecodingAttributes: !Array.<string>,
  1270. * preferForcedSubs: boolean,
  1271. * restrictions: shaka.extern.Restrictions,
  1272. * playRangeStart: number,
  1273. * playRangeEnd: number,
  1274. * textDisplayFactory: shaka.extern.TextDisplayer.Factory
  1275. * }}
  1276. *
  1277. * @property {shaka.config.AutoShowText} autoShowText
  1278. * Controls behavior of auto-showing text tracks on load().
  1279. * @property {shaka.extern.DrmConfiguration} drm
  1280. * DRM configuration and settings.
  1281. * @property {shaka.extern.ManifestConfiguration} manifest
  1282. * Manifest configuration and settings.
  1283. * @property {shaka.extern.StreamingConfiguration} streaming
  1284. * Streaming configuration and settings.
  1285. * @property {shaka.extern.MediaSourceConfiguration} mediaSource
  1286. * Media source configuration and settings.
  1287. * @property {shaka.extern.AbrManager.Factory} abrFactory
  1288. * A factory to construct an abr manager.
  1289. * @property {shaka.extern.AbrConfiguration} abr
  1290. * ABR configuration and settings.
  1291. * @property {shaka.extern.CmcdConfiguration} cmcd
  1292. * CMCD configuration and settings. (Common Media Client Data)
  1293. * @property {shaka.extern.LcevcConfiguration} lcevc
  1294. * MPEG-5 LCEVC configuration and settings.
  1295. * (Low Complexity Enhancement Video Codec)
  1296. * @property {shaka.extern.OfflineConfiguration} offline
  1297. * Offline configuration and settings.
  1298. * @property {string} preferredAudioLanguage
  1299. * The preferred language to use for audio tracks. If not given it will use
  1300. * the <code>'main'</code> track.
  1301. * Changing this during playback will not affect the current playback.
  1302. * @property {string} preferredTextLanguage
  1303. * The preferred language to use for text tracks. If a matching text track
  1304. * is found, and the selected audio and text tracks have different languages,
  1305. * the text track will be shown.
  1306. * Changing this during playback will not affect the current playback.
  1307. * @property {string} preferredVariantRole
  1308. * The preferred role to use for variants.
  1309. * @property {string} preferredTextRole
  1310. * The preferred role to use for text tracks.
  1311. * @property {!Array.<string>} preferredVideoCodecs
  1312. * The list of preferred video codecs, in order of highest to lowest priority.
  1313. * @property {!Array.<string>} preferredAudioCodecs
  1314. * The list of preferred audio codecs, in order of highest to lowest priority.
  1315. * @property {number} preferredAudioChannelCount
  1316. * The preferred number of audio channels.
  1317. * @property {!Array.<string>} preferredDecodingAttributes
  1318. * The list of preferred attributes of decodingInfo, in the order of their
  1319. * priorities.
  1320. * @property {boolean} preferForcedSubs
  1321. * If true, a forced text track is preferred. Defaults to false.
  1322. * If the content has no forced captions and the value is true,
  1323. * no text track is chosen.
  1324. * Changing this during playback will not affect the current playback.
  1325. * @property {shaka.extern.Restrictions} restrictions
  1326. * The application restrictions to apply to the tracks. These are "hard"
  1327. * restrictions. Any track that fails to meet these restrictions will not
  1328. * appear in the track list. If no tracks meet these restrictions, playback
  1329. * will fail.
  1330. * @property {number} playRangeStart
  1331. * Optional playback and seek start time in seconds. Defaults to 0 if
  1332. * not provided.
  1333. * @property {number} playRangeEnd
  1334. * Optional playback and seek end time in seconds. Defaults to the end of
  1335. * the presentation if not provided.
  1336. * @property {shaka.extern.TextDisplayer.Factory} textDisplayFactory
  1337. * A factory to construct a text displayer. Note that, if this is changed
  1338. * during playback, it will cause the text tracks to be reloaded.
  1339. * @exportDoc
  1340. */
  1341. shaka.extern.PlayerConfiguration;
  1342. /**
  1343. * @typedef {{
  1344. * language: string,
  1345. * role: string,
  1346. * label: ?string
  1347. * }}
  1348. *
  1349. * @property {string} language
  1350. * The language code for the stream.
  1351. * @property {string} role
  1352. * The role name for the stream. If the stream has no role, <code>role</code>
  1353. * will be <code>''</code>.
  1354. * @property {?string} label
  1355. * The label of the audio stream, if it has one.
  1356. * @exportDoc
  1357. */
  1358. shaka.extern.LanguageRole;
  1359. /**
  1360. * @typedef {{
  1361. * imageHeight: number,
  1362. * imageWidth: number,
  1363. * height: number,
  1364. * positionX: number,
  1365. * positionY: number,
  1366. * startTime: number,
  1367. * duration: number,
  1368. * uris: !Array.<string>,
  1369. * width: number,
  1370. * sprite: boolean
  1371. * }}
  1372. *
  1373. * @property {number} imageHeight
  1374. * The image height in px. The image height could be different to height if
  1375. * the layout is different to 1x1.
  1376. * @property {number} imageWidth
  1377. * The image width in px. The image width could be different to width if
  1378. * the layout is different to 1x1.
  1379. * @property {number} height
  1380. * The thumbnail height in px.
  1381. * @property {number} positionX
  1382. * The thumbnail left position in px.
  1383. * @property {number} positionY
  1384. * The thumbnail top position in px.
  1385. * @property {number} startTime
  1386. * The start time of the thumbnail in the presentation timeline, in seconds.
  1387. * @property {number} duration
  1388. * The duration of the thumbnail, in seconds.
  1389. * @property {!Array.<string>} uris
  1390. * An array of URIs to attempt. They will be tried in the order they are
  1391. * given.
  1392. * @property {number} width
  1393. * The thumbnail width in px.
  1394. * @property {boolean} sprite
  1395. * Indicate if the thumbnail is a sprite.
  1396. * @exportDoc
  1397. */
  1398. shaka.extern.Thumbnail;
  1399. /**
  1400. * @typedef {{
  1401. * id: string,
  1402. * title: string,
  1403. * startTime: number,
  1404. * endTime: number
  1405. * }}
  1406. *
  1407. * @property {string} id
  1408. * The id of the chapter.
  1409. * @property {string} title
  1410. * The title of the chapter.
  1411. * @property {number} startTime
  1412. * The time that describes the beginning of the range of the chapter.
  1413. * @property {number} endTime
  1414. * The time that describes the end of the range of chapter.
  1415. * @exportDoc
  1416. */
  1417. shaka.extern.Chapter;