Source: externs/shaka/ads.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2016 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @externs
  8. */
  9. /**
  10. * @typedef {{
  11. * loadTimes: !Array.<number>,
  12. * started: number,
  13. * playedCompletely: number,
  14. * skipped: number
  15. * }}
  16. *
  17. * @description
  18. * Contains statistics and information about the current state of the player.
  19. *
  20. * @property {number} loadTimes
  21. * The set of amounts of time it took to get the final manifest.
  22. * @property {number} started
  23. * The number of ads started.
  24. * @property {number} playedCompletely
  25. * The number of ads played completely.
  26. * @property {number} skipped
  27. * The number of ads skipped.
  28. * @exportDoc
  29. */
  30. shaka.extern.AdsStats;
  31. /**
  32. * @typedef {{
  33. * start: number,
  34. * end: ?number
  35. * }}
  36. *
  37. * @description
  38. * Contains the times of a range of an Ad.
  39. *
  40. * @property {number} start
  41. * The start time of the range, in milliseconds.
  42. * @property {number} end
  43. * The end time of the range, in milliseconds.
  44. * @exportDoc
  45. */
  46. shaka.extern.AdCuePoint;
  47. /**
  48. * An object that's responsible for all the ad-related logic
  49. * in the player.
  50. *
  51. * @interface
  52. * @exportDoc
  53. */
  54. shaka.extern.IAdManager = class extends EventTarget {
  55. /**
  56. * @param {string} locale
  57. */
  58. setLocale(locale) {}
  59. /**
  60. * Called by the Player to provide an updated configuration any time it
  61. * changes.
  62. * Must be called at least once before init*().
  63. *
  64. * @param {shaka.extern.AdsConfiguration} config
  65. */
  66. configure(config) {}
  67. release() {}
  68. onAssetUnload() {}
  69. /**
  70. * @param {!HTMLElement} adContainer
  71. * @param {!HTMLMediaElement} video
  72. * @param {?google.ima.AdsRenderingSettings} adsRenderingSettings
  73. */
  74. initClientSide(adContainer, video, adsRenderingSettings) {}
  75. /**
  76. * @param {!google.ima.AdsRequest} imaRequest
  77. */
  78. requestClientSideAds(imaRequest) {}
  79. /**
  80. * @param {!google.ima.AdsRenderingSettings} adsRenderingSettings
  81. */
  82. updateClientSideAdsRenderingSettings(adsRenderingSettings) {}
  83. /**
  84. * @param {!HTMLElement} adContainer
  85. * @param {!shaka.net.NetworkingEngine} networkingEngine
  86. * @param {!HTMLMediaElement} video
  87. */
  88. initMediaTailor(adContainer, networkingEngine, video) {}
  89. /**
  90. * @param {string} url
  91. * @param {Object} adsParams
  92. * @param {string=} backupUrl
  93. * @return {!Promise.<string>}
  94. */
  95. requestMediaTailorStream(url, adsParams, backupUrl) {}
  96. /**
  97. * @param {string} url
  98. */
  99. addMediaTailorTrackingUrl(url) {}
  100. /**
  101. * @param {!HTMLElement} adContainer
  102. * @param {!HTMLMediaElement} video
  103. */
  104. initServerSide(adContainer, video) {}
  105. /**
  106. * @param {!google.ima.dai.api.StreamRequest} imaRequest
  107. * @param {string=} backupUrl
  108. * @return {!Promise.<string>}
  109. */
  110. requestServerSideStream(imaRequest, backupUrl) {}
  111. /**
  112. * @param {Object} adTagParameters
  113. */
  114. replaceServerSideAdTagParameters(adTagParameters) {}
  115. /**
  116. * @return {!Array.<!shaka.extern.AdCuePoint>}
  117. */
  118. getServerSideCuePoints() {}
  119. /**
  120. * @return {!Array.<!shaka.extern.AdCuePoint>}
  121. */
  122. getCuePoints() {}
  123. /**
  124. * Get statistics for the current playback session. If the player is not
  125. * playing content, this will return an empty stats object.
  126. */
  127. getStats() {}
  128. /**
  129. * @param {shaka.extern.TimelineRegionInfo} region
  130. */
  131. onDashTimedMetadata(region) {}
  132. /**
  133. * Fired when the manifest is updated.
  134. *
  135. * @param {boolean} isLive
  136. */
  137. onManifestUpdated(isLive) {}
  138. /**
  139. * @param {shaka.extern.ID3Metadata} metadata
  140. * @param {number} timestampOffset
  141. */
  142. onHlsTimedMetadata(metadata, timestampOffset) {}
  143. /**
  144. * @param {shaka.extern.MetadataFrame} value
  145. */
  146. onCueMetadataChange(value) {}
  147. };
  148. /**
  149. * A factory for creating the ad manager.
  150. *
  151. * @typedef {function():!shaka.extern.IAdManager}
  152. * @exportDoc
  153. */
  154. shaka.extern.IAdManager.Factory;
  155. /**
  156. * Interface for Ad objects.
  157. *
  158. * @extends {shaka.util.IReleasable}
  159. * @interface
  160. * @exportDoc
  161. */
  162. shaka.extern.IAd = class {
  163. /**
  164. * @return {number}
  165. */
  166. getDuration() {}
  167. /**
  168. * Gets the minimum suggested duration. Defaults to being equivalent to
  169. * getDuration() for server-side ads.
  170. * @see http://bit.ly/3q3U6hI
  171. * @return {number}
  172. */
  173. getMinSuggestedDuration() {}
  174. /**
  175. * @return {number}
  176. */
  177. getRemainingTime() {}
  178. /**
  179. * @return {number}
  180. */
  181. getTimeUntilSkippable() {}
  182. /**
  183. * @return {boolean}
  184. */
  185. isPaused() {}
  186. /**
  187. * @return {boolean}
  188. */
  189. isSkippable() {}
  190. /**
  191. * @return {boolean}
  192. */
  193. canSkipNow() {}
  194. skip() {}
  195. play() {}
  196. pause() {}
  197. /**
  198. * @return {number}
  199. */
  200. getVolume() {}
  201. /**
  202. * @param {number} volume
  203. */
  204. setVolume(volume) {}
  205. /**
  206. * @return {boolean}
  207. */
  208. isMuted() {}
  209. /**
  210. * @param {boolean} muted
  211. */
  212. setMuted(muted) {}
  213. /**
  214. * @return {boolean}
  215. */
  216. isLinear() {}
  217. /**
  218. * @param {number} width
  219. * @param {number} height
  220. */
  221. resize(width, height) {}
  222. /**
  223. * @return {number}
  224. */
  225. getSequenceLength() {}
  226. /**
  227. * @return {number}
  228. */
  229. getPositionInSequence() {}
  230. /**
  231. * @return {string}
  232. */
  233. getTitle() {}
  234. /**
  235. * @return {string}
  236. */
  237. getDescription() {}
  238. /**
  239. * @return {number}
  240. */
  241. getVastMediaBitrate() {}
  242. /**
  243. * @return {number}
  244. */
  245. getVastMediaHeight() {}
  246. /**
  247. * @return {number}
  248. */
  249. getVastMediaWidth() {}
  250. /**
  251. * @return {string}
  252. */
  253. getAdId() {}
  254. /**
  255. * @return {string}
  256. */
  257. getCreativeAdId() {}
  258. /**
  259. * @return {string}
  260. */
  261. getAdvertiserName() {}
  262. /**
  263. * @return {?string}
  264. */
  265. getMediaUrl() {}
  266. /**
  267. * @return {number}
  268. */
  269. getTimeOffset() {}
  270. /**
  271. * @return {number}
  272. */
  273. getPodIndex() {}
  274. };