Source: lib/util/error.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2016 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. goog.provide('shaka.util.Error');
  7. /**
  8. * @summary
  9. * Describes an error that happened.
  10. *
  11. * @description
  12. * This uses numerical codes to describe
  13. * which error happened.
  14. *
  15. * Some error are caused by errors from the browser. In these cases, the error
  16. * object is provided as part of the <code>data</code> field. System codes come
  17. * from the browser and may or may not be documented. Here are some places
  18. * where the errors may be documented:
  19. * <ul>
  20. * <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaError">MediaError</a>
  21. * <li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status">HTTP Codes</a>
  22. * <li><a href="https://hresult.info">Edge/PlayReady errors</a>
  23. * </ul>
  24. *
  25. * @export
  26. * @implements {shaka.extern.Error}
  27. * @extends {Error}
  28. */
  29. shaka.util.Error = class {
  30. /**
  31. * @param {shaka.util.Error.Severity} severity
  32. * @param {shaka.util.Error.Category} category
  33. * @param {shaka.util.Error.Code} code
  34. * @param {...*} varArgs
  35. */
  36. constructor(severity, category, code, ...varArgs) {
  37. /**
  38. * @override
  39. * @exportInterface
  40. */
  41. this.severity = severity;
  42. /**
  43. * @override
  44. * @exportInterface
  45. */
  46. this.category = category;
  47. /**
  48. * @override
  49. * @exportInterface
  50. */
  51. this.code = code;
  52. /**
  53. * @override
  54. * @exportInterface
  55. */
  56. this.data = varArgs;
  57. /**
  58. * @override
  59. * @exportInterface
  60. */
  61. this.handled = false;
  62. // A basic message for compiled mode.
  63. let formattedMessage = 'Shaka Error ' + this.code;
  64. if (goog.DEBUG) {
  65. // This improves the formatting of Errors in failure messages in the
  66. // tests in debug mode.
  67. let categoryName = 'UNKNOWN';
  68. let codeName = 'UNKNOWN';
  69. for (const k in shaka.util.Error.Category) {
  70. if (shaka.util.Error.Category[k] == this.category) {
  71. categoryName = k;
  72. }
  73. }
  74. for (const k in shaka.util.Error.Code) {
  75. if (shaka.util.Error.Code[k] == this.code) {
  76. codeName = k;
  77. }
  78. }
  79. formattedMessage = 'Shaka Error ' + categoryName + '.' + codeName +
  80. ' (' + this.data.toString() + ')';
  81. }
  82. /**
  83. * In compiled mode, contains a basic message string with the error code.
  84. * In uncompiled and debug modes, contains a human-readable version of the
  85. * category and code as enums.
  86. *
  87. * @const {string}
  88. * @exportDoc
  89. */
  90. this.message = formattedMessage;
  91. if (shaka.util.Error.createStack) {
  92. try {
  93. throw new Error(this.message || 'Shaka Error');
  94. } catch (e) {
  95. /**
  96. * A stack-trace showing where the error occurred.
  97. *
  98. * @const {string}
  99. * @exportDoc
  100. */
  101. this.stack = e.stack;
  102. }
  103. }
  104. }
  105. /**
  106. * @return {string}
  107. * @override
  108. */
  109. toString() {
  110. return 'shaka.util.Error ' + JSON.stringify(this, null, ' ');
  111. }
  112. };
  113. /**
  114. * If true, create a stack trace in Error objects.
  115. *
  116. * Disabled in tests to avoid issues with karma-jasmine.
  117. * See comments in test/test/boot.js for details.
  118. *
  119. * @type {boolean}
  120. */
  121. shaka.util.Error.createStack = true;
  122. /**
  123. * @enum {number}
  124. * @export
  125. */
  126. shaka.util.Error.Severity = {
  127. /**
  128. * An error occurred, but the Player is attempting to recover from the error.
  129. *
  130. * If the Player cannot ultimately recover, it still may not throw a CRITICAL
  131. * error. For example, retrying for a media segment will never result in
  132. * a CRITICAL error (the Player will just retry forever).
  133. */
  134. 'RECOVERABLE': 1,
  135. /**
  136. * A critical error that the library cannot recover from. These usually cause
  137. * the Player to stop loading or updating. A new manifest must be loaded
  138. * to reset the library.
  139. */
  140. 'CRITICAL': 2,
  141. };
  142. /**
  143. * @enum {number}
  144. * @export
  145. */
  146. shaka.util.Error.Category = {
  147. /** Errors from the network stack. */
  148. 'NETWORK': 1,
  149. /** Errors parsing text streams. */
  150. 'TEXT': 2,
  151. /** Errors parsing or processing audio or video streams. */
  152. 'MEDIA': 3,
  153. /** Errors parsing the Manifest. */
  154. 'MANIFEST': 4,
  155. /** Errors related to streaming. */
  156. 'STREAMING': 5,
  157. /** Errors related to DRM. */
  158. 'DRM': 6,
  159. /** Miscellaneous errors from the player. */
  160. 'PLAYER': 7,
  161. /** Errors related to cast. */
  162. 'CAST': 8,
  163. /** Errors in the database storage (offline). */
  164. 'STORAGE': 9,
  165. /** Errors related to ad insertion. */
  166. 'ADS': 10,
  167. };
  168. /**
  169. * @enum {number}
  170. * @export
  171. */
  172. shaka.util.Error.Code = {
  173. /**
  174. * A network request was made using an unsupported URI scheme.
  175. * <br> error.data[0] is the URI.
  176. */
  177. 'UNSUPPORTED_SCHEME': 1000,
  178. /**
  179. * An HTTP network request returned an HTTP status that indicated a failure.
  180. * <br> error.data[0] is the URI.
  181. * <br> error.data[1] is the status code.
  182. * <br> error.data[2] is the response text, or null if the response could not
  183. * be interpreted as text.
  184. * <br> error.data[3] is the map of response headers.
  185. * <br> error.data[4] is the NetworkingEngine.RequestType of the request,
  186. * if one was provided.
  187. * <br> error.data[5] is the final URI. This may be different if the initial
  188. * URI (error.data[0]) issued a redirect.
  189. */
  190. 'BAD_HTTP_STATUS': 1001,
  191. /**
  192. * An HTTP network request failed with an error, but not from the server.
  193. * <br> error.data[0] is the URI.
  194. * <br> error.data[1] is the original error.
  195. * <br> error.data[2] is the NetworkingEngine.RequestType of the request.
  196. */
  197. 'HTTP_ERROR': 1002,
  198. /**
  199. * A network request timed out.
  200. * <br> error.data[0] is the URI.
  201. * <br> error.data[1] is the NetworkingEngine.RequestType of the request,
  202. * if one was provided.
  203. */
  204. 'TIMEOUT': 1003,
  205. /**
  206. * A network request was made with a malformed data URI.
  207. * <br> error.data[0] is the URI.
  208. */
  209. 'MALFORMED_DATA_URI': 1004,
  210. // RETIRED: 'UNKNOWN_DATA_URI_ENCODING': 1005,
  211. /**
  212. * A request filter threw an error.
  213. * <br> error.data[0] is the original error.
  214. */
  215. 'REQUEST_FILTER_ERROR': 1006,
  216. /**
  217. * A response filter threw an error.
  218. * <br> error.data[0] is the original error.
  219. */
  220. 'RESPONSE_FILTER_ERROR': 1007,
  221. /**
  222. * A testing network request was made with a malformed URI.
  223. * This error is only used by unit and integration tests.
  224. */
  225. 'MALFORMED_TEST_URI': 1008,
  226. /**
  227. * An unexpected network request was made to the FakeNetworkingEngine.
  228. * This error is only used by unit and integration tests.
  229. */
  230. 'UNEXPECTED_TEST_REQUEST': 1009,
  231. /**
  232. * The number of retry attempts have run out.
  233. * This is an internal error and shouldn't be propagated.
  234. */
  235. 'ATTEMPTS_EXHAUSTED': 1010,
  236. /**
  237. * The segment is missing.
  238. * <br> error.data[0] is the URI.
  239. */
  240. 'SEGMENT_MISSING': 1011,
  241. /** The text parser failed to parse a text stream due to an invalid header. */
  242. 'INVALID_TEXT_HEADER': 2000,
  243. /**
  244. * The text parser failed to parse a text stream due to an invalid cue.
  245. * <br> error.data[0] is extra context, if available.
  246. */
  247. 'INVALID_TEXT_CUE': 2001,
  248. // RETIRED: 'INVALID_TEXT_SETTINGS': 2002,
  249. /**
  250. * Was unable to detect the encoding of the response text. Suggest adding
  251. * byte-order-markings to the response data.
  252. */
  253. 'UNABLE_TO_DETECT_ENCODING': 2003,
  254. /** The response data contains invalid Unicode character encoding. */
  255. 'BAD_ENCODING': 2004,
  256. /**
  257. * The XML parser failed to parse an xml stream, or the XML lacks mandatory
  258. * elements for TTML.
  259. * <br> error.data[0] is extra context, if available.
  260. */
  261. 'INVALID_XML': 2005,
  262. // RETIRED: 'INVALID_TTML': 2006,
  263. /**
  264. * MP4 segment does not contain TTML.
  265. */
  266. 'INVALID_MP4_TTML': 2007,
  267. /**
  268. * MP4 segment does not contain VTT.
  269. */
  270. 'INVALID_MP4_VTT': 2008,
  271. /**
  272. * When examining media in advance, we were unable to extract the cue time.
  273. * This should only be possible with HLS, where we do not have explicit
  274. * segment start times.
  275. * <br> error.data[0] is the underlying exception or Error object.
  276. */
  277. 'UNABLE_TO_EXTRACT_CUE_START_TIME': 2009,
  278. /**
  279. * MP4 segment for CEA data is invalid.
  280. */
  281. 'INVALID_MP4_CEA': 2010,
  282. /**
  283. * Unable to guess mime type of the text.
  284. * <br> error.data[0] is the text file's uri.
  285. */
  286. 'TEXT_COULD_NOT_GUESS_MIME_TYPE': 2011,
  287. /**
  288. * External text tracks cannot be added in src= because native platform
  289. * doesn't support it.
  290. */
  291. 'CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS': 2012,
  292. /**
  293. * Only WebVTT is supported when using src=.
  294. * <br> error.data[0] is the text MIME type.
  295. */
  296. 'TEXT_ONLY_WEBVTT_SRC_EQUALS': 2013,
  297. /**
  298. * The compilation does not contain a required text plugin for this
  299. * operation.
  300. * <br> error.data[0] is the text MIME type.
  301. */
  302. 'MISSING_TEXT_PLUGIN': 2014,
  303. // RETIRED: 'CHAPTERS_TRACK_FAILED': 2015,
  304. // RETIRED: 'CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_SRC_EQUALS': 2016,
  305. /**
  306. * Only external urls of WebVTT type are supported.
  307. * <br> error.data[0] is the uri.
  308. */
  309. 'UNSUPPORTED_EXTERNAL_THUMBNAILS_URI': 2017,
  310. /**
  311. * Some component tried to read past the end of a buffer. The segment index,
  312. * init segment, or PSSH may be malformed.
  313. */
  314. 'BUFFER_READ_OUT_OF_BOUNDS': 3000,
  315. /**
  316. * Some component tried to parse an integer that was too large to fit in a
  317. * JavaScript number without rounding error. JavaScript can only natively
  318. * represent integers up to 53 bits.
  319. */
  320. 'JS_INTEGER_OVERFLOW': 3001,
  321. /**
  322. * The EBML parser used to parse the WebM container encountered an integer,
  323. * ID, or other field larger than the maximum supported by the parser.
  324. */
  325. 'EBML_OVERFLOW': 3002,
  326. /**
  327. * The EBML parser used to parse the WebM container encountered a floating-
  328. * point field of a size not supported by the parser.
  329. */
  330. 'EBML_BAD_FLOATING_POINT_SIZE': 3003,
  331. /**
  332. * The MP4 SIDX parser found the wrong box type.
  333. * Either the segment index range is incorrect or the data is corrupt.
  334. */
  335. 'MP4_SIDX_WRONG_BOX_TYPE': 3004,
  336. /**
  337. * The MP4 SIDX parser encountered an invalid timescale.
  338. * The segment index data may be corrupt.
  339. */
  340. 'MP4_SIDX_INVALID_TIMESCALE': 3005,
  341. /** The MP4 SIDX parser encountered a type of SIDX that is not supported. */
  342. 'MP4_SIDX_TYPE_NOT_SUPPORTED': 3006,
  343. /**
  344. * The WebM Cues parser was unable to locate the Cues element.
  345. * The segment index data may be corrupt.
  346. */
  347. 'WEBM_CUES_ELEMENT_MISSING': 3007,
  348. /**
  349. * The WebM header parser was unable to locate the Ebml element.
  350. * The init segment data may be corrupt.
  351. */
  352. 'WEBM_EBML_HEADER_ELEMENT_MISSING': 3008,
  353. /**
  354. * The WebM header parser was unable to locate the Segment element.
  355. * The init segment data may be corrupt.
  356. */
  357. 'WEBM_SEGMENT_ELEMENT_MISSING': 3009,
  358. /**
  359. * The WebM header parser was unable to locate the Info element.
  360. * The init segment data may be corrupt.
  361. */
  362. 'WEBM_INFO_ELEMENT_MISSING': 3010,
  363. /**
  364. * The WebM header parser was unable to locate the Duration element.
  365. * The init segment data may be corrupt or may have been incorrectly encoded.
  366. * Shaka requires a duration in WebM DASH content.
  367. */
  368. 'WEBM_DURATION_ELEMENT_MISSING': 3011,
  369. /**
  370. * The WebM Cues parser was unable to locate the Cue Track Positions element.
  371. * The segment index data may be corrupt.
  372. */
  373. 'WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING': 3012,
  374. /**
  375. * The WebM Cues parser was unable to locate the Cue Time element.
  376. * The segment index data may be corrupt.
  377. */
  378. 'WEBM_CUE_TIME_ELEMENT_MISSING': 3013,
  379. /**
  380. * A MediaSource operation failed.
  381. * <br> error.data[0] is a MediaError code from the video element.
  382. * <br> error.data[1] is the segment URI that triggered the error, if any.
  383. */
  384. 'MEDIA_SOURCE_OPERATION_FAILED': 3014,
  385. /**
  386. * A MediaSource operation threw an exception.
  387. * <br> error.data[0] is the exception that was thrown.
  388. * <br> error.data[1] is the error object from the video element.
  389. * <br> error.data[2] is the segment URI that triggered the error, if any.
  390. */
  391. 'MEDIA_SOURCE_OPERATION_THREW': 3015,
  392. /**
  393. * The video element reported an error.
  394. * <br> error.data[0] is a MediaError code from the video element.
  395. * <br> On Edge, error.data[1] is a Microsoft extended error code in hex.
  396. * <br> On Chrome, error.data[2] is a string with details on the error.
  397. * <br> See top of file for links to browser error codes.
  398. */
  399. 'VIDEO_ERROR': 3016,
  400. /**
  401. * A MediaSource operation threw QuotaExceededError and recovery failed. The
  402. * content cannot be played correctly because the segments are too large for
  403. * the browser/platform. This may occur when attempting to play very high
  404. * quality, very high bitrate content on low-end devices.
  405. * <br> error.data[0] is the type of content which caused the error.
  406. */
  407. 'QUOTA_EXCEEDED_ERROR': 3017,
  408. /**
  409. * Transmuxing with our internal transmuxer failed.
  410. * <br> error.data[0] is the segment URI that triggered the error, if any.
  411. */
  412. 'TRANSMUXING_FAILED': 3018,
  413. /**
  414. * Content transformations required by the platform could not be performed for
  415. * some reason (unsupported container, etc.)
  416. * <br> @see https://github.com/shaka-project/shaka-player/issues/2759
  417. * <br> error.data[0] is the segment URI that triggered the error, if any.
  418. */
  419. 'CONTENT_TRANSFORMATION_FAILED': 3019,
  420. /**
  421. * Important data is missing to be able to do the transmuxing of MSS.
  422. * <br> error.data[0] is the segment URI that triggered the error, if any.
  423. */
  424. 'MSS_MISSING_DATA_FOR_TRANSMUXING': 3020,
  425. // RETIRED: 'MSS_TRANSMUXING_CODEC_UNKNOWN': 3021,
  426. /**
  427. * MSS transmuxing failed for unknown reason.
  428. * <br> error.data[0] is the segment URI that triggered the error, if any.
  429. */
  430. 'MSS_TRANSMUXING_FAILED': 3022,
  431. /**
  432. * An internal error which indicates that transmuxing operation has no video
  433. * data. This should not be seen by applications.
  434. * <br> error.data[0] is the segment URI that triggered the error, if any.
  435. */
  436. 'TRANSMUXING_NO_VIDEO_DATA': 3023,
  437. /**
  438. * A MediaSource operation is not allowed because the streaming is not
  439. * allowed.
  440. * <br> error.data[0] is the type of content which caused the error.
  441. */
  442. 'STREAMING_NOT_ALLOWED': 3024,
  443. /**
  444. * The Player was unable to guess the manifest type based on file extension
  445. * or MIME type. To fix, try one of the following:
  446. * <br><ul>
  447. * <li>Rename the manifest so that the URI ends in a well-known extension.
  448. * <li>Configure the server to send a recognizable Content-Type header.
  449. * <li>Configure the server to accept a HEAD request for the manifest.
  450. * </ul>
  451. * <br> error.data[0] is the manifest URI.
  452. * <br> error.data[1] is the detected or specified MIME type.
  453. */
  454. 'UNABLE_TO_GUESS_MANIFEST_TYPE': 4000,
  455. /**
  456. * The DASH Manifest contained invalid XML markup.
  457. * <br> error.data[0] is the URI associated with the XML.
  458. */
  459. 'DASH_INVALID_XML': 4001,
  460. /**
  461. * The DASH Manifest contained a Representation with insufficient segment
  462. * information.
  463. */
  464. 'DASH_NO_SEGMENT_INFO': 4002,
  465. /** The DASH Manifest contained an AdaptationSet with no Representations. */
  466. 'DASH_EMPTY_ADAPTATION_SET': 4003,
  467. /** The DASH Manifest contained an Period with no AdaptationSets. */
  468. 'DASH_EMPTY_PERIOD': 4004,
  469. /**
  470. * The DASH Manifest does not specify an init segment with a WebM container.
  471. */
  472. 'DASH_WEBM_MISSING_INIT': 4005,
  473. /** The DASH Manifest contained an unsupported container format. */
  474. 'DASH_UNSUPPORTED_CONTAINER': 4006,
  475. /** The embedded PSSH data has invalid encoding. */
  476. 'DASH_PSSH_BAD_ENCODING': 4007,
  477. /**
  478. * There is an AdaptationSet whose Representations do not have any common
  479. * key-systems.
  480. */
  481. 'DASH_NO_COMMON_KEY_SYSTEM': 4008,
  482. /** Having multiple key IDs per Representation is not supported. */
  483. 'DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED': 4009,
  484. /** The DASH Manifest specifies conflicting key IDs. */
  485. 'DASH_CONFLICTING_KEY_IDS': 4010,
  486. // RETIRED: 'UNPLAYABLE_PERIOD': 4011,
  487. /**
  488. * There exist some streams that could be decoded, but restrictions imposed
  489. * by the application or the key system prevent us from playing. This may
  490. * happen under the following conditions:
  491. * <ul>
  492. * <li>The application has given restrictions to the Player that restrict
  493. * at least one content type completely (e.g. no playable audio).
  494. * <li>The manifest specifies different keys than were given to us from the
  495. * license server.
  496. * <li>The key system has imposed output restrictions that cannot be met
  497. * (such as HDCP) and there are no unrestricted alternatives.
  498. * </ul>
  499. * <br> error.data[0] is a {@link shaka.extern.RestrictionInfo} object
  500. * describing the kinds of restrictions that caused this error.
  501. */
  502. 'RESTRICTIONS_CANNOT_BE_MET': 4012,
  503. // RETIRED: 'INTERNAL_ERROR_KEY_STATUS': 4013,
  504. // RETIRED: 'NO_PERIODS': 4014,
  505. /**
  506. * HLS playlist doesn't start with a mandatory #EXTM3U tag.
  507. */
  508. 'HLS_PLAYLIST_HEADER_MISSING': 4015,
  509. /**
  510. * HLS tag has an invalid name that doesn't start with '#EXT'
  511. * <br> error.data[0] is the invalid tag.
  512. */
  513. 'INVALID_HLS_TAG': 4016,
  514. /**
  515. * HLS playlist has both Master and Media/Segment tags.
  516. */
  517. 'HLS_INVALID_PLAYLIST_HIERARCHY': 4017,
  518. /**
  519. * A Representation has an id that is the same as another Representation in
  520. * the same Period. This makes manifest updates impossible since we cannot
  521. * map the updated Representation to the old one.
  522. */
  523. 'DASH_DUPLICATE_REPRESENTATION_ID': 4018,
  524. // RETIRED: 'HLS_MEDIA_INIT_SECTION_INFO_MISSING': 4019,
  525. /**
  526. * HLS manifest has several #EXT-X-MAP tags. We can only
  527. * support one at the moment.
  528. */
  529. 'HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND': 4020,
  530. // RETIRED: 'HLS_COULD_NOT_GUESS_MIME_TYPE': 4021,
  531. // RETIRED: 'HLS_MASTER_PLAYLIST_NOT_PROVIDED': 4022,
  532. /**
  533. * One of the required attributes was not provided, so the
  534. * HLS manifest is invalid.
  535. * <br> error.data[0] is the missing attribute's name.
  536. */
  537. 'HLS_REQUIRED_ATTRIBUTE_MISSING': 4023,
  538. /**
  539. * One of the required tags was not provided, so the
  540. * HLS manifest is invalid.
  541. * <br> error.data[0] is the missing tag's name.
  542. */
  543. 'HLS_REQUIRED_TAG_MISSING': 4024,
  544. /**
  545. * The HLS parser was unable to guess codecs of a stream.
  546. * <br> error.data[0] is the list of all codecs for the variant.
  547. */
  548. 'HLS_COULD_NOT_GUESS_CODECS': 4025,
  549. /**
  550. * The HLS parser has encountered encrypted content with unsupported
  551. * KEYFORMAT attributes.
  552. */
  553. 'HLS_KEYFORMATS_NOT_SUPPORTED': 4026,
  554. /**
  555. * The manifest parser only supports xlink links with xlink:actuate="onLoad".
  556. */
  557. 'DASH_UNSUPPORTED_XLINK_ACTUATE': 4027,
  558. /**
  559. * The manifest parser has hit its depth limit on xlink link chains.
  560. */
  561. 'DASH_XLINK_DEPTH_LIMIT': 4028,
  562. // RETIRED: 'HLS_LIVE_CONTENT_NOT_SUPPORTED': 4029,
  563. // RETIRED: 'HLS_COULD_NOT_PARSE_SEGMENT_START_TIME': 4030,
  564. // RETIRED: 'HLS_MEDIA_SEQUENCE_REQUIRED_IN_LIVE_STREAMS': 4031,
  565. /**
  566. * The content container or codecs are not supported by this browser. For
  567. * example, this could happen if the content is WebM, but your browser does
  568. * not support the WebM container, or if the content uses HEVC, but your
  569. * browser does not support the HEVC codec. This can also occur for
  570. * multi codec or multi container manifests if none of the codecs
  571. * or containers are supported by the browser.
  572. *
  573. * To see what your browser supports, you can check the JSON data dumped by
  574. * http://support.shaka-player-demo.appspot.com/
  575. */
  576. 'CONTENT_UNSUPPORTED_BY_BROWSER': 4032,
  577. /**
  578. * External text tracks cannot be added to live streams.
  579. */
  580. 'CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM': 4033,
  581. // RETIRED: 'HLS_AES_128_ENCRYPTION_NOT_SUPPORTED': 4034,
  582. // RETIRED: 'HLS_INTERNAL_SKIP_STREAM': 4035,
  583. /** The Manifest contained no Variants. */
  584. 'NO_VARIANTS': 4036,
  585. /**
  586. * We failed to find matching streams across DASH Periods, and the
  587. * period-flattening algorithm introduced in v3.0 has failed.
  588. */
  589. 'PERIOD_FLATTENING_FAILED': 4037,
  590. /**
  591. * We failed to find matching streams across DASH Periods due to inconsistent
  592. * DRM systems across periods.
  593. */
  594. 'INCONSISTENT_DRM_ACROSS_PERIODS': 4038,
  595. /**
  596. * The HLS manifest refers to an undeclared variables.
  597. * <br> error.data[0] is the variable undeclared.
  598. */
  599. 'HLS_VARIABLE_NOT_FOUND': 4039,
  600. /**
  601. * We do not support playing encrypted mp2t with MSE
  602. */
  603. 'HLS_MSE_ENCRYPTED_MP2T_NOT_SUPPORTED': 4040,
  604. /**
  605. * We do not support playing encrypted content (different than mp2t) with MSE
  606. * and legacy Apple MediaKeys API.
  607. */
  608. 'HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED': 4041,
  609. /**
  610. * Web Crypto API is not available (to decrypt AES-128 streams). Web Crypto
  611. * only exists in secure origins like https.
  612. */
  613. 'NO_WEB_CRYPTO_API': 4042,
  614. // RETIRED: 'HLS_AES_128_INVALID_IV_LENGTH': 4043,
  615. // RETIRED: 'HLS_AES_128_INVALID_KEY_LENGTH': 4044,
  616. /**
  617. * External thumbnails tracks cannot be added to live streams.
  618. */
  619. 'CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_LIVE_STREAM': 4045,
  620. /**
  621. * The MSS Manifest contained invalid XML markup.
  622. * <br> error.data[0] is the URI associated with the XML.
  623. */
  624. 'MSS_INVALID_XML': 4046,
  625. /**
  626. * MSS parser encountered a live playlist.
  627. */
  628. 'MSS_LIVE_CONTENT_NOT_SUPPORTED': 4047,
  629. /**
  630. * AES-128 iv length should be 16 bytes.
  631. */
  632. 'AES_128_INVALID_IV_LENGTH': 4048,
  633. /**
  634. * AES-128 encryption key length should be 16 bytes.
  635. */
  636. 'AES_128_INVALID_KEY_LENGTH': 4049,
  637. /**
  638. * The DASH Manifest specifies conflicting AES-128 keys.
  639. */
  640. 'DASH_CONFLICTING_AES_128': 4050,
  641. /**
  642. * The DASH Manifest specifies a unsupported AES-128 encryption.
  643. */
  644. 'DASH_UNSUPPORTED_AES_128': 4051,
  645. /**
  646. * Patch requested during an update did not match original manifest.
  647. */
  648. 'DASH_INVALID_PATCH': 4052,
  649. /**
  650. * The media playlist has not segments or all segments are gap.
  651. */
  652. 'HLS_EMPTY_MEDIA_PLAYLIST': 4053,
  653. /**
  654. * We do not support playing encrypted content with MSE
  655. * and legacy Apple MediaKeys API.
  656. */
  657. 'DASH_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED': 4054,
  658. /**
  659. * External chapters cannot be added to live streams.
  660. */
  661. 'CANNOT_ADD_EXTERNAL_CHAPTERS_TO_LIVE_STREAM': 4054,
  662. // RETIRED: 'INCONSISTENT_BUFFER_STATE': 5000,
  663. // RETIRED: 'INVALID_SEGMENT_INDEX': 5001,
  664. // RETIRED: 'SEGMENT_DOES_NOT_EXIST': 5002,
  665. // RETIRED: 'CANNOT_SATISFY_BYTE_LIMIT': 5003,
  666. // RETIRED: 'BAD_SEGMENT': 5004,
  667. // RETIRED: 'INVALID_STREAMS_CHOSEN': 5005,
  668. /**
  669. * This would only happen if StreamingEngine were not started correctly, and
  670. * should not be seen in production.
  671. */
  672. 'STREAMING_ENGINE_STARTUP_INVALID_STATE': 5006,
  673. /**
  674. * The manifest indicated protected content, but the manifest parser was
  675. * unable to determine what key systems should be used.
  676. */
  677. 'NO_RECOGNIZED_KEY_SYSTEMS': 6000,
  678. /**
  679. * None of the requested key system configurations are available. This may
  680. * happen under the following conditions:
  681. * <ul>
  682. * <li> The key system is not supported.
  683. * <li> The key system does not support the features requested (e.g.
  684. * persistent state).
  685. * <li> A user prompt was shown and the user denied access.
  686. * <li> The key system is not available from unsecure contexts. (i.e.
  687. requires HTTPS) See https://bit.ly/2K9X1nY
  688. * </ul>
  689. */
  690. 'REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE': 6001,
  691. /**
  692. * The browser found one of the requested key systems, but it failed to
  693. * create an instance of the CDM for some unknown reason.
  694. * <br> error.data[0] is an error message string from the browser.
  695. */
  696. 'FAILED_TO_CREATE_CDM': 6002,
  697. /**
  698. * The browser found one of the requested key systems and created an instance
  699. * of the CDM, but it failed to attach the CDM to the video for some unknown
  700. * reason.
  701. * <br> error.data[0] is an error message string from the browser.
  702. */
  703. 'FAILED_TO_ATTACH_TO_VIDEO': 6003,
  704. /**
  705. * The CDM rejected the server certificate supplied by the application.
  706. * The certificate may be malformed or in an unsupported format.
  707. * <br> error.data[0] is an error message string from the browser.
  708. */
  709. 'INVALID_SERVER_CERTIFICATE': 6004,
  710. /**
  711. * The CDM refused to create a session for some unknown reason.
  712. * <br> error.data[0] is an error message string from the browser.
  713. */
  714. 'FAILED_TO_CREATE_SESSION': 6005,
  715. /**
  716. * The CDM was unable to generate a license request for the init data it was
  717. * given. The init data may be malformed or in an unsupported format.
  718. * <br> error.data[0] is an error message string from the browser.
  719. * <br> error.data[1] is the error object from the browser.
  720. * <br> error.data[2] is a string with the extended error code, if available.
  721. * <br> See top of file for links to browser error codes.
  722. */
  723. 'FAILED_TO_GENERATE_LICENSE_REQUEST': 6006,
  724. /**
  725. * The license request failed. This could be a timeout, a network failure, or
  726. * a rejection by the server.
  727. * <br> error.data[0] is a shaka.util.Error from the networking engine.
  728. */
  729. 'LICENSE_REQUEST_FAILED': 6007,
  730. /**
  731. * The license response was rejected by the CDM. The server's response may be
  732. * invalid or malformed for this CDM.
  733. * <br> error.data[0] is an error message string from the browser.
  734. * <br> See top of file for links to browser error codes.
  735. */
  736. 'LICENSE_RESPONSE_REJECTED': 6008,
  737. // RETIRED: 'NO_LICENSE_SERVER_SPECIFIED': 6009,
  738. /**
  739. * The manifest does not specify any DRM info, but the content is encrypted.
  740. * Either the manifest or the manifest parser are broken.
  741. */
  742. 'ENCRYPTED_CONTENT_WITHOUT_DRM_INFO': 6010,
  743. // RETIRED: 'WRONG_KEYS': 6011,
  744. /**
  745. * No license server was given for the key system signaled by the manifest.
  746. * A license server URI is required for every key system.
  747. * <br> error.data[0] is the key system identifier.
  748. */
  749. 'NO_LICENSE_SERVER_GIVEN': 6012,
  750. /**
  751. * A required offline session was removed. The content might not be playable
  752. * depending of the playback context.
  753. */
  754. 'OFFLINE_SESSION_REMOVED': 6013,
  755. /**
  756. * The license has expired. This is triggered when all keys in the key
  757. * status map have a status of 'expired'.
  758. */
  759. 'EXPIRED': 6014,
  760. /**
  761. * A server certificate wasn't given when it is required. FairPlay requires
  762. * setting an explicit server certificate in the configuration.
  763. */
  764. 'SERVER_CERTIFICATE_REQUIRED': 6015,
  765. /**
  766. * An error was thrown while executing the init data transformation.
  767. * <br> error.data[0] is the original error.
  768. */
  769. 'INIT_DATA_TRANSFORM_ERROR': 6016,
  770. /**
  771. * The server certificate request failed.
  772. * <br> error.data[0] is a shaka.util.Error from the networking engine.
  773. */
  774. 'SERVER_CERTIFICATE_REQUEST_FAILED': 6017,
  775. /**
  776. * The HDCP version does not meet the requirements.
  777. */
  778. 'MIN_HDCP_VERSION_NOT_MATCH': 6018,
  779. /**
  780. * Error when checking HDCP version.
  781. * <br> error.data[0] is an error message string from the browser.
  782. */
  783. 'ERROR_CHECKING_HDCP_VERSION': 6019,
  784. /**
  785. * The browser does not support EME APIs, so DRM content cannot be played.
  786. */
  787. 'MISSING_EME_SUPPORT': 6020,
  788. /**
  789. * The call to Player.load() was interrupted by a call to Player.unload()
  790. * or another call to Player.load().
  791. */
  792. 'LOAD_INTERRUPTED': 7000,
  793. /**
  794. * An internal error which indicates that an operation was aborted. This
  795. * should not be seen by applications.
  796. */
  797. 'OPERATION_ABORTED': 7001,
  798. /**
  799. * The call to Player.load() failed because the Player does not have a video
  800. * element. The video element must either be provided to the constructor or
  801. * to Player.attach() before Player.load() is called.
  802. */
  803. 'NO_VIDEO_ELEMENT': 7002,
  804. /**
  805. * The operation failed because the object has been destroyed.
  806. */
  807. 'OBJECT_DESTROYED': 7003,
  808. /**
  809. * The content has not been loaded in the Player.
  810. */
  811. 'CONTENT_NOT_LOADED': 7004,
  812. /**
  813. * The call to preload failed, due to being called on src= content.
  814. */
  815. 'SRC_EQUALS_PRELOAD_NOT_SUPPORTED': 7005,
  816. /**
  817. * The operation failed because the preload has been destroyed. This can
  818. * happen by reusing the same preload in multiple load calls.
  819. */
  820. 'PRELOAD_DESTROYED': 7006,
  821. /**
  822. * The Cast API is unavailable. This may be because of one of the following:
  823. * 1. The browser may not have Cast support
  824. * 2. The browser may be missing a necessary Cast extension
  825. * 3. The Cast sender library may not be loaded in your app
  826. */
  827. 'CAST_API_UNAVAILABLE': 8000,
  828. /**
  829. * No cast receivers are available at this time.
  830. */
  831. 'NO_CAST_RECEIVERS': 8001,
  832. /**
  833. * The library is already casting.
  834. */
  835. 'ALREADY_CASTING': 8002,
  836. /**
  837. * A Cast SDK error that we did not explicitly plan for has occurred.
  838. * Check data[0] and refer to the Cast SDK documentation for details.
  839. * <br> error.data[0] is an error object from the Cast SDK.
  840. */
  841. 'UNEXPECTED_CAST_ERROR': 8003,
  842. /**
  843. * The cast operation was canceled by the user.
  844. * <br> error.data[0] is an error object from the Cast SDK.
  845. */
  846. 'CAST_CANCELED_BY_USER': 8004,
  847. /**
  848. * The cast connection timed out.
  849. * <br> error.data[0] is an error object from the Cast SDK.
  850. */
  851. 'CAST_CONNECTION_TIMED_OUT': 8005,
  852. /**
  853. * The requested receiver app ID does not exist or is unavailable.
  854. * Check the requested app ID for typos.
  855. * <br> error.data[0] is an error object from the Cast SDK.
  856. */
  857. 'CAST_RECEIVER_APP_UNAVAILABLE': 8006,
  858. // RETIRED: CAST_RECEIVER_APP_ID_MISSING': 8007,
  859. /**
  860. * Offline storage is not supported on this browser; it is required for
  861. * offline support.
  862. */
  863. 'STORAGE_NOT_SUPPORTED': 9000,
  864. /**
  865. * An unknown error occurred in the IndexedDB.
  866. * <br> On Firefox, one common source for UnknownError calls is reverting
  867. * Firefox to an old version. This makes the IndexedDB storage inaccessible
  868. * for older versions. The only way to fix this is to delete the storage
  869. * data in your profile. See https://mzl.la/2yCGWCm
  870. * <br> error.data[0] is the error object.
  871. */
  872. 'INDEXED_DB_ERROR': 9001,
  873. /**
  874. * The storage operation was aborted. Deprecated in favor of more general
  875. * OPERATION_ABORTED.
  876. */
  877. 'DEPRECATED_OPERATION_ABORTED': 9002,
  878. /**
  879. * The specified item was not found in the IndexedDB.
  880. * <br> error.data[0] is the offline URI.
  881. */
  882. 'REQUESTED_ITEM_NOT_FOUND': 9003,
  883. /**
  884. * A network request was made with a malformed offline URI.
  885. * <br> error.data[0] is the URI.
  886. */
  887. 'MALFORMED_OFFLINE_URI': 9004,
  888. /**
  889. * The specified content is live or in-progress.
  890. * Live and in-progress streams cannot be stored offline.
  891. * <br> error.data[0] is the URI.
  892. */
  893. 'CANNOT_STORE_LIVE_OFFLINE': 9005,
  894. // RETIRED: 'STORE_ALREADY_IN_PROGRESS': 9006,
  895. /**
  896. * There was no init data available for offline storage. This happens when
  897. * there is no init data in the manifest nor could we find any in the
  898. * segments. We currently only support searching MP4 init segments for init
  899. * data.
  900. */
  901. 'NO_INIT_DATA_FOR_OFFLINE': 9007,
  902. /**
  903. * shaka.offline.Storage was constructed with a Player proxy instead of a
  904. * local player instance. To fix this, use Player directly with Storage
  905. * instead of the results of CastProxy.prototype.getPlayer().
  906. */
  907. 'LOCAL_PLAYER_INSTANCE_REQUIRED': 9008,
  908. // RETIRED/MOVED TO 4000's: 'CONTENT_UNSUPPORTED_BY_BROWSER': 9009,
  909. // RETIRED: 'UNSUPPORTED_UPGRADE_REQUEST': 9010,
  910. /**
  911. * The storage cell does not allow new operations that require new keys.
  912. */
  913. 'NEW_KEY_OPERATION_NOT_SUPPORTED': 9011,
  914. /**
  915. * A key was not found in a storage cell.
  916. */
  917. 'KEY_NOT_FOUND': 9012,
  918. /**
  919. * A storage cell was not found.
  920. */
  921. 'MISSING_STORAGE_CELL': 9013,
  922. /**
  923. * The storage limit defined in <code>downloadSizeCallback</code> has been
  924. * reached.
  925. */
  926. 'STORAGE_LIMIT_REACHED': 9014,
  927. /**
  928. * <code>downloadSizeCallback</code> has produced an unexpected error.
  929. */
  930. 'DOWNLOAD_SIZE_CALLBACK_ERROR': 9015,
  931. /**
  932. * The storage cell does not allow new operations that significantly change
  933. * existing data.
  934. */
  935. 'MODIFY_OPERATION_NOT_SUPPORTED': 9016,
  936. /**
  937. * When attempting to open an indexedDB instance, nothing happened for long
  938. * enough for us to time out. This keeps the storage mechanism from hanging
  939. * indefinitely, if neither the success nor error callbacks are called.
  940. */
  941. 'INDEXED_DB_INIT_TIMED_OUT': 9017,
  942. /**
  943. * CS IMA SDK, required for ad insertion, has not been included on the page.
  944. */
  945. 'CS_IMA_SDK_MISSING': 10000,
  946. /**
  947. * Client Side Ad Manager needs to be initialized to enable Client Side
  948. * Ad Insertion. Call adManager.initClientSide() to do it.
  949. */
  950. 'CS_AD_MANAGER_NOT_INITIALIZED': 10001,
  951. /**
  952. * SS IMA SDK, required for ad insertion, has not been included on the page.
  953. */
  954. 'SS_IMA_SDK_MISSING': 10002,
  955. /**
  956. * Server Side Ad Manager needs to be initialized to enable Server Side
  957. * Ad Insertion. Call adManager.initServerSide() to do it.
  958. */
  959. 'SS_AD_MANAGER_NOT_INITIALIZED': 10003,
  960. /**
  961. * A new DAI steam was requested before the previous request had been
  962. * resolved. Only one stream request at a time is supported. Please wait
  963. * for the previous request to complete before initiating a new one.
  964. */
  965. 'CURRENT_DAI_REQUEST_NOT_FINISHED': 10004,
  966. /**
  967. * MediaTailor Ad Manager needs to be initialized to enable MediaTailor
  968. * Ad Insertion. Call adManager.initMediaTailor() to do it.
  969. */
  970. 'MT_AD_MANAGER_NOT_INITIALIZED': 10005,
  971. /**
  972. * Interstitial Ad Manager needs to be initialized to enable interstitial
  973. * Ad Insertion. Call adManager.initInterstitial() to do it.
  974. */
  975. 'INTERSTITIAL_AD_MANAGER_NOT_INITIALIZED': 10006,
  976. /**
  977. * The VAST contained invalid XML markup.
  978. */
  979. 'VAST_INVALID_XML': 10007,
  980. };