shaka.d.ts 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417
  1. // FROM: https://gist.github.com/sco974/9c72ded8fe3e2e32ad2c2e41804ce642
  2. declare namespace shaka {
  3. namespace media {
  4. class InitSegmentReference {
  5. /**
  6. * Creates an InitSegmentReference, which provides the location to an initialization segment.
  7. * @param uris A function that creates the URIs of the resource containing the segment.
  8. * @param startByte The offset from the start of the resource to the start of the segment.
  9. * @param endByte The offset from the start of the resource to the end of the segment, inclusive.
  10. * null indicates that the segment extends to the end of the resource.
  11. */
  12. constructor(uris: any, startByte: any, endByte: any);
  13. /**
  14. * Creates the URIs of the resource containing the segment.
  15. */
  16. createUris(): any;
  17. /**
  18. * Returns the offset from the start of the resource to the start of the segment.
  19. */
  20. getStartByte(): any;
  21. /**
  22. * Returns the offset from the start of the resource to the end of the segment, inclusive.
  23. * null indicates that the segment extends to the end of the resource.
  24. */
  25. getEndByte(): any;
  26. }
  27. class SegmentReference {
  28. /**
  29. * Creates a SegmentReference, which provides the start time, end time, and
  30. location to a media segment.
  31. * @param position The segment's position within a particular Period.
  32. The following should hold true between any two SegmentReferences from the
  33. same Period, r1 and r2:
  34. IF r2.position > r1.position THEN
  35. [ (r2.startTime > r1.startTime) OR
  36. (r2.startTime == r1.startTime AND r2.endTime >= r1.endTime) ]
  37. * @param startTime The segment's start time in seconds, relative to
  38. the start of a particular Period.
  39. * @param endTime The segment's end time in seconds, relative to
  40. the start of a particular Period. The segment ends the instant before
  41. this time, so |endTime| must be strictly greater than |startTime|.
  42. * @param uris A function that creates the URIs of the resource containing the segment.
  43. * @param startByte The offset from the start of the resource to the
  44. start of the segment.
  45. * @param endByte The offset from the start of the resource to the
  46. end of the segment, inclusive. null indicates that the segment extends
  47. to the end of the resource.
  48. */
  49. constructor(
  50. position: any,
  51. startTime: any,
  52. endTime: any,
  53. uris: any,
  54. startByte: any,
  55. endByte: any
  56. );
  57. /**
  58. * Returns the segment's position within a particular Period.
  59. * @returnType The segment's position.
  60. */
  61. getPosition(): any;
  62. /**
  63. * Returns the segment's start time in seconds, relative to
  64. the start of a particular Period.
  65. */
  66. getStartTime(): any;
  67. /**
  68. * Returns the segment's end time in seconds, relative to
  69. the start of a particular Period.
  70. */
  71. getEndTime(): any;
  72. /**
  73. * Creates the URIs of the resource containing the segment.
  74. */
  75. createUris(): any;
  76. /**
  77. * Returns the offset from the start of the resource to the
  78. start of the segment.
  79. */
  80. getStartByte(): any;
  81. /**
  82. * Returns the offset from the start of the resource to the
  83. end of the segment, inclusive. null indicates that the segment extends
  84. to the end of the resource.
  85. */
  86. getEndByte(): any;
  87. }
  88. namespace ManifestParser {
  89. /**
  90. * Registers a manifest parser by file extension.
  91. * @param extension The file extension of the manifest.
  92. * @param parserFactory The factory
  93. used to create parser instances.
  94. */
  95. function registerParserByExtension(extension: any, parserFactory: any): void;
  96. /**
  97. * Registers a manifest parser by MIME type.
  98. * @param mimeType The MIME type of the manifest.
  99. * @param parserFactory The factory
  100. used to create parser instances.
  101. */
  102. function registerParserByMime(mimeType: any, parserFactory: any): void;
  103. }
  104. class SegmentIndex {
  105. /**
  106. * Creates a SegmentIndex.
  107. * @param references The list of
  108. SegmentReferences, which must be sorted first by their start times
  109. (ascending) and second by their end times (ascending), and have
  110. continuous, increasing positions.
  111. */
  112. constructor(references: any);
  113. destroy(): void;
  114. /**
  115. * Finds the position of the segment for the given time, in seconds, relative
  116. to the start of a particular Period. Returns the position of the segment
  117. with the largest end time if more than one segment is known for the given
  118. time.
  119. * @returnType The position of the segment, or null
  120. if the position of the segment could not be determined.
  121. */
  122. find(time: any): any;
  123. /**
  124. * Gets the SegmentReference for the segment at the given position.
  125. * @param position The position of the segment.
  126. * @returnType The SegmentReference, or null if
  127. no such SegmentReference exists.
  128. */
  129. get(position: any): any;
  130. /**
  131. * Offset all segment references by a fixed amount.
  132. * @param offset The amount to add to each segment's start and end
  133. times.
  134. */
  135. offset(offset: any): void;
  136. /**
  137. * Merges the given SegmentReferences. Supports extending the original
  138. references only. Will not replace old references or interleave new ones.
  139. * @param references The list of
  140. SegmentReferences, which must be sorted first by their start times
  141. (ascending) and second by their end times (ascending), and have
  142. continuous, increasing positions.
  143. */
  144. merge(references: any): void;
  145. /**
  146. * Removes all SegmentReferences that end before the given time.
  147. * @param time The time in seconds.
  148. */
  149. evict(time: any): void;
  150. }
  151. class PresentationTimeline {
  152. /**
  153. * Creates a PresentationTimeline.
  154. * @param presentationStartTime The wall-clock time, in seconds,
  155. when the presentation started or will start. Only required for live.
  156. * @param presentationDelay The delay to give the presentation, in
  157. seconds. Only required for live.
  158. */
  159. constructor(presentationStartTime: any, presentationDelay: any);
  160. /**
  161. * @returnType The presentation's duration in seconds.
  162. Infinity indicates that the presentation continues indefinitely.
  163. */
  164. getDuration(): any;
  165. /**
  166. * Sets the presentation's duration.
  167. * @param duration The presentation's duration in seconds.
  168. Infinity indicates that the presentation continues indefinitely.
  169. */
  170. setDuration(duration: any): void;
  171. /**
  172. * @returnType The presentation's start time in seconds.
  173. */
  174. getPresentationStartTime(): any;
  175. /**
  176. * Sets the clock offset, which is the the difference between the client's clock
  177. and the server's clock, in milliseconds (i.e., serverTime = Date.now() +
  178. clockOffset).
  179. * @param offset The clock offset, in ms.
  180. */
  181. setClockOffset(offset: any): void;
  182. /**
  183. * Sets the presentation's static flag.
  184. * @param isStatic If true, the presentation is static, meaning all
  185. segments are available at once.
  186. */
  187. setStatic(isStatic: any): void;
  188. /**
  189. * Gets the presentation's segment availability duration, which is the amount
  190. of time, in seconds, that the start of a segment remains available after the
  191. live-edge moves past the end of that segment. Infinity indicates that
  192. segments remain available indefinitely. For example, if your live
  193. presentation has a 5 minute DVR window and your segments are 10 seconds long
  194. then the segment availability duration should be 4 minutes and 50 seconds.
  195. * @returnType The presentation's segment availability duration.
  196. */
  197. getSegmentAvailabilityDuration(): any;
  198. /**
  199. * Sets the presentation's segment availability duration. The segment
  200. availability duration should only be set for live.
  201. * @param segmentAvailabilityDuration The presentation's new segment
  202. availability duration in seconds.
  203. */
  204. setSegmentAvailabilityDuration(segmentAvailabilityDuration: any): void;
  205. /**
  206. * Sets the presentation delay.
  207. */
  208. setDelay(delay: any): void;
  209. /**
  210. * Gives PresentationTimeline a Stream's segments so it can size and position
  211. the segment availability window, and account for missing segment
  212. information. This function should be called once for each Stream (no more,
  213. no less).
  214. */
  215. notifySegments(periodStartTime: any, references: any): void;
  216. /**
  217. * Gives PresentationTimeline a Stream's maximum segment duration so it can
  218. size and position the segment availability window. This function should be
  219. called once for each Stream (no more, no less), but does not have to be
  220. called if notifySegments() is called instead for a particular stream.
  221. * @param maxSegmentDuration The maximum segment duration for a
  222. particular stream.
  223. */
  224. notifyMaxSegmentDuration(maxSegmentDuration: any): void;
  225. /**
  226. * @returnType True if the presentation is live; otherwise, return
  227. false.
  228. */
  229. isLive(): any;
  230. /**
  231. * @returnType True if the presentation is in progress (meaning not live,
  232. but also not completely available); otherwise, return false.
  233. */
  234. isInProgress(): any;
  235. /**
  236. * Gets the presentation's current segment availability start time. Segments
  237. ending at or before this time should be assumed to be unavailable.
  238. * @returnType The current segment availability start time, in seconds,
  239. relative to the start of the presentation.
  240. */
  241. getSegmentAvailabilityStart(): any;
  242. /**
  243. * Gets the presentation's current segment availability start time, offset by
  244. the given amount. This is used to ensure that we don't "fall" back out of
  245. the availability window while we are buffering.
  246. * @param offset The offset to add to the start time.
  247. * @returnType The current segment availability start time, in seconds,
  248. relative to the start of the presentation.
  249. */
  250. getSafeAvailabilityStart(offset: any): any;
  251. /**
  252. * Sets the presentation's current segment availability start time.
  253. */
  254. setAvailabilityStart(time: any): void;
  255. /**
  256. * Gets the presentation's current segment availability end time. Segments
  257. starting after this time should be assumed to be unavailable.
  258. * @returnType The current segment availability end time, in seconds,
  259. relative to the start of the presentation. Always returns the
  260. presentation's duration for video-on-demand.
  261. */
  262. getSegmentAvailabilityEnd(): any;
  263. /**
  264. * Gets the seek range end.
  265. */
  266. getSeekRangeEnd(): any;
  267. }
  268. }
  269. namespace util {
  270. class Error {
  271. severity: any;
  272. category: any;
  273. code: any;
  274. data: any;
  275. handled: any;
  276. /**
  277. * Creates a new Error.
  278. */
  279. constructor(severity: any, category: any, code: any, var_args: any);
  280. }
  281. namespace Error {
  282. enum Severity {
  283. RECOVERABLE,
  284. CRITICAL,
  285. }
  286. enum Category {
  287. NETWORK,
  288. TEXT,
  289. MEDIA,
  290. MANIFEST,
  291. STREAMING,
  292. DRM,
  293. PLAYER,
  294. CAST,
  295. STORAGE,
  296. }
  297. enum Code {
  298. UNSUPPORTED_SCHEME,
  299. BAD_HTTP_STATUS,
  300. HTTP_ERROR,
  301. TIMEOUT,
  302. MALFORMED_DATA_URI,
  303. UNKNOWN_DATA_URI_ENCODING,
  304. REQUEST_FILTER_ERROR,
  305. RESPONSE_FILTER_ERROR,
  306. MALFORMED_TEST_URI,
  307. UNEXPECTED_TEST_REQUEST,
  308. INVALID_TEXT_HEADER,
  309. INVALID_TEXT_CUE,
  310. UNABLE_TO_DETECT_ENCODING,
  311. BAD_ENCODING,
  312. INVALID_XML,
  313. INVALID_MP4_TTML,
  314. INVALID_MP4_VTT,
  315. UNABLE_TO_EXTRACT_CUE_START_TIME,
  316. BUFFER_READ_OUT_OF_BOUNDS,
  317. JS_INTEGER_OVERFLOW,
  318. EBML_OVERFLOW,
  319. EBML_BAD_FLOATING_POINT_SIZE,
  320. MP4_SIDX_WRONG_BOX_TYPE,
  321. MP4_SIDX_INVALID_TIMESCALE,
  322. MP4_SIDX_TYPE_NOT_SUPPORTED,
  323. WEBM_CUES_ELEMENT_MISSING,
  324. WEBM_EBML_HEADER_ELEMENT_MISSING,
  325. WEBM_SEGMENT_ELEMENT_MISSING,
  326. WEBM_INFO_ELEMENT_MISSING,
  327. WEBM_DURATION_ELEMENT_MISSING,
  328. WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING,
  329. WEBM_CUE_TIME_ELEMENT_MISSING,
  330. MEDIA_SOURCE_OPERATION_FAILED,
  331. MEDIA_SOURCE_OPERATION_THREW,
  332. VIDEO_ERROR,
  333. QUOTA_EXCEEDED_ERROR,
  334. UNABLE_TO_GUESS_MANIFEST_TYPE,
  335. DASH_INVALID_XML,
  336. DASH_NO_SEGMENT_INFO,
  337. DASH_EMPTY_ADAPTATION_SET,
  338. DASH_EMPTY_PERIOD,
  339. DASH_WEBM_MISSING_INIT,
  340. DASH_UNSUPPORTED_CONTAINER,
  341. DASH_PSSH_BAD_ENCODING,
  342. DASH_NO_COMMON_KEY_SYSTEM,
  343. DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED,
  344. DASH_CONFLICTING_KEY_IDS,
  345. UNPLAYABLE_PERIOD,
  346. RESTRICTIONS_CANNOT_BE_MET,
  347. NO_PERIODS,
  348. HLS_PLAYLIST_HEADER_MISSING,
  349. INVALID_HLS_TAG,
  350. HLS_INVALID_PLAYLIST_HIERARCHY,
  351. DASH_DUPLICATE_REPRESENTATION_ID,
  352. HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND,
  353. HLS_COULD_NOT_GUESS_MIME_TYPE,
  354. HLS_MASTER_PLAYLIST_NOT_PROVIDED,
  355. HLS_REQUIRED_ATTRIBUTE_MISSING,
  356. HLS_REQUIRED_TAG_MISSING,
  357. HLS_COULD_NOT_GUESS_CODECS,
  358. HLS_KEYFORMATS_NOT_SUPPORTED,
  359. DASH_UNSUPPORTED_XLINK_ACTUATE,
  360. DASH_XLINK_DEPTH_LIMIT,
  361. HLS_COULD_NOT_PARSE_SEGMENT_START_TIME,
  362. INVALID_STREAMS_CHOSEN,
  363. NO_RECOGNIZED_KEY_SYSTEMS,
  364. REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE,
  365. FAILED_TO_CREATE_CDM,
  366. FAILED_TO_ATTACH_TO_VIDEO,
  367. INVALID_SERVER_CERTIFICATE,
  368. FAILED_TO_CREATE_SESSION,
  369. FAILED_TO_GENERATE_LICENSE_REQUEST,
  370. LICENSE_REQUEST_FAILED,
  371. LICENSE_RESPONSE_REJECTED,
  372. ENCRYPTED_CONTENT_WITHOUT_DRM_INFO,
  373. NO_LICENSE_SERVER_GIVEN,
  374. OFFLINE_SESSION_REMOVED,
  375. EXPIRED,
  376. LOAD_INTERRUPTED,
  377. OPERATION_ABORTED,
  378. CAST_API_UNAVAILABLE,
  379. NO_CAST_RECEIVERS,
  380. ALREADY_CASTING,
  381. UNEXPECTED_CAST_ERROR,
  382. CAST_CANCELED_BY_USER,
  383. CAST_CONNECTION_TIMED_OUT,
  384. CAST_RECEIVER_APP_UNAVAILABLE,
  385. STORAGE_NOT_SUPPORTED,
  386. INDEXED_DB_ERROR,
  387. DEPRECATED_OPERATION_ABORTED,
  388. REQUESTED_ITEM_NOT_FOUND,
  389. MALFORMED_OFFLINE_URI,
  390. CANNOT_STORE_LIVE_OFFLINE,
  391. STORE_ALREADY_IN_PROGRESS,
  392. NO_INIT_DATA_FOR_OFFLINE,
  393. LOCAL_PLAYER_INSTANCE_REQUIRED,
  394. CONTENT_UNSUPPORTED_BY_BROWSER,
  395. UNSUPPORTED_UPGRADE_REQUEST,
  396. }
  397. }
  398. namespace StringUtils {
  399. /**
  400. * Creates a string from the given buffer as UTF-8 encoding.
  401. */
  402. function fromUTF8(data: any): any;
  403. /**
  404. * Creates a string from the given buffer as UTF-16 encoding.
  405. * @param littleEndian true to read little endian, false to read big.
  406. * @param opt_noThrow true to avoid throwing in cases where we may
  407. expect invalid input. If noThrow is true and the data has an odd length,
  408. it will be truncated.
  409. */
  410. function fromUTF16(data: any, littleEndian: any, opt_noThrow?: any): any;
  411. /**
  412. * Creates a string from the given buffer, auto-detecting the encoding that is
  413. being used. If it cannot detect the encoding, it will throw an exception.
  414. */
  415. function fromBytesAutoDetect(data: any): any;
  416. /**
  417. * Creates a ArrayBuffer from the given string, converting to UTF-8 encoding.
  418. */
  419. function toUTF8(str: any): any;
  420. }
  421. class DataViewReader {
  422. /**
  423. * Creates a DataViewReader, which abstracts a DataView object.
  424. * @param dataView The DataView.
  425. * @param endianness The endianness.
  426. */
  427. constructor(dataView: any, endianness: any);
  428. /**
  429. * @returnType True if the reader has more data, false otherwise.
  430. */
  431. hasMoreData(): any;
  432. /**
  433. * Gets the current byte position.
  434. */
  435. getPosition(): any;
  436. /**
  437. * Gets the byte length of the DataView.
  438. */
  439. getLength(): any;
  440. /**
  441. * Reads an unsigned 8 bit integer, and advances the reader.
  442. * @returnType The integer.
  443. */
  444. readUint8(): any;
  445. /**
  446. * Reads an unsigned 16 bit integer, and advances the reader.
  447. * @returnType The integer.
  448. */
  449. readUint16(): any;
  450. /**
  451. * Reads an unsigned 32 bit integer, and advances the reader.
  452. * @returnType The integer.
  453. */
  454. readUint32(): any;
  455. /**
  456. * Reads a signed 32 bit integer, and advances the reader.
  457. * @returnType The integer.
  458. */
  459. readInt32(): any;
  460. /**
  461. * Reads an unsigned 64 bit integer, and advances the reader.
  462. * @returnType The integer.
  463. */
  464. readUint64(): any;
  465. /**
  466. * Reads the specified number of raw bytes.
  467. * @param bytes The number of bytes to read.
  468. */
  469. readBytes(bytes: any): any;
  470. /**
  471. * Skips the specified number of bytes.
  472. * @param bytes The number of bytes to skip.
  473. */
  474. skip(bytes: any): void;
  475. /**
  476. * Rewinds the specified number of bytes.
  477. * @param bytes The number of bytes to rewind.
  478. */
  479. rewind(bytes: any): void;
  480. /**
  481. * Seeks to a specified position.
  482. * @param position The desired byte position within the DataView.
  483. */
  484. seek(position: any): void;
  485. /**
  486. * Keeps reading until it reaches a byte that equals to zero. The text is
  487. assumed to be UTF-8.
  488. */
  489. readTerminatedString(): any;
  490. }
  491. namespace DataViewReader {
  492. /**
  493. * Endianness.
  494. */
  495. enum Endianness {
  496. BIG_ENDIAN,
  497. LITTLE_ENDIAN,
  498. }
  499. }
  500. class Mp4Parser {
  501. static ParsedBox: any;
  502. static CallbackType: any;
  503. /**
  504. * A callback that tells the Mp4 parser to treat the body of a box as a series
  505. of boxes. The number of boxes is limited by the size of the parent box.
  506. */
  507. static children(box: any): void;
  508. /**
  509. * A callback that tells the Mp4 parser to treat the body of a box as a sample
  510. description. A sample description box has a fixed number of children. The
  511. number of children is represented by a 4 byte unsigned integer. Each child
  512. is a box.
  513. */
  514. static sampleDescription(box: any): void;
  515. /**
  516. * Create a callback that tells the Mp4 parser to treat the body of a box as a
  517. binary blob and how to handle it.
  518. */
  519. static allData(callback: any): any;
  520. /**
  521. * Create a new MP4 Parser
  522. */
  523. constructor();
  524. /**
  525. * Delcare a box type as a Box.
  526. */
  527. box(type: any, definition: any): any;
  528. /**
  529. * Declare a box type as a Full Box.
  530. */
  531. fullBox(type: any, definition: any): any;
  532. /**
  533. * Stop parsing. Useful for extracting information from partial segments and
  534. avoiding an out-of-bounds error once you find what you are looking for.
  535. */
  536. stop(): void;
  537. /**
  538. * Parse the given data using the added callbacks.
  539. * @param opt_partialOkay If true, allow partial payload for some
  540. boxes. If the goal is a child box, we can sometimes find it without enough
  541. data to find all child boxes.
  542. */
  543. parse(data: any, opt_partialOkay?: any): void;
  544. /**
  545. * Parse the next box on the current level.
  546. * @param absStart The absolute start position in the original
  547. byte array.
  548. * @param opt_partialOkay If true, allow partial payload for some
  549. boxes. If the goal is a child box, we can sometimes find it without enough
  550. data to find all child boxes.
  551. */
  552. parseNext(absStart: any, reader: any, opt_partialOkay?: any): void;
  553. }
  554. /**
  555. * An interface to standardize how objects are destroyed.
  556. */
  557. interface IDestroyable {}
  558. /**
  559. * @description an interface defining events sent by shaka
  560. * @interface ShakaEvent
  561. */
  562. export interface ShakaEvent {
  563. type: string;
  564. }
  565. class FakeEventTarget {
  566. static ListenerType: any;
  567. /**
  568. * A work-alike for EventTarget. Only DOM elements may be true EventTargets,
  569. but this can be used as a base class to provide event dispatch to non-DOM
  570. classes. Only FakeEvents should be dispatched.
  571. */
  572. constructor();
  573. /**
  574. * Add an event listener to this object.
  575. * @param type The event type to listen for.
  576. * @param listener The callback or
  577. listener object to invoke.
  578. * @param opt_options Ignored.
  579. */
  580. addEventListener(type: string, listener: any, opt_options?: any): void;
  581. /**
  582. * Remove an event listener from this object.
  583. * @param type The event type for which you wish to remove a listener.
  584. * @param listener The callback or
  585. listener object to remove.
  586. * @param opt_options Ignored.
  587. */
  588. removeEventListener(type: string, listener: any, opt_options?: any): void;
  589. /**
  590. * Dispatch an event from this object.
  591. * @param event The event to be dispatched from this object.
  592. * @returnType True if the default action was prevented.
  593. */
  594. dispatchEvent(event: any): any;
  595. }
  596. namespace Uint8ArrayUtils {
  597. /**
  598. * Convert a Uint8Array to a base64 string. The output will always use the
  599. alternate encoding/alphabet also known as "base64url".
  600. * @param opt_padding If true, pad the output with equals signs.
  601. Defaults to true.
  602. */
  603. function toBase64(arr: any, opt_padding?: any): any;
  604. /**
  605. * Convert a base64 string to a Uint8Array. Accepts either the standard
  606. alphabet or the alternate "base64url" alphabet.
  607. */
  608. function fromBase64(str: any): any;
  609. /**
  610. * Convert a hex string to a Uint8Array.
  611. */
  612. function fromHex(str: any): any;
  613. /**
  614. * Convert a Uint8Array to a hex string.
  615. */
  616. function toHex(arr: any): any;
  617. /**
  618. * Compare two Uint8Arrays for equality.
  619. */
  620. function equal(arr1: any, arr2: any): any;
  621. /**
  622. * Concatenate Uint8Arrays.
  623. */
  624. function concat(var_args: any): any;
  625. }
  626. }
  627. namespace polyfill {
  628. /**
  629. * Install all polyfills.
  630. */
  631. function installAll(): void;
  632. /**
  633. * Registers a new polyfill to be installed.
  634. */
  635. function register(polyfill: any): void;
  636. }
  637. namespace cast {
  638. class CastProxy extends util.FakeEventTarget {
  639. /**
  640. * A proxy to switch between local and remote playback for Chromecast in a way
  641. that is transparent to the app's controls.
  642. * @param video The local video element associated with the
  643. local Player instance.
  644. * @param player A local Player instance.
  645. * @param receiverAppId The ID of the cast receiver application.
  646. */
  647. constructor(video: any, player: any, receiverAppId: any);
  648. /**
  649. * Destroys the proxy and the underlying local Player.
  650. * @param opt_forceDisconnect If true, force the receiver app to shut
  651. down by disconnecting. Does nothing if not connected.
  652. */
  653. destroy(opt_forceDisconnect?: any): void;
  654. /**
  655. * Get a proxy for the video element that delegates to local and remote video
  656. elements as appropriate.
  657. */
  658. getVideo(): any;
  659. /**
  660. * Get a proxy for the Player that delegates to local and remote Player objects
  661. as appropriate.
  662. */
  663. getPlayer(): any;
  664. /**
  665. * @returnType True if the cast API is available and there are receivers.
  666. */
  667. canCast(): any;
  668. /**
  669. * @returnType True if we are currently casting.
  670. */
  671. isCasting(): any;
  672. /**
  673. * @returnType The name of the Cast receiver device, if isCasting().
  674. */
  675. receiverName(): any;
  676. /**
  677. * @returnType Resolved when connected to a receiver. Rejected if the
  678. connection fails or is canceled by the user.
  679. */
  680. cast(): any;
  681. /**
  682. * Set application-specific data.
  683. * @param appData Application-specific data to relay to the receiver.
  684. */
  685. setAppData(appData: any): void;
  686. /**
  687. * Show a dialog where user can choose to disconnect from the cast connection.
  688. */
  689. suggestDisconnect(): void;
  690. /**
  691. * Force the receiver app to shut down by disconnecting.
  692. */
  693. forceDisconnect(): void;
  694. }
  695. class CastReceiver {
  696. /**
  697. * A receiver to communicate between the Chromecast-hosted player and the
  698. sender application.
  699. * @param video The local video element associated with the
  700. local Player instance.
  701. * @param player A local Player instance.
  702. * @param opt_appDataCallback A callback to handle
  703. application-specific data passed from the sender.
  704. * @param opt_contentIdCallback A callback to
  705. retrieve manifest URI from the provided content id.
  706. */
  707. constructor(
  708. video: any,
  709. player: any,
  710. opt_appDataCallback?: any,
  711. opt_contentIdCallback?: any
  712. );
  713. /**
  714. * @returnType True if the cast API is available and there are receivers.
  715. */
  716. isConnected(): any;
  717. /**
  718. * @returnType True if the receiver is not currently doing loading or
  719. playing anything.
  720. */
  721. isIdle(): any;
  722. /**
  723. * Destroys the underlying Player, then terminates the cast receiver app.
  724. */
  725. destroy(): void;
  726. }
  727. }
  728. namespace text {
  729. namespace TextEngine {
  730. function registerParser(mimeType: any, plugin: any): void;
  731. function unregisterParser(mimeType: any): void;
  732. namespace prototype {
  733. function setDisplayer(displayer: any): void;
  734. }
  735. }
  736. class Cue {
  737. startTime: any;
  738. endTime: any;
  739. payload: any;
  740. region: any;
  741. position: any;
  742. positionAlign: any;
  743. size: any;
  744. textAlign: any;
  745. writingDirection: any;
  746. lineInterpretation: any;
  747. line: any;
  748. lineHeight: any;
  749. lineAlign: any;
  750. displayAlign: any;
  751. color: any;
  752. backgroundColor: any;
  753. fontSize: any;
  754. fontWeight: any;
  755. fontStyle: any;
  756. fontFamily: any;
  757. textDecoration: any;
  758. wrapLine: any;
  759. id: any;
  760. /**
  761. * Creates a Cue object.
  762. */
  763. constructor(startTime: any, endTime: any, payload: any);
  764. }
  765. namespace Cue {
  766. enum positionAlign {
  767. LEFT,
  768. RIGHT,
  769. CENTER,
  770. AUTO,
  771. }
  772. enum textAlign {
  773. LEFT,
  774. RIGHT,
  775. CENTER,
  776. START,
  777. END,
  778. }
  779. enum displayAlign {
  780. BEFORE,
  781. CENTER,
  782. AFTER,
  783. }
  784. enum writingDirection {
  785. HORIZONTAL_LEFT_TO_RIGHT,
  786. HORIZONTAL_RIGHT_TO_LEFT,
  787. VERTICAL_LEFT_TO_RIGHT,
  788. VERTICAL_RIGHT_TO_LEFT,
  789. }
  790. enum lineInterpretation {
  791. LINE_NUMBER,
  792. PERCENTAGE,
  793. }
  794. enum lineAlign {
  795. CENTER,
  796. START,
  797. END,
  798. }
  799. /**
  800. * In CSS font weight can be a number, where 400 is normal
  801. and 700 is bold. Use these values for the enum for consistency.
  802. */
  803. enum fontWeight {
  804. NORMAL,
  805. BOLD,
  806. }
  807. enum fontStyle {
  808. NORMAL,
  809. ITALIC,
  810. OBLIQUE,
  811. }
  812. enum textDecoration {
  813. UNDERLINE,
  814. LINE_THROUGH,
  815. OVERLINE,
  816. }
  817. }
  818. class SimpleTextDisplayer {
  819. /**
  820. * <p>
  821. This defines the default text displayer plugin. An instance of this
  822. class is used when no custom displayer is given.
  823. </p>
  824. <p>
  825. This class simply converts shaka.text.Cue objects to
  826. TextTrackCues and feeds them to the browser.
  827. </p>
  828. */
  829. constructor(video: any);
  830. remove(start: any, end: any): void;
  831. append(cues: any): void;
  832. destroy(): void;
  833. isTextVisible(): void;
  834. setTextVisibility(on: any): void;
  835. }
  836. }
  837. namespace net {
  838. class NetworkingEngine {
  839. /**
  840. * Registers a scheme plugin. This plugin will handle all requests with the
  841. given scheme. If a plugin with the same scheme already exists, it is
  842. replaced, unless the existing plugin is of higher priority.
  843. If no priority is provided, this defaults to the highest priority of
  844. APPLICATION.
  845. */
  846. static registerScheme(scheme: any, plugin: any, opt_priority?: any): void;
  847. /**
  848. * Removes a scheme plugin.
  849. */
  850. static unregisterScheme(scheme: any): void;
  851. /**
  852. * NetworkingEngine wraps all networking operations. This accepts plugins that
  853. handle the actual request. A plugin is registered using registerScheme.
  854. Each scheme has at most one plugin to handle the request.
  855. * @param opt_onSegmentDownloaded Called
  856. when a segment is downloaded. Passed the duration, in milliseconds, that
  857. the request took; and the total number of bytes transferred.
  858. */
  859. constructor(opt_onSegmentDownloaded?: any);
  860. /**
  861. * Registers a new request filter. All filters are applied in the order they
  862. are registered.
  863. */
  864. registerRequestFilter(filter: any): void;
  865. /**
  866. * Removes a request filter.
  867. */
  868. unregisterRequestFilter(filter: any): void;
  869. /**
  870. * Clear all request filters.
  871. */
  872. clearAllRequestFilters(): void;
  873. /**
  874. * Registers a new response filter. All filters are applied in the order they
  875. are registered.
  876. */
  877. registerResponseFilter(filter: any): void;
  878. /**
  879. * Removes a response filter.
  880. */
  881. unregisterResponseFilter(filter: any): void;
  882. /**
  883. * Clear all response filters.
  884. */
  885. clearAllResponseFilters(): void;
  886. destroy(): void;
  887. /**
  888. * Makes a network request and returns the resulting data.
  889. */
  890. request(type: any, request: any): any;
  891. }
  892. namespace NetworkingEngine {
  893. /**
  894. * Request types. Allows a filter to decide which requests to read/alter.
  895. */
  896. enum RequestType {
  897. MANIFEST,
  898. SEGMENT,
  899. LICENSE,
  900. APP,
  901. }
  902. /**
  903. * Priority level for network scheme plugins.
  904. If multiple plugins are provided for the same scheme, only the
  905. highest-priority one is used.
  906. */
  907. enum PluginPriority {
  908. FALLBACK,
  909. PREFERRED,
  910. APPLICATION,
  911. }
  912. }
  913. /**
  914. * A networking plugin to handle data URIs.
  915. */
  916. function DataUriPlugin(uri: any, request: any): any;
  917. /**
  918. * A networking plugin to handle http and https URIs via XHR.
  919. */
  920. function HttpPlugin(uri: any, request: any): any;
  921. }
  922. namespace abr {
  923. class SimpleAbrManager {
  924. /**
  925. * <p>
  926. This defines the default ABR manager for the Player. An instance of this
  927. class is used when no ABR manager is given.
  928. </p>
  929. <p>
  930. The behavior of this class is to take throughput samples using
  931. segmentDownloaded to estimate the current network bandwidth. Then it will
  932. use that to choose the streams that best fit the current bandwidth. It will
  933. always pick the highest bandwidth variant it thinks can be played.
  934. </p>
  935. <p>
  936. After initial choices are made, this class will call switchCallback() when
  937. there is a better choice. switchCallback() will not be called more than once
  938. per ({@link shaka.abr.SimpleAbrManager.SWITCH_INTERVAL_MS}).
  939. </p>
  940. */
  941. constructor();
  942. stop(): void;
  943. init(switchCallback: any): void;
  944. chooseVariant(): void;
  945. enable(): void;
  946. disable(): void;
  947. segmentDownloaded(deltaTimeMs: any, numBytes: any): void;
  948. getBandwidthEstimate(): void;
  949. setVariants(variants: any): void;
  950. configure(config: any): void;
  951. }
  952. }
  953. namespace extern {
  954. /** define the TimelineRegionInfo from both doc and code */
  955. interface TimelineRegionInfo {
  956. schemeIdUri: string;
  957. value: string | number;
  958. startTime: number;
  959. endTime: number;
  960. id: number | string;
  961. eventElement?: any;
  962. messageData?: Uint8Array;
  963. }
  964. }
  965. /** Player events and map */
  966. namespace PlayerEvents {
  967. interface ErrorEvent extends util.ShakaEvent {
  968. type: 'error';
  969. details: util.Error;
  970. }
  971. interface DrmSessionUpdateEvent extends util.ShakaEvent {
  972. type: 'drmsessionupdate';
  973. }
  974. interface TimelineRegionAddedEvent extends util.ShakaEvent {
  975. type: 'timelineregionadded';
  976. details: extern.TimelineRegionInfo; // {shaka.extern.TimelineRegionInfo}
  977. }
  978. interface TimelineRegionEnterEvent extends util.ShakaEvent {
  979. type: 'timelineregionenter';
  980. details: extern.TimelineRegionInfo; // {shaka.extern.TimelineRegionInfo}
  981. }
  982. interface TimelineRegionExitEvent extends util.ShakaEvent {
  983. type: 'timelineregionexit';
  984. details: extern.TimelineRegionInfo; // {shaka.extern.TimelineRegionInfo}
  985. }
  986. interface BufferingEvent extends util.ShakaEvent {
  987. type: 'buffering';
  988. buffering: boolean;
  989. }
  990. interface LoadingEvent extends util.ShakaEvent {
  991. type: 'loading';
  992. }
  993. interface UnloadingEvent extends util.ShakaEvent {
  994. type: 'unloading';
  995. }
  996. interface TextTrackVisibilityEvent extends util.ShakaEvent {
  997. type: 'texttrackvisibility';
  998. }
  999. interface TracksChangedEvent extends util.ShakaEvent {
  1000. type: 'trackschanged';
  1001. }
  1002. interface AdaptationEvent extends util.ShakaEvent {
  1003. type: 'adaptation';
  1004. }
  1005. interface ExpirationUpdatedEvent extends util.ShakaEvent {
  1006. type: 'expirationupdated';
  1007. }
  1008. interface LargeGapEvent extends util.ShakaEvent {
  1009. type: 'largegap';
  1010. currentTime: number;
  1011. gaSize: number;
  1012. }
  1013. interface StreamingEvent extends util.ShakaEvent {
  1014. type: 'streaming';
  1015. }
  1016. interface PlayerEventMap {
  1017. error: ErrorEvent;
  1018. drmsessionupdate: DrmSessionUpdateEvent;
  1019. timelineregionadded: TimelineRegionAddedEvent;
  1020. timelineregionenter: TimelineRegionEnterEvent;
  1021. timelineregionexit: TimelineRegionExitEvent;
  1022. buffering: BufferingEvent;
  1023. loading: LoadingEvent;
  1024. unloading: UnloadingEvent;
  1025. texttrackvisibility: TextTrackVisibilityEvent;
  1026. trackschanged: TracksChangedEvent;
  1027. adaptation: AdaptationEvent;
  1028. expirationupdated: ExpirationUpdatedEvent;
  1029. largegap: LargeGapEvent;
  1030. streaming: StreamingEvent;
  1031. }
  1032. }
  1033. class Player extends util.FakeEventTarget {
  1034. addEventListener<K extends keyof PlayerEvents.PlayerEventMap>(
  1035. type: K,
  1036. listener: (this: Player, ev: PlayerEvents.PlayerEventMap[K]) => any,
  1037. opt_options?: any
  1038. ): void;
  1039. removeEventListener<K extends keyof PlayerEvents.PlayerEventMap>(
  1040. type: K,
  1041. listener: (this: Player, ev: PlayerEvents.PlayerEventMap[K]) => any,
  1042. opt_options?: any
  1043. ): void;
  1044. static readonly version: any;
  1045. /**
  1046. * Registers a plugin callback that will be called with support(). The
  1047. callback will return the value that will be stored in the return value from
  1048. support().
  1049. */
  1050. static registerSupportPlugin(name: any, callback: any): void;
  1051. /**
  1052. * Return whether the browser provides basic support. If this returns false,
  1053. Shaka Player cannot be used at all. In this case, do not construct a Player
  1054. instance and do not use the library.
  1055. */
  1056. static isBrowserSupported(): any;
  1057. /**
  1058. * Probes the browser to determine what features are supported. This makes a
  1059. number of requests to EME/MSE/etc which may result in user prompts. This
  1060. should only be used for diagnostics.
  1061. NOTE: This may show a request to the user for permission.
  1062. */
  1063. static probeSupport(): any;
  1064. /**
  1065. * Construct a Player.
  1066. * @param video Any existing TextTracks attached to this
  1067. element that were not created by Shaka will be disabled. A new TextTrack
  1068. may be created to display captions or subtitles.
  1069. * @param opt_dependencyInjector Optional callback
  1070. which is called to inject mocks into the Player. Used for testing.
  1071. */
  1072. constructor(video: any, opt_dependencyInjector?: any);
  1073. /**
  1074. * After destruction, a Player object cannot be used again.
  1075. */
  1076. destroy(): void;
  1077. /**
  1078. * Load a manifest.
  1079. * @param opt_startTime Optional start time, in seconds, to begin
  1080. playback. Defaults to 0 for VOD and to the live edge for live.
  1081. * @param opt_manifestParserFactory Optional manifest parser factory to override auto-detection or use an
  1082. unregistered parser.
  1083. * @returnType Resolved when the manifest has been loaded and playback
  1084. has begun; rejected when an error occurs or the call was interrupted by
  1085. destroy(), unload() or another call to load().
  1086. */
  1087. load(manifestUri: any, opt_startTime?: any, opt_manifestParserFactory?: any): any;
  1088. /**
  1089. * Configure the Player instance.
  1090. The config object passed in need not be complete. It will be merged with
  1091. the existing Player configuration.
  1092. Config keys and types will be checked. If any problems with the config
  1093. object are found, errors will be reported through logs.
  1094. * @param config This should follow the form of
  1095. {@link shakaExtern.PlayerConfiguration}, but you may omit any field you do
  1096. not wish to change.
  1097. */
  1098. configure(config: any): void;
  1099. /**
  1100. * Return a copy of the current configuration. Modifications of the returned
  1101. value will not affect the Player's active configuration. You must call
  1102. player.configure() to make changes.
  1103. */
  1104. getConfiguration(): any;
  1105. /**
  1106. * Reset configuration to default.
  1107. */
  1108. resetConfiguration(): void;
  1109. /**
  1110. * @returnType A reference to the HTML Media Element passed
  1111. in during initialization.
  1112. */
  1113. getMediaElement(): any;
  1114. /**
  1115. * @returnType A reference to the Player's networking
  1116. engine. Applications may use this to make requests through Shaka's
  1117. networking plugins.
  1118. */
  1119. getNetworkingEngine(): any;
  1120. /**
  1121. * @returnType If a manifest is loaded, returns the manifest URI given in
  1122. the last call to load(). Otherwise, returns null.
  1123. */
  1124. getManifestUri(): any;
  1125. /**
  1126. * @returnType True if the current stream is live. False otherwise.
  1127. */
  1128. isLive(): any;
  1129. /**
  1130. * @returnType True if the current stream is in-progress VOD.
  1131. False otherwise.
  1132. */
  1133. isInProgress(): any;
  1134. /**
  1135. * @returnType True for audio-only content. False otherwise.
  1136. */
  1137. isAudioOnly(): any;
  1138. /**
  1139. * Get the seekable range for the current stream.
  1140. */
  1141. seekRange(): any;
  1142. /**
  1143. * Get the key system currently being used by EME. This returns the empty
  1144. string if not using EME.
  1145. */
  1146. keySystem(): any;
  1147. /**
  1148. * Get the DrmInfo used to initialize EME. This returns null when not using
  1149. EME.
  1150. */
  1151. drmInfo(): any;
  1152. /**
  1153. * The next known expiration time for any EME session. If the sessions never
  1154. expire, or there are no EME sessions, this returns Infinity.
  1155. */
  1156. getExpiration(): any;
  1157. /**
  1158. * @returnType True if the Player is in a buffering state.
  1159. */
  1160. isBuffering(): any;
  1161. /**
  1162. * Unload the current manifest and make the Player available for re-use.
  1163. * @returnType Resolved when streaming has stopped and the previous
  1164. content, if any, has been unloaded.
  1165. */
  1166. unload(): any;
  1167. /**
  1168. * Gets the current effective playback rate. If using trick play, it will
  1169. return the current trick play rate; otherwise, it will return the video
  1170. playback rate.
  1171. */
  1172. getPlaybackRate(): any;
  1173. /**
  1174. * Skip through the content without playing. Simulated using repeated seeks.
  1175. Trick play will be canceled automatically if the playhead hits the beginning
  1176. or end of the seekable range for the content.
  1177. * @param rate The playback rate to simulate. For example, a rate of
  1178. 2.5 would result in 2.5 seconds of content being skipped every second.
  1179. To trick-play backward, use a negative rate.
  1180. */
  1181. trickPlay(rate: any): void;
  1182. /**
  1183. * Cancel trick-play.
  1184. */
  1185. cancelTrickPlay(): void;
  1186. /**
  1187. * Return a list of variant tracks available for the current
  1188. Period. If there are multiple Periods, then you must seek to the Period
  1189. before being able to switch.
  1190. */
  1191. getVariantTracks(): any;
  1192. /**
  1193. * Return a list of text tracks available for the current
  1194. Period. If there are multiple Periods, then you must seek to the Period
  1195. before being able to switch.
  1196. */
  1197. getTextTracks(): any;
  1198. /**
  1199. * Select a specific text track. Note that AdaptationEvents are not
  1200. fired for manual track selections.
  1201. */
  1202. selectTextTrack(track: any): void;
  1203. /**
  1204. * Select a specific track. Note that AdaptationEvents are not fired for manual
  1205. track selections.
  1206. */
  1207. selectVariantTrack(track: any, opt_clearBuffer?: any): void;
  1208. /**
  1209. * Return a list of audio language-role combinations available for the current
  1210. Period.
  1211. */
  1212. getAudioLanguagesAndRoles(): any;
  1213. /**
  1214. * Return a list of text language-role combinations available for the current
  1215. Period.
  1216. */
  1217. getTextLanguagesAndRoles(): any;
  1218. /**
  1219. * Return a list of audio languages available for the current
  1220. Period.
  1221. */
  1222. getAudioLanguages(): any;
  1223. /**
  1224. * Return a list of text languages available for the current
  1225. Period.
  1226. */
  1227. getTextLanguages(): any;
  1228. /**
  1229. * Sets currentAudioLanguage and currentVariantRole to the selected
  1230. language and role, and chooses new variant if need be.
  1231. */
  1232. selectAudioLanguage(language: any, opt_role?: any): void;
  1233. /**
  1234. * Sets currentTextLanguage and currentTextRole to the selected
  1235. language and role, and chooses new text stream if need be.
  1236. */
  1237. selectTextLanguage(language: any, opt_role?: any): void;
  1238. /**
  1239. * @returnType True if the current text track is visible.
  1240. */
  1241. isTextTrackVisible(): any;
  1242. /**
  1243. * Set the visibility of the current text track, if any.
  1244. */
  1245. setTextTrackVisibility(on: any): void;
  1246. /**
  1247. * Returns current playhead time as a Date.
  1248. */
  1249. getPlayheadTimeAsDate(): any;
  1250. /**
  1251. * Returns the presentation start time as a Date.
  1252. */
  1253. getPresentationStartTimeAsDate(): any;
  1254. /**
  1255. * Return the information about the current buffered ranges.
  1256. */
  1257. getBufferedInfo(): any;
  1258. /**
  1259. * Return playback and adaptation stats.
  1260. */
  1261. getStats(): any;
  1262. /**
  1263. * Adds the given text track to the current Period. Load() must resolve before
  1264. calling. The current Period or the presentation must have a duration. This
  1265. returns a Promise that will resolve when the track can be switched to and
  1266. will resolve with the track that was created.
  1267. */
  1268. addTextTrack(
  1269. uri: any,
  1270. language: any,
  1271. kind: any,
  1272. mime: any,
  1273. opt_codec?: any,
  1274. opt_label?: any
  1275. ): any;
  1276. /**
  1277. * Set the maximum resolution that the platform's hardware can handle.
  1278. This will be called automatically by shaka.cast.CastReceiver to enforce
  1279. limitations of the Chromecast hardware.
  1280. */
  1281. setMaxHardwareResolution(width: any, height: any): void;
  1282. /**
  1283. * Retry streaming after a failure. Does nothing if not in a failure state.
  1284. * @returnType False if unable to retry.
  1285. */
  1286. retryStreaming(): any;
  1287. /**
  1288. * Return the manifest information if it's loaded. Otherwise, return null.
  1289. */
  1290. getManifest(): any;
  1291. }
  1292. namespace offline {
  1293. /**
  1294. * A plugin that handles requests for offline content.
  1295. */
  1296. function OfflineScheme(uri: any, request: any): any;
  1297. class Storage {
  1298. /**
  1299. * Gets whether offline storage is supported. Returns true if offline storage
  1300. is supported for clear content. Support for offline storage of encrypted
  1301. content will not be determined until storage is attempted.
  1302. */
  1303. static support(): any;
  1304. /**
  1305. * Delete the on-disk storage and all content it contains. This should not
  1306. be done regularly, only when storage is rendered unusable.
  1307. */
  1308. static deleteAll(): any;
  1309. /**
  1310. * This manages persistent offline data including storage, listing, and deleting
  1311. stored manifests. Playback of offline manifests are done using Player
  1312. using the special URI (see shaka.offline.OfflineUri).
  1313. First, check support() to see if offline is supported by the platform.
  1314. Second, configure() the storage object with callbacks to your application.
  1315. Third, call store(), remove(), or list() as needed.
  1316. When done, call destroy().
  1317. * @param player The player instance to pull configuration data from.
  1318. */
  1319. constructor(player: any);
  1320. destroy(): void;
  1321. /**
  1322. * Sets configuration values for Storage. This is not associated with
  1323. Player.configure and will not change Player.
  1324. There are two important callbacks configured here: one for download progress,
  1325. and one to decide which tracks to store.
  1326. The default track selection callback will store the largest SD video track.
  1327. Provide your own callback to choose the tracks you want to store.
  1328. * @param config This should follow the form of
  1329. {@link shakaExtern.OfflineConfiguration}, but you may omit any field you do
  1330. not wish to change.
  1331. */
  1332. configure(config: any): void;
  1333. /**
  1334. * Stores the given manifest. If the content is encrypted, and encrypted
  1335. content cannot be stored on this platform, the Promise will be rejected with
  1336. error code 6001, REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE.
  1337. * @param manifestUri The URI of the manifest to store.
  1338. * @param opt_appMetadata An arbitrary object from the application
  1339. that will be stored along-side the offline content. Use this for any
  1340. application-specific metadata you need associated with the stored content.
  1341. For details on the data types that can be stored here, please refer to
  1342. {@link https://goo.gl/h62coS}
  1343. * @returnType A Promise to a structure
  1344. representing what was stored. The "offlineUri" member is the URI that
  1345. should be given to Player.load() to play this piece of content offline.
  1346. The "appMetadata" member is the appMetadata argument you passed to store().
  1347. */
  1348. store(manifestUri: any, opt_appMetadata?: any, opt_manifestParserFactory?: any): any;
  1349. /**
  1350. * Removes the given stored content.
  1351. */
  1352. remove(contentUri: any): any;
  1353. /**
  1354. * Lists all the stored content available.
  1355. * @returnType A Promise to an
  1356. array of structures representing all stored content. The "offlineUri"
  1357. member of the structure is the URI that should be given to Player.load()
  1358. to play this piece of content offline. The "appMetadata" member is the
  1359. appMetadata argument you passed to store().
  1360. */
  1361. list(): any;
  1362. }
  1363. }
  1364. namespace hls {
  1365. class HlsParser {
  1366. /**
  1367. * Creates a new HLS parser.
  1368. */
  1369. constructor();
  1370. configure(config: any): void;
  1371. start(uri: any, playerInterface: any): void;
  1372. stop(): void;
  1373. update(): void;
  1374. onExpirationUpdated(sessionId: any, expiration: any): void;
  1375. }
  1376. }
  1377. namespace dash {
  1378. class DashParser {
  1379. /**
  1380. * Creates a new DASH parser.
  1381. */
  1382. constructor();
  1383. configure(config: any): void;
  1384. start(uri: any, playerInterface: any): void;
  1385. stop(): void;
  1386. update(): void;
  1387. onExpirationUpdated(sessionId: any, expiration: any): void;
  1388. }
  1389. }
  1390. }
  1391. //tslint:disable-next-line:no-single-declare-module
  1392. declare module 'shaka-player' {
  1393. export = shaka;
  1394. }