Source: lib/device/i_device.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2025 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. goog.provide('shaka.device.IDevice');
  7. /**
  8. * @interface
  9. */
  10. shaka.device.IDevice = class {
  11. /**
  12. * Check if the current platform supports media source. We assume that if
  13. * the current platform supports media source, then we can use media source
  14. * as per its design.
  15. *
  16. * @return {boolean}
  17. */
  18. supportsMediaSource() {}
  19. /**
  20. * Returns true if the media type is supported natively by the platform.
  21. *
  22. * @param {string} mimeType
  23. * @return {boolean}
  24. */
  25. supportsMediaType(mimeType) {}
  26. /**
  27. * @return {boolean}
  28. */
  29. supportsMediaCapabilities() {}
  30. /**
  31. * Version of device or null if unknown.
  32. * @return {?number}
  33. */
  34. getVersion() {}
  35. /**
  36. * Friendly device name.
  37. * @return {string}
  38. */
  39. getDeviceName() {}
  40. /**
  41. * @return {!shaka.device.IDevice.DeviceType}
  42. */
  43. getDeviceType() {}
  44. /**
  45. * @return {!shaka.device.IDevice.BrowserEngine}
  46. */
  47. getBrowserEngine() {}
  48. /**
  49. * Returns true if the platform requires encryption information in all init
  50. * segments. For such platforms, MediaSourceEngine will attempt to work
  51. * around a lack of such info by inserting fake encryption information into
  52. * initialization segments.
  53. *
  54. * @param {?string} keySystem
  55. * @param {?string} contentType
  56. * @return {boolean}
  57. * @see https://github.com/shaka-project/shaka-player/issues/2759
  58. */
  59. requiresEncryptionInfoInAllInitSegments(keySystem, contentType) {}
  60. /**
  61. * Returns true if the platform requires both clear & encryption information
  62. * in clear init segments. For such platforms, MediaSourceEngine will attempt
  63. * to work around a lack of such info by inserting fake information into
  64. * initialization segments. It is called only when
  65. * <code>requiresEncryptionInfoInAllInitSegments()</code> is also true
  66. * and works as the extension of it.
  67. *
  68. * @return {boolean}
  69. * @see https://github.com/shaka-project/shaka-player/pull/6719
  70. */
  71. requiresClearAndEncryptedInitSegments() {}
  72. /**
  73. * Indicates should the encryption data be inserted before or after
  74. * the clear data in the init segment.
  75. * @return {boolean}
  76. */
  77. insertEncryptionDataBeforeClear() {}
  78. /**
  79. * @param {string} contentType
  80. * @return {boolean}
  81. */
  82. requiresTfhdFix(contentType) {}
  83. /**
  84. * Returns true if the platform requires AC-3 signalling in init
  85. * segments to be replaced with EC-3 signalling.
  86. * For such platforms, MediaSourceEngine will attempt to work
  87. * around it by inserting fake EC-3 signalling into
  88. * initialization segments.
  89. *
  90. * @return {boolean}
  91. */
  92. requiresEC3InitSegments() {}
  93. /**
  94. * Returns true if the platform supports SourceBuffer "sequence mode".
  95. *
  96. * @return {boolean}
  97. */
  98. supportsSequenceMode() {}
  99. /**
  100. * Returns if codec switching SMOOTH is known reliable device support.
  101. *
  102. * Some devices are known not to support <code>SourceBuffer.changeType</code>
  103. * well. These devices should use the reload strategy. If a device
  104. * reports that it supports <code<changeType</code> but supports it unreliably
  105. * it should be disallowed in this method.
  106. *
  107. * @return {boolean}
  108. */
  109. supportsSmoothCodecSwitching() {}
  110. /**
  111. * On some platforms, the act of seeking can take a significant amount
  112. * of time, so we need to delay a seek.
  113. * @return {number}
  114. */
  115. seekDelay() {}
  116. /**
  117. * Detect the maximum resolution that the platform's hardware can handle.
  118. *
  119. * @return {!Promise<shaka.extern.Resolution>}
  120. */
  121. detectMaxHardwareResolution() {}
  122. /**
  123. * @return {boolean}
  124. */
  125. supportsServerCertificate() {}
  126. /**
  127. * Adjusts player configuration with device specific tweaks. Changes are done
  128. * in-place and the same object is returned.
  129. * @param {shaka.extern.PlayerConfiguration} config
  130. * @return {shaka.extern.PlayerConfiguration}
  131. */
  132. adjustConfig(config) {}
  133. /**
  134. * Checks should Dolby Vision codecs be overridden to their H.264 and H.265
  135. * equivalents.
  136. * @return {boolean}
  137. */
  138. shouldOverrideDolbyVisionCodecs() {}
  139. /**
  140. * Indicates whether or not to use window.TextDecoder and window.TextEncoder
  141. * even if they are available
  142. * @return {boolean}
  143. */
  144. shouldAvoidUseTextDecoderEncoder() {}
  145. /**
  146. * Checks does the platform supports offline storage by IDB.
  147. * @return {boolean}
  148. */
  149. supportsOfflineStorage() {}
  150. /**
  151. * Lists all codecs that should be rejected by MediaSource.
  152. * @return {!Array<string>}
  153. */
  154. rejectCodecs() {}
  155. /**
  156. * Check the current HDR level supported by the screen.
  157. *
  158. * @param {boolean} preferHLG
  159. * @return {string}
  160. */
  161. getHdrLevel(preferHLG) {}
  162. /**
  163. * @return {boolean}
  164. */
  165. supportsAirPlay() {}
  166. /**
  167. * @return {boolean}
  168. */
  169. misreportAC3UsingDrm() {}
  170. /**
  171. * @return {boolean}
  172. */
  173. returnLittleEndianUsingPlayReady() {}
  174. /**
  175. * @return {boolean}
  176. */
  177. supportsEncryptionSchemePolyfill() {}
  178. /**
  179. * @return {boolean}
  180. */
  181. misreportsSupportForPersistentLicenses() {}
  182. /**
  183. * @return {boolean}
  184. */
  185. supportStandardVP9Checking() {}
  186. /**
  187. * @return {boolean}
  188. */
  189. createMediaKeysWhenCheckingSupport() {}
  190. /**
  191. * @return {boolean}
  192. */
  193. disableHEVCSupport() {}
  194. };
  195. /**
  196. * @enum {string}
  197. */
  198. shaka.device.IDevice.DeviceType = {
  199. 'DESKTOP': 'DESKTOP',
  200. 'MOBILE': 'MOBILE',
  201. 'TV': 'TV',
  202. 'VR': 'VR',
  203. 'CONSOLE': 'CONSOLE',
  204. 'CAST': 'CAST',
  205. };
  206. /**
  207. * @enum {string}
  208. */
  209. shaka.device.IDevice.BrowserEngine = {
  210. 'CHROMIUM': 'CHROMIUM',
  211. 'EDGE': 'EDGE',
  212. 'GECKO': 'GECKO',
  213. 'WEBKIT': 'WEBKIT',
  214. 'UNKNOWN': 'UNKNOWN',
  215. };