Source: lib/util/error.js

  1. /**
  2. * @license
  3. * Copyright 2016 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. goog.provide('shaka.util.Error');
  18. /**
  19. * Describes an error that happened.
  20. *
  21. * @description
  22. * This uses numerical codes to describe which error happened.
  23. *
  24. * Some error are caused by errors from the browser. In these cases, the error
  25. * object is provided as part of the <code>data</code> field. System codes come
  26. * from the browser and may or may not be documented. Here are some places
  27. * where the errors may be documented:
  28. * <ul>
  29. * <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaError">MediaError</a>
  30. * <li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status">HTTP Codes</a>
  31. * <li><a href="https://hresult.info">Edge/PlayReady errors</a>
  32. * </ul>
  33. *
  34. * @param {shaka.util.Error.Severity} severity
  35. * @param {shaka.util.Error.Category} category
  36. * @param {shaka.util.Error.Code} code
  37. * @param {...*} varArgs
  38. *
  39. * @constructor
  40. * @struct
  41. * @export
  42. * @extends {Error}
  43. * @implements {shaka.extern.Error}
  44. */
  45. shaka.util.Error = function(severity, category, code, ...varArgs) {
  46. /**
  47. * @override
  48. * @exportInterface
  49. */
  50. this.severity = severity;
  51. /**
  52. * @override
  53. * @exportInterface
  54. */
  55. this.category = category;
  56. /**
  57. * @override
  58. * @exportInterface
  59. */
  60. this.code = code;
  61. /**
  62. * @override
  63. * @exportInterface
  64. */
  65. this.data = varArgs;
  66. /**
  67. * @override
  68. * @exportInterface
  69. */
  70. this.handled = false;
  71. // This improves the formatting of Errors in failure messages in the tests.
  72. if (goog.DEBUG) {
  73. let categoryName = 'UNKNOWN';
  74. let codeName = 'UNKNOWN';
  75. for (let k in shaka.util.Error.Category) {
  76. if (shaka.util.Error.Category[k] == this.category) {
  77. categoryName = k;
  78. }
  79. }
  80. for (let k in shaka.util.Error.Code) {
  81. if (shaka.util.Error.Code[k] == this.code) {
  82. codeName = k;
  83. }
  84. }
  85. /**
  86. * A human-readable version of the category and code.
  87. * <i>(Only available in uncompiled mode.)</i>
  88. *
  89. * @const {string}
  90. * @exportDoc
  91. */
  92. this.message = 'Shaka Error ' + categoryName + '.' + codeName +
  93. ' (' + this.data.toString() + ')';
  94. if (shaka.util.Error.createStack) {
  95. try {
  96. throw new Error(this.message);
  97. } catch (e) {
  98. /**
  99. * A stack-trace showing where the error occurred.
  100. * <i>(Only available in uncompiled mode.)</i>
  101. *
  102. * @const {string}
  103. * @exportDoc
  104. */
  105. this.stack = e.stack;
  106. }
  107. }
  108. }
  109. };
  110. /**
  111. * @return {string}
  112. * @override
  113. */
  114. shaka.util.Error.prototype.toString = function() {
  115. return 'shaka.util.Error ' + JSON.stringify(this, null, ' ');
  116. };
  117. if (goog.DEBUG) {
  118. /**
  119. * If true, create a stack trace in Error objects.
  120. *
  121. * Only available in uncompiled mode, and disabled in tests to avoid issues
  122. * with karma-jasmine. See comments in test/test/boot.js for details.
  123. *
  124. * @type {boolean}
  125. */
  126. shaka.util.Error.createStack = true;
  127. }
  128. /**
  129. * @enum {number}
  130. * @export
  131. */
  132. shaka.util.Error.Severity = {
  133. /**
  134. * An error occurred, but the Player is attempting to recover from the error.
  135. *
  136. * If the Player cannot ultimately recover, it still may not throw a CRITICAL
  137. * error. For example, retrying for a media segment will never result in
  138. * a CRITICAL error (the Player will just retry forever).
  139. */
  140. 'RECOVERABLE': 1,
  141. /**
  142. * A critical error that the library cannot recover from. These usually cause
  143. * the Player to stop loading or updating. A new manifest must be loaded
  144. * to reset the library.
  145. */
  146. 'CRITICAL': 2,
  147. };
  148. /**
  149. * @enum {number}
  150. * @export
  151. */
  152. shaka.util.Error.Category = {
  153. /** Errors from the network stack. */
  154. 'NETWORK': 1,
  155. /** Errors parsing text streams. */
  156. 'TEXT': 2,
  157. /** Errors parsing or processing audio or video streams. */
  158. 'MEDIA': 3,
  159. /** Errors parsing the Manifest. */
  160. 'MANIFEST': 4,
  161. /** Errors related to streaming. */
  162. 'STREAMING': 5,
  163. /** Errors related to DRM. */
  164. 'DRM': 6,
  165. /** Miscellaneous errors from the player. */
  166. 'PLAYER': 7,
  167. /** Errors related to cast. */
  168. 'CAST': 8,
  169. /** Errors in the database storage (offline). */
  170. 'STORAGE': 9,
  171. };
  172. /**
  173. * @enum {number}
  174. * @export
  175. */
  176. shaka.util.Error.Code = {
  177. /**
  178. * A network request was made using an unsupported URI scheme.
  179. * <br> error.data[0] is the URI.
  180. */
  181. 'UNSUPPORTED_SCHEME': 1000,
  182. /**
  183. * An HTTP network request returned an HTTP status that indicated a failure.
  184. * <br> error.data[0] is the URI.
  185. * <br> error.data[1] is the status code.
  186. * <br> error.data[2] is the response text, or null if the response could not
  187. * be interpretted as text.
  188. * <br> error.data[3] is the map of response headers.
  189. * <br> error.data[4] is the NetworkingEngine.RequestType of the request,
  190. * if one was provided.
  191. */
  192. 'BAD_HTTP_STATUS': 1001,
  193. /**
  194. * An HTTP network request failed with an error, but not from the server.
  195. * <br> error.data[0] is the URI.
  196. * <br> error.data[1] is the original error.
  197. * <br> error.data[2] is the NetworkingEngine.RequestType of the request.
  198. */
  199. 'HTTP_ERROR': 1002,
  200. /**
  201. * A network request timed out.
  202. * <br> error.data[0] is the URI.
  203. * <br> error.data[1] is the NetworkingEngine.RequestType of the request,
  204. * if one was provided.
  205. */
  206. 'TIMEOUT': 1003,
  207. /**
  208. * A network request was made with a malformed data URI.
  209. * <br> error.data[0] is the URI.
  210. */
  211. 'MALFORMED_DATA_URI': 1004,
  212. // RETIRED: 'UNKNOWN_DATA_URI_ENCODING': 1005,
  213. /**
  214. * A request filter threw an error.
  215. * <br> error.data[0] is the original error.
  216. */
  217. 'REQUEST_FILTER_ERROR': 1006,
  218. /**
  219. * A response filter threw an error.
  220. * <br> error.data[0] is the original error.
  221. */
  222. 'RESPONSE_FILTER_ERROR': 1007,
  223. /**
  224. * A testing network request was made with a malformed URI.
  225. * This error is only used by unit and integration tests.
  226. */
  227. 'MALFORMED_TEST_URI': 1008,
  228. /**
  229. * An unexpected network request was made to the FakeNetworkingEngine.
  230. * This error is only used by unit and integration tests.
  231. */
  232. 'UNEXPECTED_TEST_REQUEST': 1009,
  233. /** The text parser failed to parse a text stream due to an invalid header. */
  234. 'INVALID_TEXT_HEADER': 2000,
  235. /** The text parser failed to parse a text stream due to an invalid cue. */
  236. 'INVALID_TEXT_CUE': 2001,
  237. // RETIRED: 'INVALID_TEXT_SETTINGS': 2002,
  238. /**
  239. * Was unable to detect the encoding of the response text. Suggest adding
  240. * byte-order-markings to the response data.
  241. */
  242. 'UNABLE_TO_DETECT_ENCODING': 2003,
  243. /** The response data contains invalid Unicode character encoding. */
  244. 'BAD_ENCODING': 2004,
  245. /**
  246. * The XML parser failed to parse an xml stream, or the XML lacks mandatory
  247. * elements for TTML.
  248. * <br> error.data[0] is extra context, if available.
  249. */
  250. 'INVALID_XML': 2005,
  251. // RETIRED: 'INVALID_TTML': 2006,
  252. /**
  253. * MP4 segment does not contain TTML.
  254. */
  255. 'INVALID_MP4_TTML': 2007,
  256. /**
  257. * MP4 segment does not contain VTT.
  258. */
  259. 'INVALID_MP4_VTT': 2008,
  260. /**
  261. * When examining media in advance, we were unable to extract the cue time.
  262. * This should only be possible with HLS, where we do not have explicit
  263. * segment start times.
  264. * <br> error.data[0] is the underlying exception or Error object.
  265. */
  266. 'UNABLE_TO_EXTRACT_CUE_START_TIME': 2009,
  267. /**
  268. * Some component tried to read past the end of a buffer. The segment index,
  269. * init segment, or PSSH may be malformed.
  270. */
  271. 'BUFFER_READ_OUT_OF_BOUNDS': 3000,
  272. /**
  273. * Some component tried to parse an integer that was too large to fit in a
  274. * JavaScript number without rounding error. JavaScript can only natively
  275. * represent integers up to 53 bits.
  276. */
  277. 'JS_INTEGER_OVERFLOW': 3001,
  278. /**
  279. * The EBML parser used to parse the WebM container encountered an integer,
  280. * ID, or other field larger than the maximum supported by the parser.
  281. */
  282. 'EBML_OVERFLOW': 3002,
  283. /**
  284. * The EBML parser used to parse the WebM container encountered a floating-
  285. * point field of a size not supported by the parser.
  286. */
  287. 'EBML_BAD_FLOATING_POINT_SIZE': 3003,
  288. /**
  289. * The MP4 SIDX parser found the wrong box type.
  290. * Either the segment index range is incorrect or the data is corrupt.
  291. */
  292. 'MP4_SIDX_WRONG_BOX_TYPE': 3004,
  293. /**
  294. * The MP4 SIDX parser encountered an invalid timescale.
  295. * The segment index data may be corrupt.
  296. */
  297. 'MP4_SIDX_INVALID_TIMESCALE': 3005,
  298. /** The MP4 SIDX parser encountered a type of SIDX that is not supported. */
  299. 'MP4_SIDX_TYPE_NOT_SUPPORTED': 3006,
  300. /**
  301. * The WebM Cues parser was unable to locate the Cues element.
  302. * The segment index data may be corrupt.
  303. */
  304. 'WEBM_CUES_ELEMENT_MISSING': 3007,
  305. /**
  306. * The WebM header parser was unable to locate the Ebml element.
  307. * The init segment data may be corrupt.
  308. */
  309. 'WEBM_EBML_HEADER_ELEMENT_MISSING': 3008,
  310. /**
  311. * The WebM header parser was unable to locate the Segment element.
  312. * The init segment data may be corrupt.
  313. */
  314. 'WEBM_SEGMENT_ELEMENT_MISSING': 3009,
  315. /**
  316. * The WebM header parser was unable to locate the Info element.
  317. * The init segment data may be corrupt.
  318. */
  319. 'WEBM_INFO_ELEMENT_MISSING': 3010,
  320. /**
  321. * The WebM header parser was unable to locate the Duration element.
  322. * The init segment data may be corrupt or may have been incorrectly encoded.
  323. * Shaka requires a duration in WebM DASH content.
  324. */
  325. 'WEBM_DURATION_ELEMENT_MISSING': 3011,
  326. /**
  327. * The WebM Cues parser was unable to locate the Cue Track Positions element.
  328. * The segment index data may be corrupt.
  329. */
  330. 'WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING': 3012,
  331. /**
  332. * The WebM Cues parser was unable to locate the Cue Time element.
  333. * The segment index data may be corrupt.
  334. */
  335. 'WEBM_CUE_TIME_ELEMENT_MISSING': 3013,
  336. /**
  337. * A MediaSource operation failed.
  338. * <br> error.data[0] is a MediaError code from the video element.
  339. */
  340. 'MEDIA_SOURCE_OPERATION_FAILED': 3014,
  341. /**
  342. * A MediaSource operation threw an exception.
  343. * <br> error.data[0] is the exception that was thrown.
  344. */
  345. 'MEDIA_SOURCE_OPERATION_THREW': 3015,
  346. /**
  347. * The video element reported an error.
  348. * <br> error.data[0] is a MediaError code from the video element.
  349. * <br> On Edge & IE, error.data[1] is a Microsoft extended error code in hex.
  350. * <br> On Chrome, error.data[2] is a string with details on the error.
  351. * <br> See top of file for links to browser error codes.
  352. */
  353. 'VIDEO_ERROR': 3016,
  354. /**
  355. * A MediaSource operation threw QuotaExceededError and recovery failed. The
  356. * content cannot be played correctly because the segments are too large for
  357. * the browser/platform. This may occur when attempting to play very high
  358. * quality, very high bitrate content on low-end devices.
  359. * <br> error.data[0] is the type of content which caused the error.
  360. */
  361. 'QUOTA_EXCEEDED_ERROR': 3017,
  362. /**
  363. * Mux.js did not invoke the callback signifying successful transmuxing.
  364. */
  365. 'TRANSMUXING_FAILED': 3018,
  366. /**
  367. * The Player was unable to guess the manifest type based on file extension
  368. * or MIME type. To fix, try one of the following:
  369. * <br><ul>
  370. * <li>Rename the manifest so that the URI ends in a well-known extension.
  371. * <li>Configure the server to send a recognizable Content-Type header.
  372. * <li>Configure the server to accept a HEAD request for the manifest.
  373. * </ul>
  374. * <br> error.data[0] is the manifest URI.
  375. */
  376. 'UNABLE_TO_GUESS_MANIFEST_TYPE': 4000,
  377. /**
  378. * The DASH Manifest contained invalid XML markup.
  379. * <br> error.data[0] is the URI associated with the XML.
  380. */
  381. 'DASH_INVALID_XML': 4001,
  382. /**
  383. * The DASH Manifest contained a Representation with insufficient segment
  384. * information.
  385. */
  386. 'DASH_NO_SEGMENT_INFO': 4002,
  387. /** The DASH Manifest contained an AdaptationSet with no Representations. */
  388. 'DASH_EMPTY_ADAPTATION_SET': 4003,
  389. /** The DASH Manifest contained an Period with no AdaptationSets. */
  390. 'DASH_EMPTY_PERIOD': 4004,
  391. /**
  392. * The DASH Manifest does not specify an init segment with a WebM container.
  393. */
  394. 'DASH_WEBM_MISSING_INIT': 4005,
  395. /** The DASH Manifest contained an unsupported container format. */
  396. 'DASH_UNSUPPORTED_CONTAINER': 4006,
  397. /** The embedded PSSH data has invalid encoding. */
  398. 'DASH_PSSH_BAD_ENCODING': 4007,
  399. /**
  400. * There is an AdaptationSet whose Representations do not have any common
  401. * key-systems.
  402. */
  403. 'DASH_NO_COMMON_KEY_SYSTEM': 4008,
  404. /** Having multiple key IDs per Representation is not supported. */
  405. 'DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED': 4009,
  406. /** The DASH Manifest specifies conflicting key IDs. */
  407. 'DASH_CONFLICTING_KEY_IDS': 4010,
  408. /**
  409. * The manifest contains a period with no playable streams.
  410. * Either the period was originally empty, or the streams within cannot be
  411. * played on this browser or platform.
  412. */
  413. 'UNPLAYABLE_PERIOD': 4011,
  414. /**
  415. * There exist some streams that could be decoded, but restrictions imposed
  416. * by the application or the key system prevent us from playing. This may
  417. * happen under the following conditions:
  418. * <ul>
  419. * <li>The application has given restrictions to the Player that restrict
  420. * at least one content type completely (e.g. no playable audio).
  421. * <li>The manifest specifies different keys than were given to us from the
  422. * license server.
  423. * <li>The key system has imposed output restrictions that cannot be met
  424. * (such as HDCP) and there are no unrestricted alternatives.
  425. * </ul>
  426. * <br> error.data[0] is a {@link shaka.extern.RestrictionInfo} object
  427. * describing the kinds of restrictions that caused this error.
  428. */
  429. 'RESTRICTIONS_CANNOT_BE_MET': 4012,
  430. // RETIRED: 'INTERNAL_ERROR_KEY_STATUS': 4013,
  431. /**
  432. * No valid periods were found in the manifest. Please check that your
  433. * manifest is correct and free of typos.
  434. */
  435. 'NO_PERIODS': 4014,
  436. /**
  437. * HLS playlist doesn't start with a mandory #EXTM3U tag.
  438. */
  439. 'HLS_PLAYLIST_HEADER_MISSING': 4015,
  440. /**
  441. * HLS tag has an invalid name that doesn't start with '#EXT'
  442. * <br> error.data[0] is the invalid tag.
  443. */
  444. 'INVALID_HLS_TAG': 4016,
  445. /**
  446. * HLS playlist has both Master and Media/Segment tags.
  447. */
  448. 'HLS_INVALID_PLAYLIST_HIERARCHY': 4017,
  449. /**
  450. * A Representation has an id that is the same as another Representation in
  451. * the same Period. This makes manifest updates impossible since we cannot
  452. * map the updated Representation to the old one.
  453. */
  454. 'DASH_DUPLICATE_REPRESENTATION_ID': 4018,
  455. // RETIRED: 'HLS_MEDIA_INIT_SECTION_INFO_MISSING': 4019,
  456. /**
  457. * HLS manifest has several #EXT-X-MAP tags. We can only
  458. * support one at the moment.
  459. */
  460. 'HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND': 4020,
  461. // RETIRED: 'HLS_COULD_NOT_GUESS_MIME_TYPE': 4021,
  462. /**
  463. * No Master Playlist has been provided. Master playlist provides
  464. * vital information about the streams (like codecs) that is
  465. * required for MediaSource. We don't support directly providing
  466. * a Media Playlist.
  467. */
  468. 'HLS_MASTER_PLAYLIST_NOT_PROVIDED': 4022,
  469. /**
  470. * One of the required attributes was not provided, so the
  471. * HLS manifest is invalid.
  472. * <br> error.data[0] is the missing attribute's name.
  473. */
  474. 'HLS_REQUIRED_ATTRIBUTE_MISSING': 4023,
  475. /**
  476. * One of the required tags was not provided, so the
  477. * HLS manifest is invalid.
  478. * <br> error.data[0] is the missing tag's name.
  479. */
  480. 'HLS_REQUIRED_TAG_MISSING': 4024,
  481. /**
  482. * The HLS parser was unable to guess codecs of a stream.
  483. * <br> error.data[0] is the list of all codecs for the variant.
  484. */
  485. 'HLS_COULD_NOT_GUESS_CODECS': 4025,
  486. /**
  487. * The HLS parser has encountered encrypted content with unsupported
  488. * KEYFORMAT attributes.
  489. */
  490. 'HLS_KEYFORMATS_NOT_SUPPORTED': 4026,
  491. /**
  492. * The manifest parser only supports xlink links with xlink:actuate="onLoad".
  493. */
  494. 'DASH_UNSUPPORTED_XLINK_ACTUATE': 4027,
  495. /**
  496. * The manifest parser has hit its depth limit on xlink link chains.
  497. */
  498. 'DASH_XLINK_DEPTH_LIMIT': 4028,
  499. // RETIRED: 'HLS_LIVE_CONTENT_NOT_SUPPORTED': 4029,
  500. /**
  501. * The HLS parser was unable to parse segment start time from the media.
  502. * <br> error.data[0] is the failed media playlist URI.
  503. * <br> error.data[1] is the failed media segment URI (if any).
  504. */
  505. 'HLS_COULD_NOT_PARSE_SEGMENT_START_TIME': 4030,
  506. // RETIRED: 'HLS_MEDIA_SEQUENCE_REQUIRED_IN_LIVE_STREAMS': 4031,
  507. /**
  508. * The content container or codecs are not supported by this browser. For
  509. * example, this could happen if the content is WebM, but your browser does
  510. * not support the WebM container, or if the content uses HEVC, but your
  511. * browser does not support the HEVC codec. This can also occur for
  512. * multicodec or multicontainer manifests if none of the codecs or containers
  513. * are supported by the browser.
  514. *
  515. * To see what your browser supports, you can check the JSON data dumped by
  516. * http://support.shaka-player-demo.appspot.com/
  517. */
  518. 'CONTENT_UNSUPPORTED_BY_BROWSER': 4032,
  519. /**
  520. * External text tracks cannot be added to live streams.
  521. */
  522. 'CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM': 4033,
  523. /**
  524. * We do not support AES-128 encryption with HLS yet.
  525. */
  526. 'HLS_AES_128_ENCRYPTION_NOT_SUPPORTED': 4034,
  527. /**
  528. * An internal error code that should never be seen by applications, thrown
  529. * to force the HLS parser to skip an unsupported stream.
  530. */
  531. 'HLS_INTERNAL_SKIP_STREAM': 4035,
  532. // RETIRED: 'INCONSISTENT_BUFFER_STATE': 5000,
  533. // RETIRED: 'INVALID_SEGMENT_INDEX': 5001,
  534. // RETIRED: 'SEGMENT_DOES_NOT_EXIST': 5002,
  535. // RETIRED: 'CANNOT_SATISFY_BYTE_LIMIT': 5003,
  536. // RETIRED: 'BAD_SEGMENT': 5004,
  537. /**
  538. * The StreamingEngine called onChooseStreams() but the callback receiver
  539. * did not return the correct number or type of Streams.
  540. *
  541. * This can happen when there is multi-Period content where one Period is
  542. * video+audio and another is video-only or audio-only. We don't support this
  543. * case because it is incompatible with MSE. When the browser reaches the
  544. * transition, it will pause, waiting for the audio stream.
  545. */
  546. 'INVALID_STREAMS_CHOSEN': 5005,
  547. /**
  548. * The manifest indicated protected content, but the manifest parser was
  549. * unable to determine what key systems should be used.
  550. */
  551. 'NO_RECOGNIZED_KEY_SYSTEMS': 6000,
  552. /**
  553. * None of the requested key system configurations are available. This may
  554. * happen under the following conditions:
  555. * <ul>
  556. * <li> The key system is not supported.
  557. * <li> The key system does not support the features requested (e.g.
  558. * persistent state).
  559. * <li> A user prompt was shown and the user denied access.
  560. * <li> The key system is not available from unsecure contexts. (i.e.
  561. requires HTTPS) See https://bit.ly/2K9X1nY
  562. * </ul>
  563. */
  564. 'REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE': 6001,
  565. /**
  566. * The browser found one of the requested key systems, but it failed to
  567. * create an instance of the CDM for some unknown reason.
  568. * <br> error.data[0] is an error message string from the browser.
  569. */
  570. 'FAILED_TO_CREATE_CDM': 6002,
  571. /**
  572. * The browser found one of the requested key systems and created an instance
  573. * of the CDM, but it failed to attach the CDM to the video for some unknown
  574. * reason.
  575. * <br> error.data[0] is an error message string from the browser.
  576. */
  577. 'FAILED_TO_ATTACH_TO_VIDEO': 6003,
  578. /**
  579. * The CDM rejected the server certificate supplied by the application.
  580. * The certificate may be malformed or in an unsupported format.
  581. * <br> error.data[0] is an error message string from the browser.
  582. */
  583. 'INVALID_SERVER_CERTIFICATE': 6004,
  584. /**
  585. * The CDM refused to create a session for some unknown reason.
  586. * <br> error.data[0] is an error message string from the browser.
  587. */
  588. 'FAILED_TO_CREATE_SESSION': 6005,
  589. /**
  590. * The CDM was unable to generate a license request for the init data it was
  591. * given. The init data may be malformed or in an unsupported format.
  592. * <br> error.data[0] is an error message string from the browser.
  593. * <br> error.data[1] is the error object from the browser.
  594. * <br> error.data[2] is a string with the extended error code, if available.
  595. * <br> See top of file for links to browser error codes.
  596. */
  597. 'FAILED_TO_GENERATE_LICENSE_REQUEST': 6006,
  598. /**
  599. * The license request failed. This could be a timeout, a network failure, or
  600. * a rejection by the server.
  601. * <br> error.data[0] is a shaka.util.Error from the networking engine.
  602. */
  603. 'LICENSE_REQUEST_FAILED': 6007,
  604. /**
  605. * The license response was rejected by the CDM. The server's response may be
  606. * invalid or malformed for this CDM.
  607. * <br> error.data[0] is an error message string from the browser.
  608. * <br> See top of file for links to browser error codes.
  609. */
  610. 'LICENSE_RESPONSE_REJECTED': 6008,
  611. // RETIRED: 'NO_LICENSE_SERVER_SPECIFIED': 6009,
  612. /**
  613. * The manifest does not specify any DRM info, but the content is encrypted.
  614. * Either the manifest or the manifest parser are broken.
  615. */
  616. 'ENCRYPTED_CONTENT_WITHOUT_DRM_INFO': 6010,
  617. // RETIRED: 'WRONG_KEYS': 6011,
  618. /**
  619. * No license server was given for the key system signaled by the manifest.
  620. * A license server URI is required for every key system.
  621. * <br> error.data[0] is the key system identifier.
  622. */
  623. 'NO_LICENSE_SERVER_GIVEN': 6012,
  624. /**
  625. * A required offline session was removed. The content is not playable.
  626. */
  627. 'OFFLINE_SESSION_REMOVED': 6013,
  628. /**
  629. * The license has expired. This is triggered when all keys in the key
  630. * status map have a status of 'expired'.
  631. */
  632. 'EXPIRED': 6014,
  633. /**
  634. * A server certificate wasn't given when it is required. FairPlay requires
  635. * setting an explicit server certificate in the configuration.
  636. */
  637. 'SERVER_CERTIFICATE_REQUIRED': 6015,
  638. /**
  639. * An error was thrown while executing the init data transformation.
  640. * <br> error.data[0] is the original error.
  641. */
  642. 'INIT_DATA_TRANSFORM_ERROR': 6016,
  643. /**
  644. * The call to Player.load() was interrupted by a call to Player.unload()
  645. * or another call to Player.load().
  646. */
  647. 'LOAD_INTERRUPTED': 7000,
  648. /**
  649. * An internal error which indicates that an operation was aborted. This
  650. * should not be seen by applications.
  651. */
  652. 'OPERATION_ABORTED': 7001,
  653. /**
  654. * The call to Player.load() failed because the Player does not have a video
  655. * element. The video element must either be provided to the constructor or
  656. * to Player.attach() before Player.load() is called.
  657. */
  658. 'NO_VIDEO_ELEMENT': 7002,
  659. /**
  660. * The Cast API is unavailable. This may be because of one of the following:
  661. * 1. The browser may not have Cast support
  662. * 2. The browser may be missing a necessary Cast extension
  663. * 3. The Cast sender library may not be loaded in your app
  664. */
  665. 'CAST_API_UNAVAILABLE': 8000,
  666. /**
  667. * No cast receivers are available at this time.
  668. */
  669. 'NO_CAST_RECEIVERS': 8001,
  670. /**
  671. * The library is already casting.
  672. */
  673. 'ALREADY_CASTING': 8002,
  674. /**
  675. * A Cast SDK error that we did not explicitly plan for has occurred.
  676. * Check data[0] and refer to the Cast SDK documentation for details.
  677. * <br> error.data[0] is an error object from the Cast SDK.
  678. */
  679. 'UNEXPECTED_CAST_ERROR': 8003,
  680. /**
  681. * The cast operation was canceled by the user.
  682. * <br> error.data[0] is an error object from the Cast SDK.
  683. */
  684. 'CAST_CANCELED_BY_USER': 8004,
  685. /**
  686. * The cast connection timed out.
  687. * <br> error.data[0] is an error object from the Cast SDK.
  688. */
  689. 'CAST_CONNECTION_TIMED_OUT': 8005,
  690. /**
  691. * The requested receiver app ID does not exist or is unavailable.
  692. * Check the requested app ID for typos.
  693. * <br> error.data[0] is an error object from the Cast SDK.
  694. */
  695. 'CAST_RECEIVER_APP_UNAVAILABLE': 8006,
  696. // RETIRED: CAST_RECEIVER_APP_ID_MISSING': 8007,
  697. /**
  698. * Offline storage is not supported on this browser; it is required for
  699. * offline support.
  700. */
  701. 'STORAGE_NOT_SUPPORTED': 9000,
  702. /**
  703. * An unknown error occurred in the IndexedDB.
  704. * <br> On Firefox, one common source for UnknownError calls is reverting
  705. * Firefox to an old version. This makes the IndexedDB storage inaccessible
  706. * for older versions. The only way to fix this is to delete the storage
  707. * data in your profile. See https://mzl.la/2yCGWCm
  708. * <br> error.data[0] is the error object.
  709. */
  710. 'INDEXED_DB_ERROR': 9001,
  711. /**
  712. * The storage operation was aborted. Deprecated in favor of more general
  713. * OPERATION_ABORTED.
  714. */
  715. 'DEPRECATED_OPERATION_ABORTED': 9002,
  716. /**
  717. * The specified item was not found in the IndexedDB.
  718. * <br> error.data[0] is the offline URI.
  719. */
  720. 'REQUESTED_ITEM_NOT_FOUND': 9003,
  721. /**
  722. * A network request was made with a malformed offline URI.
  723. * <br> error.data[0] is the URI.
  724. */
  725. 'MALFORMED_OFFLINE_URI': 9004,
  726. /**
  727. * The specified content is live or in-progress.
  728. * Live and in-progress streams cannot be stored offline.
  729. * <br> error.data[0] is the URI.
  730. */
  731. 'CANNOT_STORE_LIVE_OFFLINE': 9005,
  732. /**
  733. * There is already a store operation in-progress. Wait until it completes
  734. * before starting another.
  735. */
  736. 'STORE_ALREADY_IN_PROGRESS': 9006,
  737. /**
  738. * There was no init data available for offline storage. This happens when
  739. * there is no init data in the manifest nor could we find any in the
  740. * segments. We currently only support searching MP4 init segments for init
  741. * data.
  742. */
  743. 'NO_INIT_DATA_FOR_OFFLINE': 9007,
  744. /**
  745. * shaka.offline.Storage was constructed with a Player proxy instead of a
  746. * local player instance. To fix this, use Player directly with Storage
  747. * instead of the results of CastProxy.prototype.getPlayer().
  748. */
  749. 'LOCAL_PLAYER_INSTANCE_REQUIRED': 9008,
  750. // RETIRED/MOVED TO 4000's: 'CONTENT_UNSUPPORTED_BY_BROWSER': 9009,
  751. // RETIRED: 'UNSUPPORTED_UPGRADE_REQUEST': 9010,
  752. /**
  753. * The storage cell does not allow new operations that require new keys.
  754. */
  755. 'NEW_KEY_OPERATION_NOT_SUPPORTED': 9011,
  756. /**
  757. * A key was not found in a storage cell.
  758. */
  759. 'KEY_NOT_FOUND': 9012,
  760. /**
  761. * A storage cell was not found.
  762. */
  763. 'MISSING_STORAGE_CELL': 9013,
  764. };