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 interpretted 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. /**
  304. * The chapters track failed to load. The browser does not provide any
  305. * information in this case to identify why it failed, but there may be
  306. * details in the JavaScript console.
  307. */
  308. 'CHAPTERS_TRACK_FAILED': 2015,
  309. // RETIRED: 'CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_SRC_EQUALS': 2016,
  310. /**
  311. * Only external urls of WebVTT type are supported.
  312. * <br> error.data[0] is the uri.
  313. */
  314. 'UNSUPPORTED_EXTERNAL_THUMBNAILS_URI': 2017,
  315. /**
  316. * Some component tried to read past the end of a buffer. The segment index,
  317. * init segment, or PSSH may be malformed.
  318. */
  319. 'BUFFER_READ_OUT_OF_BOUNDS': 3000,
  320. /**
  321. * Some component tried to parse an integer that was too large to fit in a
  322. * JavaScript number without rounding error. JavaScript can only natively
  323. * represent integers up to 53 bits.
  324. */
  325. 'JS_INTEGER_OVERFLOW': 3001,
  326. /**
  327. * The EBML parser used to parse the WebM container encountered an integer,
  328. * ID, or other field larger than the maximum supported by the parser.
  329. */
  330. 'EBML_OVERFLOW': 3002,
  331. /**
  332. * The EBML parser used to parse the WebM container encountered a floating-
  333. * point field of a size not supported by the parser.
  334. */
  335. 'EBML_BAD_FLOATING_POINT_SIZE': 3003,
  336. /**
  337. * The MP4 SIDX parser found the wrong box type.
  338. * Either the segment index range is incorrect or the data is corrupt.
  339. */
  340. 'MP4_SIDX_WRONG_BOX_TYPE': 3004,
  341. /**
  342. * The MP4 SIDX parser encountered an invalid timescale.
  343. * The segment index data may be corrupt.
  344. */
  345. 'MP4_SIDX_INVALID_TIMESCALE': 3005,
  346. /** The MP4 SIDX parser encountered a type of SIDX that is not supported. */
  347. 'MP4_SIDX_TYPE_NOT_SUPPORTED': 3006,
  348. /**
  349. * The WebM Cues parser was unable to locate the Cues element.
  350. * The segment index data may be corrupt.
  351. */
  352. 'WEBM_CUES_ELEMENT_MISSING': 3007,
  353. /**
  354. * The WebM header parser was unable to locate the Ebml element.
  355. * The init segment data may be corrupt.
  356. */
  357. 'WEBM_EBML_HEADER_ELEMENT_MISSING': 3008,
  358. /**
  359. * The WebM header parser was unable to locate the Segment element.
  360. * The init segment data may be corrupt.
  361. */
  362. 'WEBM_SEGMENT_ELEMENT_MISSING': 3009,
  363. /**
  364. * The WebM header parser was unable to locate the Info element.
  365. * The init segment data may be corrupt.
  366. */
  367. 'WEBM_INFO_ELEMENT_MISSING': 3010,
  368. /**
  369. * The WebM header parser was unable to locate the Duration element.
  370. * The init segment data may be corrupt or may have been incorrectly encoded.
  371. * Shaka requires a duration in WebM DASH content.
  372. */
  373. 'WEBM_DURATION_ELEMENT_MISSING': 3011,
  374. /**
  375. * The WebM Cues parser was unable to locate the Cue Track Positions element.
  376. * The segment index data may be corrupt.
  377. */
  378. 'WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING': 3012,
  379. /**
  380. * The WebM Cues parser was unable to locate the Cue Time element.
  381. * The segment index data may be corrupt.
  382. */
  383. 'WEBM_CUE_TIME_ELEMENT_MISSING': 3013,
  384. /**
  385. * A MediaSource operation failed.
  386. * <br> error.data[0] is a MediaError code from the video element.
  387. * <br> error.data[1] is the segment URI that triggered the error, if any.
  388. */
  389. 'MEDIA_SOURCE_OPERATION_FAILED': 3014,
  390. /**
  391. * A MediaSource operation threw an exception.
  392. * <br> error.data[0] is the exception that was thrown.
  393. * <br> error.data[1] is the error object from the video element.
  394. * <br> error.data[2] is the segment URI that triggered the error, if any.
  395. */
  396. 'MEDIA_SOURCE_OPERATION_THREW': 3015,
  397. /**
  398. * The video element reported an error.
  399. * <br> error.data[0] is a MediaError code from the video element.
  400. * <br> On Edge, error.data[1] is a Microsoft extended error code in hex.
  401. * <br> On Chrome, error.data[2] is a string with details on the error.
  402. * <br> See top of file for links to browser error codes.
  403. */
  404. 'VIDEO_ERROR': 3016,
  405. /**
  406. * A MediaSource operation threw QuotaExceededError and recovery failed. The
  407. * content cannot be played correctly because the segments are too large for
  408. * the browser/platform. This may occur when attempting to play very high
  409. * quality, very high bitrate content on low-end devices.
  410. * <br> error.data[0] is the type of content which caused the error.
  411. */
  412. 'QUOTA_EXCEEDED_ERROR': 3017,
  413. /**
  414. * Transmuxing with our internal transmuxer failed.
  415. * <br> error.data[0] is the segment URI that triggered the error, if any.
  416. */
  417. 'TRANSMUXING_FAILED': 3018,
  418. /**
  419. * Content transformations required by the platform could not be performed for
  420. * some reason (unsupported container, etc.)
  421. * <br> @see https://github.com/shaka-project/shaka-player/issues/2759
  422. * <br> error.data[0] is the segment URI that triggered the error, if any.
  423. */
  424. 'CONTENT_TRANSFORMATION_FAILED': 3019,
  425. /**
  426. * Important data is missing to be able to do the transmuxing of MSS.
  427. * <br> error.data[0] is the segment URI that triggered the error, if any.
  428. */
  429. 'MSS_MISSING_DATA_FOR_TRANSMUXING': 3020,
  430. // RETIRED: 'MSS_TRANSMUXING_CODEC_UNKNOWN': 3021,
  431. /**
  432. * MSS transmuing failed for unknown reason.
  433. * <br> error.data[0] is the segment URI that triggered the error, if any.
  434. */
  435. 'MSS_TRANSMUXING_FAILED': 3022,
  436. /**
  437. * An internal error which indicates that transmuxing operation has no video
  438. * data. This should not be seen by applications.
  439. * <br> error.data[0] is the segment URI that triggered the error, if any.
  440. */
  441. 'TRANSMUXING_NO_VIDEO_DATA': 3023,
  442. /**
  443. * The Player was unable to guess the manifest type based on file extension
  444. * or MIME type. To fix, try one of the following:
  445. * <br><ul>
  446. * <li>Rename the manifest so that the URI ends in a well-known extension.
  447. * <li>Configure the server to send a recognizable Content-Type header.
  448. * <li>Configure the server to accept a HEAD request for the manifest.
  449. * </ul>
  450. * <br> error.data[0] is the manifest URI.
  451. * <br> error.data[1] is the detected or specified MIME type.
  452. */
  453. 'UNABLE_TO_GUESS_MANIFEST_TYPE': 4000,
  454. /**
  455. * The DASH Manifest contained invalid XML markup.
  456. * <br> error.data[0] is the URI associated with the XML.
  457. */
  458. 'DASH_INVALID_XML': 4001,
  459. /**
  460. * The DASH Manifest contained a Representation with insufficient segment
  461. * information.
  462. */
  463. 'DASH_NO_SEGMENT_INFO': 4002,
  464. /** The DASH Manifest contained an AdaptationSet with no Representations. */
  465. 'DASH_EMPTY_ADAPTATION_SET': 4003,
  466. /** The DASH Manifest contained an Period with no AdaptationSets. */
  467. 'DASH_EMPTY_PERIOD': 4004,
  468. /**
  469. * The DASH Manifest does not specify an init segment with a WebM container.
  470. */
  471. 'DASH_WEBM_MISSING_INIT': 4005,
  472. /** The DASH Manifest contained an unsupported container format. */
  473. 'DASH_UNSUPPORTED_CONTAINER': 4006,
  474. /** The embedded PSSH data has invalid encoding. */
  475. 'DASH_PSSH_BAD_ENCODING': 4007,
  476. /**
  477. * There is an AdaptationSet whose Representations do not have any common
  478. * key-systems.
  479. */
  480. 'DASH_NO_COMMON_KEY_SYSTEM': 4008,
  481. /** Having multiple key IDs per Representation is not supported. */
  482. 'DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED': 4009,
  483. /** The DASH Manifest specifies conflicting key IDs. */
  484. 'DASH_CONFLICTING_KEY_IDS': 4010,
  485. // RETIRED: 'UNPLAYABLE_PERIOD': 4011,
  486. /**
  487. * There exist some streams that could be decoded, but restrictions imposed
  488. * by the application or the key system prevent us from playing. This may
  489. * happen under the following conditions:
  490. * <ul>
  491. * <li>The application has given restrictions to the Player that restrict
  492. * at least one content type completely (e.g. no playable audio).
  493. * <li>The manifest specifies different keys than were given to us from the
  494. * license server.
  495. * <li>The key system has imposed output restrictions that cannot be met
  496. * (such as HDCP) and there are no unrestricted alternatives.
  497. * </ul>
  498. * <br> error.data[0] is a {@link shaka.extern.RestrictionInfo} object
  499. * describing the kinds of restrictions that caused this error.
  500. */
  501. 'RESTRICTIONS_CANNOT_BE_MET': 4012,
  502. // RETIRED: 'INTERNAL_ERROR_KEY_STATUS': 4013,
  503. // RETIRED: 'NO_PERIODS': 4014,
  504. /**
  505. * HLS playlist doesn't start with a mandory #EXTM3U tag.
  506. */
  507. 'HLS_PLAYLIST_HEADER_MISSING': 4015,
  508. /**
  509. * HLS tag has an invalid name that doesn't start with '#EXT'
  510. * <br> error.data[0] is the invalid tag.
  511. */
  512. 'INVALID_HLS_TAG': 4016,
  513. /**
  514. * HLS playlist has both Master and Media/Segment tags.
  515. */
  516. 'HLS_INVALID_PLAYLIST_HIERARCHY': 4017,
  517. /**
  518. * A Representation has an id that is the same as another Representation in
  519. * the same Period. This makes manifest updates impossible since we cannot
  520. * map the updated Representation to the old one.
  521. */
  522. 'DASH_DUPLICATE_REPRESENTATION_ID': 4018,
  523. // RETIRED: 'HLS_MEDIA_INIT_SECTION_INFO_MISSING': 4019,
  524. /**
  525. * HLS manifest has several #EXT-X-MAP tags. We can only
  526. * support one at the moment.
  527. */
  528. 'HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND': 4020,
  529. // RETIRED: 'HLS_COULD_NOT_GUESS_MIME_TYPE': 4021,
  530. // RETIRED: 'HLS_MASTER_PLAYLIST_NOT_PROVIDED': 4022,
  531. /**
  532. * One of the required attributes was not provided, so the
  533. * HLS manifest is invalid.
  534. * <br> error.data[0] is the missing attribute's name.
  535. */
  536. 'HLS_REQUIRED_ATTRIBUTE_MISSING': 4023,
  537. /**
  538. * One of the required tags was not provided, so the
  539. * HLS manifest is invalid.
  540. * <br> error.data[0] is the missing tag's name.
  541. */
  542. 'HLS_REQUIRED_TAG_MISSING': 4024,
  543. /**
  544. * The HLS parser was unable to guess codecs of a stream.
  545. * <br> error.data[0] is the list of all codecs for the variant.
  546. */
  547. 'HLS_COULD_NOT_GUESS_CODECS': 4025,
  548. /**
  549. * The HLS parser has encountered encrypted content with unsupported
  550. * KEYFORMAT attributes.
  551. */
  552. 'HLS_KEYFORMATS_NOT_SUPPORTED': 4026,
  553. /**
  554. * The manifest parser only supports xlink links with xlink:actuate="onLoad".
  555. */
  556. 'DASH_UNSUPPORTED_XLINK_ACTUATE': 4027,
  557. /**
  558. * The manifest parser has hit its depth limit on xlink link chains.
  559. */
  560. 'DASH_XLINK_DEPTH_LIMIT': 4028,
  561. // RETIRED: 'HLS_LIVE_CONTENT_NOT_SUPPORTED': 4029,
  562. // RETIRED: 'HLS_COULD_NOT_PARSE_SEGMENT_START_TIME': 4030,
  563. // RETIRED: 'HLS_MEDIA_SEQUENCE_REQUIRED_IN_LIVE_STREAMS': 4031,
  564. /**
  565. * The content container or codecs are not supported by this browser. For
  566. * example, this could happen if the content is WebM, but your browser does
  567. * not support the WebM container, or if the content uses HEVC, but your
  568. * browser does not support the HEVC codec. This can also occur for
  569. * multicodec or multicontainer manifests if none of the codecs or containers
  570. * are supported by the browser.
  571. *
  572. * To see what your browser supports, you can check the JSON data dumped by
  573. * http://support.shaka-player-demo.appspot.com/
  574. */
  575. 'CONTENT_UNSUPPORTED_BY_BROWSER': 4032,
  576. /**
  577. * External text tracks cannot be added to live streams.
  578. */
  579. 'CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM': 4033,
  580. // RETIRED: 'HLS_AES_128_ENCRYPTION_NOT_SUPPORTED': 4034,
  581. // RETIRED: 'HLS_INTERNAL_SKIP_STREAM': 4035,
  582. /** The Manifest contained no Variants. */
  583. 'NO_VARIANTS': 4036,
  584. /**
  585. * We failed to find matching streams across DASH Periods, and the
  586. * period-flattening aglorithm introduced in v3.0 has failed.
  587. */
  588. 'PERIOD_FLATTENING_FAILED': 4037,
  589. /**
  590. * We failed to find matching streams across DASH Periods due to inconsistent
  591. * DRM systems across periods.
  592. */
  593. 'INCONSISTENT_DRM_ACROSS_PERIODS': 4038,
  594. /**
  595. * The HLS manifest refers to an undeclared variables.
  596. * <br> error.data[0] is the variable undeclared.
  597. */
  598. 'HLS_VARIABLE_NOT_FOUND': 4039,
  599. /**
  600. * We do not support playing encrypted mp2t with MSE
  601. */
  602. 'HLS_MSE_ENCRYPTED_MP2T_NOT_SUPPORTED': 4040,
  603. /**
  604. * We do not support playing encrypted content (different than mp2t) with MSE
  605. * and legacy Apple MediaKeys API.
  606. */
  607. 'HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED': 4041,
  608. /**
  609. * Web Crypto API is not available (to decrypt AES-128 streams). Web Crypto
  610. * only exists in secure origins like https.
  611. */
  612. 'NO_WEB_CRYPTO_API': 4042,
  613. // RETIRED: 'HLS_AES_128_INVALID_IV_LENGTH': 4043,
  614. // RETIRED: 'HLS_AES_128_INVALID_KEY_LENGTH': 4044,
  615. /**
  616. * External thumbnails tracks cannot be added to live streams.
  617. */
  618. 'CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_LIVE_STREAM': 4045,
  619. /**
  620. * The MSS Manifest contained invalid XML markup.
  621. * <br> error.data[0] is the URI associated with the XML.
  622. */
  623. 'MSS_INVALID_XML': 4046,
  624. /**
  625. * MSS parser encountered a live playlist.
  626. */
  627. 'MSS_LIVE_CONTENT_NOT_SUPPORTED': 4047,
  628. /**
  629. * AES-128 iv length should be 16 bytes.
  630. */
  631. 'AES_128_INVALID_IV_LENGTH': 4048,
  632. /**
  633. * AES-128 encryption key length should be 16 bytes.
  634. */
  635. 'AES_128_INVALID_KEY_LENGTH': 4049,
  636. /**
  637. * The DASH Manifest specifies conflicting AES-128 keys.
  638. */
  639. 'DASH_CONFLICTING_AES_128': 4050,
  640. /**
  641. * The DASH Manifest specifies a unsupported AES-128 encryption.
  642. */
  643. 'DASH_UNSUPPORTED_AES_128': 4051,
  644. /**
  645. * Patch requested during an update did not match original manifest.
  646. */
  647. 'DASH_INVALID_PATCH': 4052,
  648. // RETIRED: 'INCONSISTENT_BUFFER_STATE': 5000,
  649. // RETIRED: 'INVALID_SEGMENT_INDEX': 5001,
  650. // RETIRED: 'SEGMENT_DOES_NOT_EXIST': 5002,
  651. // RETIRED: 'CANNOT_SATISFY_BYTE_LIMIT': 5003,
  652. // RETIRED: 'BAD_SEGMENT': 5004,
  653. // RETIRED: 'INVALID_STREAMS_CHOSEN': 5005,
  654. /**
  655. * This would only happen if StreamingEngine were not started correctly, and
  656. * should not be seen in production.
  657. */
  658. 'STREAMING_ENGINE_STARTUP_INVALID_STATE': 5006,
  659. /**
  660. * The manifest indicated protected content, but the manifest parser was
  661. * unable to determine what key systems should be used.
  662. */
  663. 'NO_RECOGNIZED_KEY_SYSTEMS': 6000,
  664. /**
  665. * None of the requested key system configurations are available. This may
  666. * happen under the following conditions:
  667. * <ul>
  668. * <li> The key system is not supported.
  669. * <li> The key system does not support the features requested (e.g.
  670. * persistent state).
  671. * <li> A user prompt was shown and the user denied access.
  672. * <li> The key system is not available from unsecure contexts. (i.e.
  673. requires HTTPS) See https://bit.ly/2K9X1nY
  674. * </ul>
  675. */
  676. 'REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE': 6001,
  677. /**
  678. * The browser found one of the requested key systems, but it failed to
  679. * create an instance of the CDM for some unknown reason.
  680. * <br> error.data[0] is an error message string from the browser.
  681. */
  682. 'FAILED_TO_CREATE_CDM': 6002,
  683. /**
  684. * The browser found one of the requested key systems and created an instance
  685. * of the CDM, but it failed to attach the CDM to the video for some unknown
  686. * reason.
  687. * <br> error.data[0] is an error message string from the browser.
  688. */
  689. 'FAILED_TO_ATTACH_TO_VIDEO': 6003,
  690. /**
  691. * The CDM rejected the server certificate supplied by the application.
  692. * The certificate may be malformed or in an unsupported format.
  693. * <br> error.data[0] is an error message string from the browser.
  694. */
  695. 'INVALID_SERVER_CERTIFICATE': 6004,
  696. /**
  697. * The CDM refused to create a session for some unknown reason.
  698. * <br> error.data[0] is an error message string from the browser.
  699. */
  700. 'FAILED_TO_CREATE_SESSION': 6005,
  701. /**
  702. * The CDM was unable to generate a license request for the init data it was
  703. * given. The init data may be malformed or in an unsupported format.
  704. * <br> error.data[0] is an error message string from the browser.
  705. * <br> error.data[1] is the error object from the browser.
  706. * <br> error.data[2] is a string with the extended error code, if available.
  707. * <br> See top of file for links to browser error codes.
  708. */
  709. 'FAILED_TO_GENERATE_LICENSE_REQUEST': 6006,
  710. /**
  711. * The license request failed. This could be a timeout, a network failure, or
  712. * a rejection by the server.
  713. * <br> error.data[0] is a shaka.util.Error from the networking engine.
  714. */
  715. 'LICENSE_REQUEST_FAILED': 6007,
  716. /**
  717. * The license response was rejected by the CDM. The server's response may be
  718. * invalid or malformed for this CDM.
  719. * <br> error.data[0] is an error message string from the browser.
  720. * <br> See top of file for links to browser error codes.
  721. */
  722. 'LICENSE_RESPONSE_REJECTED': 6008,
  723. // RETIRED: 'NO_LICENSE_SERVER_SPECIFIED': 6009,
  724. /**
  725. * The manifest does not specify any DRM info, but the content is encrypted.
  726. * Either the manifest or the manifest parser are broken.
  727. */
  728. 'ENCRYPTED_CONTENT_WITHOUT_DRM_INFO': 6010,
  729. // RETIRED: 'WRONG_KEYS': 6011,
  730. /**
  731. * No license server was given for the key system signaled by the manifest.
  732. * A license server URI is required for every key system.
  733. * <br> error.data[0] is the key system identifier.
  734. */
  735. 'NO_LICENSE_SERVER_GIVEN': 6012,
  736. /**
  737. * A required offline session was removed. The content might not be playable
  738. * depending of the playback context.
  739. */
  740. 'OFFLINE_SESSION_REMOVED': 6013,
  741. /**
  742. * The license has expired. This is triggered when all keys in the key
  743. * status map have a status of 'expired'.
  744. */
  745. 'EXPIRED': 6014,
  746. /**
  747. * A server certificate wasn't given when it is required. FairPlay requires
  748. * setting an explicit server certificate in the configuration.
  749. */
  750. 'SERVER_CERTIFICATE_REQUIRED': 6015,
  751. /**
  752. * An error was thrown while executing the init data transformation.
  753. * <br> error.data[0] is the original error.
  754. */
  755. 'INIT_DATA_TRANSFORM_ERROR': 6016,
  756. /**
  757. * The server certificate request failed.
  758. * <br> error.data[0] is a shaka.util.Error from the networking engine.
  759. */
  760. 'SERVER_CERTIFICATE_REQUEST_FAILED': 6017,
  761. /**
  762. * The HDCP version does not meet the requirements.
  763. */
  764. 'MIN_HDCP_VERSION_NOT_MATCH': 6018,
  765. /**
  766. * Error when checking HDCP version.
  767. * <br> error.data[0] is an error message string from the browser.
  768. */
  769. 'ERROR_CHECKING_HDCP_VERSION': 6019,
  770. /**
  771. * The call to Player.load() was interrupted by a call to Player.unload()
  772. * or another call to Player.load().
  773. */
  774. 'LOAD_INTERRUPTED': 7000,
  775. /**
  776. * An internal error which indicates that an operation was aborted. This
  777. * should not be seen by applications.
  778. */
  779. 'OPERATION_ABORTED': 7001,
  780. /**
  781. * The call to Player.load() failed because the Player does not have a video
  782. * element. The video element must either be provided to the constructor or
  783. * to Player.attach() before Player.load() is called.
  784. */
  785. 'NO_VIDEO_ELEMENT': 7002,
  786. /**
  787. * The operation failed because the object has been destroyed.
  788. */
  789. 'OBJECT_DESTROYED': 7003,
  790. /**
  791. * The content has not been loaded in the Player.
  792. */
  793. 'CONTENT_NOT_LOADED': 7004,
  794. /**
  795. * The call to preload failed, due to being called on src= content.
  796. */
  797. 'SRC_EQUALS_PRELOAD_NOT_SUPPORTED': 7005,
  798. /**
  799. * The Cast API is unavailable. This may be because of one of the following:
  800. * 1. The browser may not have Cast support
  801. * 2. The browser may be missing a necessary Cast extension
  802. * 3. The Cast sender library may not be loaded in your app
  803. */
  804. 'CAST_API_UNAVAILABLE': 8000,
  805. /**
  806. * No cast receivers are available at this time.
  807. */
  808. 'NO_CAST_RECEIVERS': 8001,
  809. /**
  810. * The library is already casting.
  811. */
  812. 'ALREADY_CASTING': 8002,
  813. /**
  814. * A Cast SDK error that we did not explicitly plan for has occurred.
  815. * Check data[0] and refer to the Cast SDK documentation for details.
  816. * <br> error.data[0] is an error object from the Cast SDK.
  817. */
  818. 'UNEXPECTED_CAST_ERROR': 8003,
  819. /**
  820. * The cast operation was canceled by the user.
  821. * <br> error.data[0] is an error object from the Cast SDK.
  822. */
  823. 'CAST_CANCELED_BY_USER': 8004,
  824. /**
  825. * The cast connection timed out.
  826. * <br> error.data[0] is an error object from the Cast SDK.
  827. */
  828. 'CAST_CONNECTION_TIMED_OUT': 8005,
  829. /**
  830. * The requested receiver app ID does not exist or is unavailable.
  831. * Check the requested app ID for typos.
  832. * <br> error.data[0] is an error object from the Cast SDK.
  833. */
  834. 'CAST_RECEIVER_APP_UNAVAILABLE': 8006,
  835. // RETIRED: CAST_RECEIVER_APP_ID_MISSING': 8007,
  836. /**
  837. * Offline storage is not supported on this browser; it is required for
  838. * offline support.
  839. */
  840. 'STORAGE_NOT_SUPPORTED': 9000,
  841. /**
  842. * An unknown error occurred in the IndexedDB.
  843. * <br> On Firefox, one common source for UnknownError calls is reverting
  844. * Firefox to an old version. This makes the IndexedDB storage inaccessible
  845. * for older versions. The only way to fix this is to delete the storage
  846. * data in your profile. See https://mzl.la/2yCGWCm
  847. * <br> error.data[0] is the error object.
  848. */
  849. 'INDEXED_DB_ERROR': 9001,
  850. /**
  851. * The storage operation was aborted. Deprecated in favor of more general
  852. * OPERATION_ABORTED.
  853. */
  854. 'DEPRECATED_OPERATION_ABORTED': 9002,
  855. /**
  856. * The specified item was not found in the IndexedDB.
  857. * <br> error.data[0] is the offline URI.
  858. */
  859. 'REQUESTED_ITEM_NOT_FOUND': 9003,
  860. /**
  861. * A network request was made with a malformed offline URI.
  862. * <br> error.data[0] is the URI.
  863. */
  864. 'MALFORMED_OFFLINE_URI': 9004,
  865. /**
  866. * The specified content is live or in-progress.
  867. * Live and in-progress streams cannot be stored offline.
  868. * <br> error.data[0] is the URI.
  869. */
  870. 'CANNOT_STORE_LIVE_OFFLINE': 9005,
  871. // RETIRED: 'STORE_ALREADY_IN_PROGRESS': 9006,
  872. /**
  873. * There was no init data available for offline storage. This happens when
  874. * there is no init data in the manifest nor could we find any in the
  875. * segments. We currently only support searching MP4 init segments for init
  876. * data.
  877. */
  878. 'NO_INIT_DATA_FOR_OFFLINE': 9007,
  879. /**
  880. * shaka.offline.Storage was constructed with a Player proxy instead of a
  881. * local player instance. To fix this, use Player directly with Storage
  882. * instead of the results of CastProxy.prototype.getPlayer().
  883. */
  884. 'LOCAL_PLAYER_INSTANCE_REQUIRED': 9008,
  885. // RETIRED/MOVED TO 4000's: 'CONTENT_UNSUPPORTED_BY_BROWSER': 9009,
  886. // RETIRED: 'UNSUPPORTED_UPGRADE_REQUEST': 9010,
  887. /**
  888. * The storage cell does not allow new operations that require new keys.
  889. */
  890. 'NEW_KEY_OPERATION_NOT_SUPPORTED': 9011,
  891. /**
  892. * A key was not found in a storage cell.
  893. */
  894. 'KEY_NOT_FOUND': 9012,
  895. /**
  896. * A storage cell was not found.
  897. */
  898. 'MISSING_STORAGE_CELL': 9013,
  899. /**
  900. * The storage limit defined in <code>downloadSizeCallback</code> has been
  901. * reached.
  902. */
  903. 'STORAGE_LIMIT_REACHED': 9014,
  904. /**
  905. * <code>downloadSizeCallback</code> has produced an unexpected error.
  906. */
  907. 'DOWNLOAD_SIZE_CALLBACK_ERROR': 9015,
  908. /**
  909. * The storage cell does not allow new operations that significantly change
  910. * existing data.
  911. */
  912. 'MODIFY_OPERATION_NOT_SUPPORTED': 9016,
  913. /**
  914. * When attempting to open an indexedDB instance, nothing happened for long
  915. * enough for us to time out. This keeps the storage mechanism from hanging
  916. * indefinitely, if neither the success nor error callbacks are called.
  917. */
  918. 'INDEXED_DB_INIT_TIMED_OUT': 9017,
  919. /**
  920. * CS IMA SDK, required for ad insertion, has not been included on the page.
  921. */
  922. 'CS_IMA_SDK_MISSING': 10000,
  923. /**
  924. * Client Side Ad Manager needs to be initialized to enable Client Side
  925. * Ad Insertion. Call adManager.initClientSide() to do it.
  926. */
  927. 'CS_AD_MANAGER_NOT_INITIALIZED': 10001,
  928. /**
  929. * SS IMA SDK, required for ad insertion, has not been included on the page.
  930. */
  931. 'SS_IMA_SDK_MISSING': 10002,
  932. /**
  933. * Server Side Ad Manager needs to be initialized to enable Server Side
  934. * Ad Insertion. Call adManager.initServerSide() to do it.
  935. */
  936. 'SS_AD_MANAGER_NOT_INITIALIZED': 10003,
  937. /**
  938. * A new DAI steam was requested before the previous request had been
  939. * resolved. Only one stream request at a time is supported. Please wait
  940. * for the previous request to complete before initiating a new one.
  941. */
  942. 'CURRENT_DAI_REQUEST_NOT_FINISHED': 10004,
  943. /**
  944. * MediaTailor Ad Manager needs to be initialized to enable MediaTailor
  945. * Ad Insertion. Call adManager.initMediaTailor() to do it.
  946. */
  947. 'MT_AD_MANAGER_NOT_INITIALIZED': 10005,
  948. };