@gcorevideo/player 2.18.3 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/assets/audio-selector/style.scss +156 -0
  2. package/assets/audio-selector/track-selector.ejs +12 -0
  3. package/assets/big-mute-button/big-mute-button.ejs +3 -0
  4. package/assets/big-mute-button/big-mute-button.scss +57 -0
  5. package/assets/bottom-gear/bottomgear.ejs +12 -0
  6. package/assets/bottom-gear/gear-sub-menu.scss +95 -0
  7. package/assets/bottom-gear/gear.scss +79 -0
  8. package/assets/clappr-nerd-stats/button.ejs +4 -0
  9. package/assets/clappr-nerd-stats/clappr-nerd-stats.ejs +212 -0
  10. package/assets/clappr-nerd-stats/clappr-nerd-stats.scss +488 -0
  11. package/assets/clappr-nerd-stats/options-list.ejs +9 -0
  12. package/assets/clappr-nerd-stats/settings.ejs +12 -0
  13. package/assets/clappr-nerd-stats/speedtest/speedtest.worker.js +775 -0
  14. package/assets/clips/clips.scss +3 -0
  15. package/assets/context-menu/context_menu.ejs +8 -0
  16. package/assets/context-menu/context_menu.scss +31 -0
  17. package/assets/dvr-controls/dvr_controls.scss +136 -0
  18. package/assets/dvr-controls/index.ejs +2 -0
  19. package/assets/error-screen/error_screen.ejs +13 -0
  20. package/assets/error-screen/error_screen.scss +40 -0
  21. package/assets/icons/new/arrow-left.svg +5 -0
  22. package/assets/icons/new/arrow-right.svg +5 -0
  23. package/assets/icons/new/check.svg +5 -0
  24. package/assets/icons/new/close.svg +12 -0
  25. package/assets/icons/new/full.svg +8 -0
  26. package/assets/icons/new/fullscreen-off.svg +14 -0
  27. package/assets/icons/new/fullscreen-on.svg +14 -0
  28. package/assets/icons/new/gear-hd.svg +16 -0
  29. package/assets/icons/new/gear.svg +12 -0
  30. package/assets/icons/new/hd.svg +8 -0
  31. package/assets/icons/new/pause.svg +5 -0
  32. package/assets/icons/new/pip.svg +5 -0
  33. package/assets/icons/new/play.svg +10 -0
  34. package/assets/icons/new/replayleft.svg +5 -0
  35. package/assets/icons/new/replayright.svg +5 -0
  36. package/assets/icons/new/speed.svg +5 -0
  37. package/assets/icons/new/stats.svg +3 -0
  38. package/assets/icons/new/stop.svg +3 -0
  39. package/assets/icons/new/subtitles-off.svg +5 -0
  40. package/assets/icons/new/subtitles-on.svg +6 -0
  41. package/assets/icons/new/volume-max.svg +5 -0
  42. package/assets/icons/new/volume-min.svg +5 -0
  43. package/assets/icons/new/volume-off.svg +5 -0
  44. package/assets/icons/old/cardboard.svg +4 -0
  45. package/assets/icons/old/close-share.svg +13 -0
  46. package/assets/icons/old/close.svg +13 -0
  47. package/assets/icons/old/fb.svg +13 -0
  48. package/assets/icons/old/fullscreen.svg +12 -0
  49. package/assets/icons/old/language.svg +1 -0
  50. package/assets/icons/old/pause.svg +12 -0
  51. package/assets/icons/old/play.svg +12 -0
  52. package/assets/icons/old/quality-arrow.svg +13 -0
  53. package/assets/icons/old/reload.svg +4 -0
  54. package/assets/icons/old/share.svg +13 -0
  55. package/assets/icons/old/sound-off.svg +15 -0
  56. package/assets/icons/old/sound-on.svg +15 -0
  57. package/assets/icons/old/streams.svg +3 -0
  58. package/assets/icons/old/twitter.svg +13 -0
  59. package/assets/icons/old/wn.svg +15 -0
  60. package/assets/icons/standard/01-play.svg +3 -0
  61. package/assets/icons/standard/02-pause.svg +3 -0
  62. package/assets/icons/standard/03-stop.svg +3 -0
  63. package/assets/icons/standard/04-volume.svg +3 -0
  64. package/assets/icons/standard/05-mute.svg +3 -0
  65. package/assets/icons/standard/06-expand.svg +3 -0
  66. package/assets/icons/standard/07-shrink.svg +3 -0
  67. package/assets/icons/standard/08-hd.svg +3 -0
  68. package/assets/icons/standard/09-cc.svg +8 -0
  69. package/assets/icons/standard/10-reload.svg +4 -0
  70. package/assets/level-selector/button.ejs +8 -0
  71. package/assets/level-selector/list.ejs +22 -0
  72. package/assets/level-selector/style.scss +4 -0
  73. package/assets/logo/styles/logo.scss +10 -0
  74. package/assets/logo/templates/logo.ejs +3 -0
  75. package/assets/media-control/closed-hand.cur +0 -0
  76. package/assets/media-control/container.scss +57 -0
  77. package/assets/media-control/media-control.ejs +133 -0
  78. package/assets/media-control/media-control.scss +390 -0
  79. package/assets/media-control/plugins.scss +94 -0
  80. package/assets/media-control/width270.scss +50 -0
  81. package/assets/media-control/width370.scss +263 -0
  82. package/assets/multi-camera/multicamera.ejs +29 -0
  83. package/assets/multi-camera/style.scss +176 -0
  84. package/assets/picture-in-picture/button.ejs +3 -0
  85. package/assets/picture-in-picture/button.scss +11 -0
  86. package/assets/playback-rate/button.ejs +6 -0
  87. package/assets/playback-rate/list.ejs +14 -0
  88. package/assets/playback-rate/playback-rate-selector.ejs +9 -0
  89. package/assets/poster/poster.ejs +1 -0
  90. package/assets/poster/poster.scss +32 -0
  91. package/assets/seek-time/seek-time.html +2 -0
  92. package/assets/seek-time/seek-time.scss +38 -0
  93. package/assets/share/share.ejs +37 -0
  94. package/assets/share/style.scss +104 -0
  95. package/assets/skip-time/skip-time.ejs +8 -0
  96. package/assets/skip-time/style.scss +24 -0
  97. package/assets/spinner-three-bounce/spinner.ejs +3 -0
  98. package/assets/spinner-three-bounce/spinner.scss +44 -0
  99. package/assets/style/main.scss +50 -0
  100. package/assets/style/theme.scss +42 -0
  101. package/assets/style/variables.scss +7 -0
  102. package/assets/subtitles/combobox copy.ejs +16 -0
  103. package/assets/subtitles/combobox.ejs +16 -0
  104. package/assets/subtitles/string.ejs +3 -0
  105. package/assets/subtitles/style.scss +99 -0
  106. package/assets/thumbnails/scrub-thumbnails.ejs +10 -0
  107. package/assets/thumbnails/style.scss +75 -0
  108. package/assets/vast-ads/style.scss +112 -0
  109. package/assets/video360/button.ejs +1 -0
  110. package/assets/video360/style.scss +8 -0
  111. package/build/vite-raw-plugin.js +18 -0
  112. package/dist/index.js +1 -1
  113. package/dist/plugins/index.css +2164 -0
  114. package/dist/plugins/index.js/index.plugins.js +40837 -0
  115. package/dist/plugins/index.plugins.js +40837 -0
  116. package/lib/index.core.d.ts +15 -0
  117. package/lib/index.core.d.ts.map +1 -0
  118. package/lib/index.core.js +14 -0
  119. package/lib/index.d.ts +2 -14
  120. package/lib/index.d.ts.map +1 -1
  121. package/lib/index.js +2 -14
  122. package/lib/index.plugins.d.ts +38 -0
  123. package/lib/index.plugins.d.ts.map +1 -0
  124. package/lib/index.plugins.js +40 -0
  125. package/lib/plugins/audio-selector/AudioSelector.d.ts +3 -3
  126. package/lib/plugins/audio-selector/AudioSelector.d.ts.map +1 -1
  127. package/lib/plugins/audio-selector/AudioSelector.js +6 -12
  128. package/lib/plugins/big-mute-button/BigMuteButton.d.ts +2 -2
  129. package/lib/plugins/big-mute-button/BigMuteButton.d.ts.map +1 -1
  130. package/lib/plugins/big-mute-button/BigMuteButton.js +7 -12
  131. package/lib/plugins/bottom-gear/BottomGear.d.ts +4 -3
  132. package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
  133. package/lib/plugins/bottom-gear/BottomGear.js +11 -16
  134. package/lib/plugins/build.d.ts +2 -0
  135. package/lib/plugins/build.d.ts.map +1 -0
  136. package/lib/plugins/build.js +1 -0
  137. package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts +44 -0
  138. package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts.map +1 -0
  139. package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.js +294 -0
  140. package/lib/plugins/clappr-nerd-stats/formatter.d.ts +8 -0
  141. package/lib/plugins/clappr-nerd-stats/formatter.d.ts.map +1 -0
  142. package/lib/plugins/clappr-nerd-stats/formatter.js +91 -0
  143. package/lib/plugins/clappr-nerd-stats/speedtest/Speedtest.d.ts +54 -0
  144. package/lib/plugins/clappr-nerd-stats/speedtest/Speedtest.d.ts.map +1 -0
  145. package/lib/plugins/clappr-nerd-stats/speedtest/Speedtest.js +335 -0
  146. package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts +9 -0
  147. package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts.map +1 -0
  148. package/lib/plugins/clappr-nerd-stats/speedtest/index.js +154 -0
  149. package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts +6 -0
  150. package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts.map +1 -0
  151. package/lib/plugins/clappr-nerd-stats/speedtest/types.js +1 -0
  152. package/lib/plugins/clappr-nerd-stats/types.d.ts +4 -0
  153. package/lib/plugins/clappr-nerd-stats/types.d.ts.map +1 -0
  154. package/lib/plugins/clappr-nerd-stats/types.js +1 -0
  155. package/lib/plugins/clappr-stats/ClapprStats.d.ts +56 -0
  156. package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -0
  157. package/lib/plugins/clappr-stats/ClapprStats.js +332 -0
  158. package/lib/plugins/clappr-stats/types.d.ts +50 -0
  159. package/lib/plugins/clappr-stats/types.d.ts.map +1 -0
  160. package/lib/plugins/clappr-stats/types.js +5 -0
  161. package/lib/plugins/clappr-stats/utils.d.ts +3 -0
  162. package/lib/plugins/clappr-stats/utils.d.ts.map +1 -0
  163. package/lib/plugins/clappr-stats/utils.js +40 -0
  164. package/lib/plugins/click-to-pause/ClickToPause.d.ts +2 -2
  165. package/lib/plugins/click-to-pause/ClickToPause.d.ts.map +1 -1
  166. package/lib/plugins/click-to-pause/ClickToPause.js +4 -6
  167. package/lib/plugins/clips/Clips.d.ts +23 -0
  168. package/lib/plugins/clips/Clips.d.ts.map +1 -0
  169. package/lib/plugins/clips/Clips.js +109 -0
  170. package/lib/plugins/context-menu/ContextMenu.d.ts +36 -0
  171. package/lib/plugins/context-menu/ContextMenu.d.ts.map +1 -0
  172. package/lib/plugins/context-menu/ContextMenu.js +102 -0
  173. package/lib/plugins/disable-controls/DisableControls.d.ts +1 -1
  174. package/lib/plugins/disable-controls/DisableControls.d.ts.map +1 -1
  175. package/lib/plugins/disable-controls/DisableControls.js +3 -5
  176. package/lib/plugins/dvr-controls/DVRControls.d.ts +4 -4
  177. package/lib/plugins/dvr-controls/DVRControls.d.ts.map +1 -1
  178. package/lib/plugins/dvr-controls/DVRControls.js +5 -4
  179. package/lib/plugins/error-screen/ErrorScreen.d.ts +44 -0
  180. package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -0
  181. package/lib/plugins/error-screen/ErrorScreen.js +179 -0
  182. package/lib/plugins/favicon/Favicon.d.ts +24 -0
  183. package/lib/plugins/favicon/Favicon.d.ts.map +1 -0
  184. package/lib/plugins/favicon/Favicon.js +106 -0
  185. package/lib/plugins/google-analytics/GoogleAnalytics.d.ts +30 -0
  186. package/lib/plugins/google-analytics/GoogleAnalytics.d.ts.map +1 -0
  187. package/lib/plugins/google-analytics/GoogleAnalytics.js +114 -0
  188. package/lib/plugins/index.d.ts +38 -0
  189. package/lib/plugins/index.d.ts.map +1 -0
  190. package/lib/plugins/index.js +40 -0
  191. package/lib/plugins/kibo/index.d.ts +23 -0
  192. package/lib/plugins/kibo/index.d.ts.map +1 -0
  193. package/lib/plugins/kibo/index.js +199 -0
  194. package/lib/plugins/level-selector/LevelSelector.d.ts +48 -17
  195. package/lib/plugins/level-selector/LevelSelector.d.ts.map +1 -1
  196. package/lib/plugins/level-selector/LevelSelector.js +169 -155
  197. package/lib/plugins/logo/Logo.d.ts +29 -0
  198. package/lib/plugins/logo/Logo.d.ts.map +1 -0
  199. package/lib/plugins/logo/Logo.js +181 -0
  200. package/lib/plugins/logo/utils/index.d.ts +22 -0
  201. package/lib/plugins/logo/utils/index.d.ts.map +1 -0
  202. package/lib/plugins/logo/utils/index.js +32 -0
  203. package/lib/plugins/media-control/MediaControl.d.ts +20 -25
  204. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  205. package/lib/plugins/media-control/MediaControl.js +136 -106
  206. package/lib/plugins/multi-camera/MultiCamera.d.ts +59 -0
  207. package/lib/plugins/multi-camera/MultiCamera.d.ts.map +1 -0
  208. package/lib/plugins/multi-camera/MultiCamera.js +353 -0
  209. package/lib/plugins/picture-in-picture/PictureInPicture.d.ts +20 -0
  210. package/lib/plugins/picture-in-picture/PictureInPicture.d.ts.map +1 -0
  211. package/lib/plugins/picture-in-picture/PictureInPicture.js +68 -0
  212. package/lib/plugins/playback-rate/PlaybackRate.d.ts +42 -0
  213. package/lib/plugins/playback-rate/PlaybackRate.d.ts.map +1 -0
  214. package/lib/plugins/playback-rate/PlaybackRate.js +205 -0
  215. package/lib/plugins/poster/Poster.d.ts +18 -17
  216. package/lib/plugins/poster/Poster.d.ts.map +1 -1
  217. package/lib/plugins/poster/Poster.js +83 -37
  218. package/lib/plugins/seek-time/SeekTime.d.ts +38 -0
  219. package/lib/plugins/seek-time/SeekTime.d.ts.map +1 -0
  220. package/lib/plugins/seek-time/SeekTime.js +153 -0
  221. package/lib/plugins/share/Share.d.ts +38 -0
  222. package/lib/plugins/share/Share.d.ts.map +1 -0
  223. package/lib/plugins/share/Share.js +122 -0
  224. package/lib/plugins/skip-time/SkipTime.d.ts +28 -0
  225. package/lib/plugins/skip-time/SkipTime.d.ts.map +1 -0
  226. package/lib/plugins/skip-time/SkipTime.js +86 -0
  227. package/lib/plugins/source-controller/SourceController.d.ts +41 -0
  228. package/lib/plugins/source-controller/SourceController.d.ts.map +1 -0
  229. package/lib/plugins/source-controller/SourceController.js +199 -0
  230. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts +26 -0
  231. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -0
  232. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +117 -0
  233. package/lib/plugins/statistics/Statistics.d.ts +52 -0
  234. package/lib/plugins/statistics/Statistics.d.ts.map +1 -0
  235. package/lib/plugins/statistics/Statistics.js +130 -0
  236. package/lib/plugins/subtitles/Subtitles.d.ts +61 -0
  237. package/lib/plugins/subtitles/Subtitles.d.ts.map +1 -0
  238. package/lib/plugins/subtitles/Subtitles.js +354 -0
  239. package/lib/plugins/thumbnails/Thumbnails.d.ts +47 -0
  240. package/lib/plugins/thumbnails/Thumbnails.d.ts.map +1 -0
  241. package/lib/plugins/thumbnails/Thumbnails.js +414 -0
  242. package/lib/plugins/types.d.ts +8 -0
  243. package/lib/plugins/types.d.ts.map +1 -0
  244. package/lib/plugins/types.js +1 -0
  245. package/lib/plugins/utils.d.ts +5 -0
  246. package/lib/plugins/utils.d.ts.map +1 -0
  247. package/lib/plugins/utils.js +68 -0
  248. package/lib/plugins/vast-ads/VastAds.d.ts +72 -0
  249. package/lib/plugins/vast-ads/VastAds.d.ts.map +1 -0
  250. package/lib/plugins/vast-ads/VastAds.js +686 -0
  251. package/lib/plugins/vast-ads/loaderxml.d.ts +32 -0
  252. package/lib/plugins/vast-ads/loaderxml.d.ts.map +1 -0
  253. package/lib/plugins/vast-ads/loaderxml.js +226 -0
  254. package/lib/plugins/vast-ads/roll.d.ts +60 -0
  255. package/lib/plugins/vast-ads/roll.d.ts.map +1 -0
  256. package/lib/plugins/vast-ads/roll.js +415 -0
  257. package/lib/plugins/vast-ads/rollmanager.d.ts +62 -0
  258. package/lib/plugins/vast-ads/rollmanager.d.ts.map +1 -0
  259. package/lib/plugins/vast-ads/rollmanager.js +347 -0
  260. package/lib/plugins/vast-ads/sctemanager.d.ts +18 -0
  261. package/lib/plugins/vast-ads/sctemanager.d.ts.map +1 -0
  262. package/lib/plugins/vast-ads/sctemanager.js +116 -0
  263. package/lib/plugins/vast-ads/types.d.ts +12 -0
  264. package/lib/plugins/vast-ads/types.d.ts.map +1 -0
  265. package/lib/plugins/vast-ads/types.js +1 -0
  266. package/lib/plugins/vast-ads/urlhandler.d.ts +4 -0
  267. package/lib/plugins/vast-ads/urlhandler.d.ts.map +1 -0
  268. package/lib/plugins/vast-ads/urlhandler.js +30 -0
  269. package/lib/plugins/vast-ads/xmlhttprequest.d.ts +6 -0
  270. package/lib/plugins/vast-ads/xmlhttprequest.d.ts.map +1 -0
  271. package/lib/plugins/vast-ads/xmlhttprequest.js +39 -0
  272. package/lib/plugins/vast-ads/xmlmerge.d.ts +12 -0
  273. package/lib/plugins/vast-ads/xmlmerge.d.ts.map +1 -0
  274. package/lib/plugins/vast-ads/xmlmerge.js +82 -0
  275. package/lib/plugins/volume-fade/VolumeFade.d.ts +21 -0
  276. package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -0
  277. package/lib/plugins/volume-fade/VolumeFade.js +90 -0
  278. package/package.json +10 -2
  279. package/rollup.config.js +32 -2
  280. package/src/index.core.ts +15 -0
  281. package/src/index.plugins.ts +42 -0
  282. package/src/index.ts +2 -15
  283. package/src/plugins/audio-selector/AudioSelector.ts +370 -0
  284. package/src/plugins/big-mute-button/BigMuteButton.ts +187 -0
  285. package/src/plugins/bottom-gear/BottomGear.ts +122 -0
  286. package/src/plugins/build.ts +1 -0
  287. package/src/plugins/clappr-nerd-stats/ClapprNerdStats.ts +369 -0
  288. package/src/plugins/clappr-nerd-stats/formatter.ts +109 -0
  289. package/src/plugins/clappr-nerd-stats/speedtest/Speedtest.ts +414 -0
  290. package/src/plugins/clappr-nerd-stats/speedtest/index.ts +183 -0
  291. package/src/plugins/clappr-nerd-stats/speedtest/types.ts +5 -0
  292. package/src/plugins/clappr-nerd-stats/types.ts +3 -0
  293. package/src/plugins/clappr-stats/ClapprStats.ts +441 -0
  294. package/src/plugins/clappr-stats/types.ts +52 -0
  295. package/src/plugins/clappr-stats/utils.ts +42 -0
  296. package/src/plugins/click-to-pause/ClickToPause.ts +93 -0
  297. package/src/plugins/clips/Clips.ts +152 -0
  298. package/src/plugins/context-menu/ContextMenu.ts +134 -0
  299. package/src/plugins/disable-controls/DisableControls.ts +81 -0
  300. package/src/plugins/dvr-controls/DvrControls.ts +131 -0
  301. package/src/plugins/error-screen/ErrorScreen.ts +241 -0
  302. package/src/plugins/favicon/Favicon.ts +137 -0
  303. package/src/plugins/ga-events/GaEvents.js +395 -0
  304. package/src/plugins/ga-events/ga-tracking.js +46 -0
  305. package/src/plugins/google-analytics/GoogleAnalytics.ts +147 -0
  306. package/src/plugins/index.ts +42 -0
  307. package/src/plugins/kibo/index.ts +244 -0
  308. package/src/plugins/level-selector/LevelSelector.ts +400 -0
  309. package/src/plugins/level-selector/__tests__/LevelSelector.test.ts +72 -0
  310. package/src/plugins/level-selector/__tests__/__snapshots__/LevelSelector.test.ts.snap +11 -0
  311. package/src/plugins/logo/Logo.ts +233 -0
  312. package/src/plugins/logo/utils/index.ts +46 -0
  313. package/src/plugins/media-control/MediaControl.ts +1383 -0
  314. package/src/plugins/multi-camera/MultiCamera copy.xts +414 -0
  315. package/src/plugins/multi-camera/MultiCamera.ts +426 -0
  316. package/src/plugins/picture-in-picture/PictureInPicture.ts +87 -0
  317. package/src/plugins/playback-rate/PlaybackRate.ts +269 -0
  318. package/src/plugins/poster/Poster.ts +298 -0
  319. package/src/plugins/seek-time/SeekTime.ts +191 -0
  320. package/src/plugins/share/Share.ts +148 -0
  321. package/src/plugins/skip-time/SkipTime.ts +109 -0
  322. package/src/plugins/source-controller/SourceController.ts +239 -0
  323. package/src/plugins/source-controller/__tests__/SourceController.test.ts +230 -0
  324. package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +135 -0
  325. package/src/plugins/statistics/Statistics copy.xts +296 -0
  326. package/src/plugins/statistics/Statistics.ts +207 -0
  327. package/src/plugins/subtitles/Subtitles.ts +505 -0
  328. package/src/plugins/thumbnails/Thumbnails.ts +530 -0
  329. package/src/plugins/types.ts +7 -0
  330. package/src/plugins/typings/globals.d.ts +10 -0
  331. package/src/plugins/typings/parse-srt.d.ts +14 -0
  332. package/src/plugins/typings/workers.d.ts +3 -0
  333. package/src/plugins/utils.ts +77 -0
  334. package/src/plugins/vast-ads/VastAds.ts +915 -0
  335. package/src/plugins/vast-ads/loaderxml.ts +260 -0
  336. package/src/plugins/vast-ads/roll.ts +492 -0
  337. package/src/plugins/vast-ads/rollmanager.ts +403 -0
  338. package/src/plugins/vast-ads/sctemanager.ts +134 -0
  339. package/src/plugins/vast-ads/types.ts +14 -0
  340. package/src/plugins/vast-ads/urlhandler.ts +37 -0
  341. package/src/plugins/vast-ads/xmlhttprequest.ts +44 -0
  342. package/src/plugins/vast-ads/xmlmerge.ts +96 -0
  343. package/src/plugins/video360/VRControls.js +104 -0
  344. package/src/plugins/video360/VREffect.js +422 -0
  345. package/src/plugins/video360/Video360.js +979 -0
  346. package/src/plugins/video360/orbit-oriention-controls.js +1002 -0
  347. package/src/plugins/video360/utils.js +49 -0
  348. package/src/plugins/volume-fade/VolumeFade.ts +109 -0
  349. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,38 @@
1
+ import { UICorePlugin } from '@clappr/core';
2
+ import '../../../assets/share/style.scss';
3
+ export declare class Share extends UICorePlugin {
4
+ private hide;
5
+ private container;
6
+ get name(): string;
7
+ get supportedVersion(): {
8
+ min: string;
9
+ };
10
+ get template(): any;
11
+ get attributes(): {
12
+ class: string;
13
+ 'data-share': string;
14
+ };
15
+ get events(): {
16
+ 'click [data-share-button]': string;
17
+ 'click [data-share-close]': string;
18
+ 'click [data-share-fb]': string;
19
+ 'click [data-share-tw]': string;
20
+ 'click [data-share-link]': string;
21
+ 'click [data-share-embed]': string;
22
+ };
23
+ bindEvents(): void;
24
+ unBindEvents(): void;
25
+ canShowShare(): void;
26
+ private onReady;
27
+ render(): this;
28
+ hideShare(): void;
29
+ showShare(): void;
30
+ initializeIcons(): void;
31
+ onShareShow(): void;
32
+ onShareHide(): void;
33
+ onShareFB(): void;
34
+ onShareTW(): void;
35
+ onShareLinkClick(): void;
36
+ onShareEmbedClick(): void;
37
+ }
38
+ //# sourceMappingURL=Share.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Share.d.ts","sourceRoot":"","sources":["../../../src/plugins/share/Share.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAY,MAAM,cAAc,CAAC;AAKzE,OAAO,kCAAkC,CAAC;AAM1C,qBAAa,KAAM,SAAQ,YAAY;IACrC,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO,CAAC,SAAS,CAA0B;IAE3C,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,IAAI,QAAQ,QAEX;IAED,IAAa,UAAU;;;MAKtB;IAED,IAAa,MAAM;;;;;;;MASlB;IAEQ,UAAU;IAQnB,YAAY;IAaZ,YAAY;IAIZ,OAAO,CAAC,OAAO;IASN,MAAM;IAgBf,SAAS;IAIT,SAAS;IAOT,eAAe;IASf,WAAW;IAIX,WAAW;IAIX,SAAS;IAQT,SAAS;IAQT,gBAAgB;IAIhB,iBAAiB;CAGlB"}
@@ -0,0 +1,122 @@
1
+ import { Events, UICorePlugin, template } from '@clappr/core';
2
+ import { CLAPPR_VERSION } from '../build.js';
3
+ import pluginHtml from '../../../assets/share/share.ejs';
4
+ import '../../../assets/share/style.scss';
5
+ import shareIcon from '../../../assets/icons/old/share.svg';
6
+ import closeIcon from '../../../assets/icons/old/close-share.svg';
7
+ import fbIcon from '../../../assets/icons/old/fb.svg';
8
+ import twIcon from '../../../assets/icons/old/twitter.svg';
9
+ export class Share extends UICorePlugin {
10
+ hide = false;
11
+ container = null;
12
+ get name() {
13
+ return 'share';
14
+ }
15
+ get supportedVersion() {
16
+ return { min: CLAPPR_VERSION };
17
+ }
18
+ get template() {
19
+ return template(pluginHtml);
20
+ }
21
+ get attributes() {
22
+ return {
23
+ 'class': this.name + '_plugin',
24
+ 'data-share': ''
25
+ };
26
+ }
27
+ get events() {
28
+ return {
29
+ 'click [data-share-button]': 'onShareShow',
30
+ 'click [data-share-close]': 'onShareHide',
31
+ 'click [data-share-fb]': 'onShareFB',
32
+ 'click [data-share-tw]': 'onShareTW',
33
+ 'click [data-share-link]': 'onShareLinkClick',
34
+ 'click [data-share-embed]': 'onShareEmbedClick'
35
+ };
36
+ }
37
+ bindEvents() {
38
+ this.listenTo(this.core, Events.CORE_READY, this.onReady);
39
+ // this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
40
+ this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.render);
41
+ this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_HIDE, this.hideShare);
42
+ this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_SHOW, this.showShare);
43
+ }
44
+ unBindEvents() {
45
+ // @ts-ignore
46
+ this.stopListening(this.core, Events.CORE_READY);
47
+ // @ts-ignore
48
+ // this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED);
49
+ // @ts-ignore
50
+ this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_RENDERED);
51
+ // @ts-ignore
52
+ this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_HIDE);
53
+ // @ts-ignore
54
+ this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_SHOW);
55
+ }
56
+ canShowShare() {
57
+ this.hide = false;
58
+ }
59
+ onReady() {
60
+ this.hide = true;
61
+ this.container = this.core.activeContainer;
62
+ if (this.container) {
63
+ this.listenTo(this.container, 'container:settingsupdate', this.canShowShare);
64
+ }
65
+ this.hideShare();
66
+ }
67
+ render() {
68
+ this.$el.html(this.template({
69
+ 'url': this.options.shareURL,
70
+ 'embed': this.options.embed,
71
+ 'embed_title': this.core.i18n.t('embed_title'),
72
+ 'share_title': this.core.i18n.t('share_title'),
73
+ 'link_title': this.core.i18n.t('link_title'),
74
+ 'social_title': this.core.i18n.t('social_title'),
75
+ }));
76
+ this.core.mediaControl.$el.append(this.el);
77
+ this.$el.find('.share-container').hide();
78
+ this.initializeIcons();
79
+ return this;
80
+ }
81
+ hideShare() {
82
+ this.$el.addClass('share-hide');
83
+ }
84
+ showShare() {
85
+ if (this.hide) {
86
+ return;
87
+ }
88
+ this.$el.removeClass('share-hide');
89
+ }
90
+ initializeIcons() {
91
+ this.$el.find('button.media-control-button[data-share-button]')
92
+ .addClass('gcore-skin-button-color')
93
+ .append(shareIcon);
94
+ this.$el.find('div.share-container-header--close').append(closeIcon);
95
+ this.$el.find('div.share-container-header--socialicon_fb').append(fbIcon);
96
+ this.$el.find('div.share-container-header--socialicon_tw').append(twIcon);
97
+ }
98
+ onShareShow() {
99
+ this.$el.find('.share-container').show();
100
+ }
101
+ onShareHide() {
102
+ this.$el.find('.share-container').hide();
103
+ }
104
+ onShareFB() {
105
+ if (this.options.shareURL) {
106
+ const url = 'https://www.facebook.com/sharer.php?u=' + this.options.shareURL;
107
+ window.open(url, '_blank');
108
+ }
109
+ }
110
+ onShareTW() {
111
+ if (this.options.shareURL) {
112
+ const url = 'https://twitter.com/intent/tweet?url=' + this.options.shareURL;
113
+ window.open(url, '_blank');
114
+ }
115
+ }
116
+ onShareLinkClick() {
117
+ this.$el.find('.share-container-header--link')[0].setSelectionRange(0, this.options.shareURL.length);
118
+ }
119
+ onShareEmbedClick() {
120
+ this.$el.find('.share-container-header--embed')[0].setSelectionRange(0, this.options.embed.length);
121
+ }
122
+ }
@@ -0,0 +1,28 @@
1
+ import { UICorePlugin as UICorePluginOriginal } from '@clappr/core';
2
+ import '../../../assets/skip-time/style.scss';
3
+ export declare class SkipTime extends UICorePluginOriginal {
4
+ get name(): string;
5
+ get supportedVersion(): {
6
+ min: string;
7
+ };
8
+ get container(): any;
9
+ get template(): any;
10
+ get attributes(): {
11
+ class: string;
12
+ 'data-skip-time': string;
13
+ };
14
+ private position;
15
+ get events(): {
16
+ 'click [data-skip-left]': string;
17
+ 'click [data-skip-mid]': string;
18
+ 'click [data-skip-right]': string;
19
+ };
20
+ bindEvents(): void;
21
+ setBack(): void;
22
+ handleRewindClicks(): void;
23
+ setMidClick(): void;
24
+ setForward(): void;
25
+ toggleFullscreen(): void;
26
+ render(): this;
27
+ }
28
+ //# sourceMappingURL=SkipTime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SkipTime.d.ts","sourceRoot":"","sources":["../../../src/plugins/skip-time/SkipTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,oBAAoB,EAAuC,MAAM,cAAc,CAAC;AAKzG,OAAO,sCAAsC,CAAC;AAI9C,qBAAa,QAAS,SAAQ,oBAAoB;IAChD,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,IAAI,SAAS,QAEZ;IAED,IAAI,QAAQ,QAEX;IAED,IAAa,UAAU;;;MAKtB;IAED,OAAO,CAAC,QAAQ,CAAmB;IAEnC,IAAa,MAAM;;;;MAMlB;IAEQ,UAAU;IAQnB,OAAO;IAIP,kBAAkB;IA4BlB,WAAW;IAIX,UAAU;IAIV,gBAAgB;IAMP,MAAM;CAWhB"}
@@ -0,0 +1,86 @@
1
+ import { UICorePlugin as UICorePluginOriginal, Browser, Playback, Events, template } from '@clappr/core';
2
+ import { CLAPPR_VERSION } from '../build.js';
3
+ import pluginHtml from '../../../assets/skip-time/skip-time.ejs';
4
+ import '../../../assets/skip-time/style.scss';
5
+ export class SkipTime extends UICorePluginOriginal {
6
+ get name() {
7
+ return 'skip_time';
8
+ }
9
+ get supportedVersion() {
10
+ return { min: CLAPPR_VERSION };
11
+ }
12
+ get container() {
13
+ return this.core && this.core.activeContainer;
14
+ }
15
+ get template() {
16
+ return template(pluginHtml);
17
+ }
18
+ get attributes() {
19
+ return {
20
+ 'class': this.name + '_plugin',
21
+ 'data-skip-time': ''
22
+ };
23
+ }
24
+ position = 'mid';
25
+ get events() {
26
+ return {
27
+ 'click [data-skip-left]': 'setBack',
28
+ 'click [data-skip-mid]': 'setMidClick',
29
+ 'click [data-skip-right]': 'setForward',
30
+ };
31
+ }
32
+ bindEvents() {
33
+ this.listenTo(this.core, Events.CORE_READY, this.render);
34
+ if (!this.container) {
35
+ return;
36
+ }
37
+ this.listenTo(this.container, Events.CONTAINER_DBLCLICK, this.handleRewindClicks);
38
+ }
39
+ setBack() {
40
+ this.position = 'left';
41
+ }
42
+ handleRewindClicks() {
43
+ if (this.core.getPlaybackType() === Playback.LIVE && !this.container.isDvrEnabled()) {
44
+ this.toggleFullscreen();
45
+ return;
46
+ }
47
+ if (Browser.isMobile) {
48
+ if (this.position === 'left') {
49
+ const seekPos = this.container.getCurrentTime() - 10;
50
+ if (seekPos < 0) {
51
+ return;
52
+ }
53
+ this.container.seek(seekPos);
54
+ }
55
+ else if (this.position === 'right') {
56
+ const seekPos = this.container.getCurrentTime() + 30;
57
+ if (seekPos > this.container.getDuration()) {
58
+ return;
59
+ }
60
+ this.container.seek(seekPos);
61
+ }
62
+ else {
63
+ this.toggleFullscreen();
64
+ }
65
+ }
66
+ }
67
+ setMidClick() {
68
+ this.position = 'mid';
69
+ }
70
+ setForward() {
71
+ this.position = 'right';
72
+ }
73
+ toggleFullscreen() {
74
+ this.trigger(Events.MEDIACONTROL_FULLSCREEN, this.name);
75
+ this.container.fullscreen();
76
+ this.core.toggleFullscreen();
77
+ }
78
+ render() {
79
+ this.$el.html(template(pluginHtml));
80
+ if (this.core.activeContainer) {
81
+ this.core.activeContainer.$el.append(this.el);
82
+ }
83
+ this.bindEvents();
84
+ return this;
85
+ }
86
+ }
@@ -0,0 +1,41 @@
1
+ import { CorePlugin, type Core as ClapprCore } from '@clappr/core';
2
+ /**
3
+ * This plugin is responsible for managing the automatic failover between sources.
4
+ * @beta
5
+ * @remarks
6
+ * Have a look at the {@link https://miro.com/app/board/uXjVLiN15tY=/?share_link_id=390327585787 | source failover diagram} for the details
7
+ * on how sources ordering and selection works.
8
+ *
9
+ * This plugin does not expose any public methods apart from required by the Clappr plugin interface.
10
+ * It is supposed to work autonomously.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { SourceController } from '@gcorevideo/player-plugins'
15
+ *
16
+ * Player.registerPlugin(SourceController)
17
+ * ```
18
+ */
19
+ export declare class SourceController extends CorePlugin {
20
+ private sourcesList;
21
+ private currentSourceIndex;
22
+ private sourcesDelay;
23
+ private active;
24
+ private sync;
25
+ get name(): string;
26
+ get supportedVersion(): {
27
+ min: string;
28
+ };
29
+ constructor(core: ClapprCore);
30
+ /**
31
+ * @internal
32
+ */
33
+ bindEvents(): void;
34
+ private onReady;
35
+ private bindContainerEventListeners;
36
+ private reset;
37
+ private retryPlayback;
38
+ private getNextMediaSource;
39
+ static get version(): string;
40
+ }
41
+ //# sourceMappingURL=SourceController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SourceController.d.ts","sourceRoot":"","sources":["../../../src/plugins/source-controller/SourceController.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,IAAI,IAAI,UAAU,EACxB,MAAM,cAAc,CAAA;AA4BrB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAuC9C,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,CAAC,kBAAkB,CAAI;IAE9B,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,IAAI,CAAiB;IAE7B,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;gBAEW,IAAI,EAAE,UAAU;IAW5B;;OAEG;IACM,UAAU;IAMnB,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,2BAA2B;IAyCnC,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,aAAa;IA6BrB,OAAO,CAAC,kBAAkB;IAe1B,MAAM,KAAK,OAAO,WAEjB;CACF"}
@@ -0,0 +1,199 @@
1
+ import { Events as ClapprEvents, CorePlugin, } from '@clappr/core';
2
+ import { PlaybackErrorCode, } from '../..//playback.types';
3
+ import { trace } from '@gcorevideo/utils';
4
+ import { CLAPPR_VERSION } from '../build';
5
+ const T = 'plugins.source_controller';
6
+ const INITIAL_RETRY_DELAY = 1000;
7
+ const MAX_RETRY_DELAY = 5000;
8
+ const RETRY_DELAY_BLUR = 500;
9
+ const VERSION = '0.0.1';
10
+ function noSync(cb) {
11
+ queueMicrotask(cb);
12
+ }
13
+ /**
14
+ * This plugin is responsible for managing the automatic failover between sources.
15
+ * @beta
16
+ * @remarks
17
+ * Have a look at the {@link https://miro.com/app/board/uXjVLiN15tY=/?share_link_id=390327585787 | source failover diagram} for the details
18
+ * on how sources ordering and selection works.
19
+ *
20
+ * This plugin does not expose any public methods apart from required by the Clappr plugin interface.
21
+ * It is supposed to work autonomously.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * import { SourceController } from '@gcorevideo/player-plugins'
26
+ *
27
+ * Player.registerPlugin(SourceController)
28
+ * ```
29
+ */
30
+ export class SourceController extends CorePlugin {
31
+ /*
32
+ * The Logic itself is quite simple:
33
+ * * Here is the short diagram:
34
+ *
35
+ * sources_list:
36
+ * - a.mpd | +--------------------+
37
+ * - b.m3u8 |--->| init |
38
+ * - ... | |--------------------|
39
+ * | current_source = 0 |
40
+ * +--------------------+
41
+ * |
42
+ * | source = a.mpd
43
+ * | playback = dash.js
44
+ * v
45
+ * +------------------+
46
+ * +-->| load source |
47
+ * | +---------|--------+
48
+ * | v
49
+ * | +------------------+
50
+ * | | play |
51
+ * | +---------|--------+
52
+ * | |
53
+ * | v
54
+ * | +-----------------------+
55
+ * | | on playback_error |
56
+ * | |-----------------------|
57
+ * | | current_source = |
58
+ * | | (current_source + 1) |
59
+ * | | % len sources_list |
60
+ * | | |
61
+ * | | delay 1..3s |
62
+ * | +---------------|-------+
63
+ * | |
64
+ * | source=b.m3u8 |
65
+ * | playback=hls.js |
66
+ * +-------------------+
67
+ *
68
+ */
69
+ sourcesList = [];
70
+ currentSourceIndex = 0;
71
+ sourcesDelay = {};
72
+ active = false;
73
+ sync = noSync;
74
+ get name() {
75
+ return 'source_controller';
76
+ }
77
+ get supportedVersion() {
78
+ return { min: CLAPPR_VERSION };
79
+ }
80
+ constructor(core) {
81
+ super(core);
82
+ this.sourcesList = this.core.options.sources;
83
+ if (this.core.options.source !== undefined) {
84
+ // prevent Clappr from loading all sources simultaneously
85
+ this.core.options.sources = [this.core.options.source];
86
+ }
87
+ else {
88
+ this.core.options.sources = this.core.options.sources.slice(0, 1);
89
+ }
90
+ }
91
+ /**
92
+ * @internal
93
+ */
94
+ bindEvents() {
95
+ super.bindEvents();
96
+ this.listenTo(this.core, ClapprEvents.CORE_READY, () => this.onReady());
97
+ }
98
+ onReady() {
99
+ trace(`${T} onReady`, {
100
+ retrying: this.active,
101
+ });
102
+ const spinner = this.core.activeContainer?.getPlugin('spinner');
103
+ if (spinner) {
104
+ this.sync = (cb) => {
105
+ spinner.once('spinner:sync', cb);
106
+ };
107
+ }
108
+ else {
109
+ this.sync = noSync;
110
+ }
111
+ this.bindContainerEventListeners();
112
+ if (this.active) {
113
+ this.core.activeContainer?.getPlugin('poster_custom')?.disable();
114
+ spinner?.show();
115
+ }
116
+ }
117
+ bindContainerEventListeners() {
118
+ trace(`${T} bindContainerEventListeners`, {
119
+ activePlayback: this.core.activePlayback?.name,
120
+ });
121
+ this.core.activePlayback.on(ClapprEvents.PLAYBACK_ERROR, (error) => {
122
+ trace(`${T} on PLAYBACK_ERROR`, {
123
+ error: {
124
+ code: error?.code,
125
+ description: error?.description,
126
+ level: error?.level,
127
+ },
128
+ retrying: this.active,
129
+ currentSource: this.sourcesList[this.currentSourceIndex],
130
+ });
131
+ switch (error.code) {
132
+ case PlaybackErrorCode.MediaSourceUnavailable:
133
+ this.core.activeContainer?.getPlugin('poster_custom')?.disable();
134
+ this.retryPlayback();
135
+ break;
136
+ // TODO handle other errors
137
+ default:
138
+ break;
139
+ }
140
+ });
141
+ this.core.activePlayback.on(ClapprEvents.PLAYBACK_PLAY, () => {
142
+ trace(`${T} on PLAYBACK_PLAY`, {
143
+ currentSource: this.sourcesList[this.currentSourceIndex],
144
+ retrying: this.active,
145
+ });
146
+ if (this.active) {
147
+ this.reset();
148
+ // TODO make poster reset its state on enable
149
+ this.core.activeContainer?.getPlugin('poster_custom')?.enable();
150
+ this.core.activeContainer?.getPlugin('spinner')?.hide();
151
+ }
152
+ });
153
+ }
154
+ reset() {
155
+ this.active = false;
156
+ this.sourcesDelay = {};
157
+ }
158
+ retryPlayback() {
159
+ trace(`${T} retryPlayback enter`, {
160
+ currentSourceIndex: this.currentSourceIndex,
161
+ currentSource: this.sourcesList[this.currentSourceIndex],
162
+ sourcesList: this.sourcesList,
163
+ });
164
+ this.active = true;
165
+ this.getNextMediaSource().then((nextSource) => {
166
+ trace(`${T} retryPlayback syncing...`, {
167
+ nextSource,
168
+ });
169
+ const rnd = RETRY_DELAY_BLUR * Math.random();
170
+ this.sync(() => {
171
+ trace(`${T} retryPlayback loading...`, {
172
+ nextSource,
173
+ });
174
+ this.core.load(nextSource.source, nextSource.mimeType);
175
+ trace(`${T} retryPlayback loaded`, {
176
+ nextSource,
177
+ });
178
+ setTimeout(() => {
179
+ // this.core.activePlayback.consent()
180
+ this.core.activePlayback.play();
181
+ trace(`${T} retryPlayback playing`);
182
+ }, rnd);
183
+ });
184
+ });
185
+ }
186
+ getNextMediaSource() {
187
+ return new Promise((resolve) => {
188
+ this.sourcesDelay[this.currentSourceIndex] = Math.min(MAX_RETRY_DELAY, (this.sourcesDelay[this.currentSourceIndex] || INITIAL_RETRY_DELAY) * 2);
189
+ this.currentSourceIndex =
190
+ (this.currentSourceIndex + 1) % this.sourcesList.length;
191
+ const delay = this.sourcesDelay[this.currentSourceIndex] || INITIAL_RETRY_DELAY;
192
+ const s = this.sourcesList[this.currentSourceIndex];
193
+ setTimeout(() => resolve(s), delay);
194
+ });
195
+ }
196
+ static get version() {
197
+ return VERSION;
198
+ }
199
+ }
@@ -0,0 +1,26 @@
1
+ import { Container, UIContainerPlugin } from '@clappr/core';
2
+ import '../../../assets/spinner-three-bounce/spinner.scss';
3
+ export declare class SpinnerThreeBounce extends UIContainerPlugin {
4
+ get name(): string;
5
+ get supportedVersion(): {
6
+ min: string;
7
+ };
8
+ get attributes(): {
9
+ 'data-spinner': string;
10
+ class: string;
11
+ };
12
+ private showTimeout;
13
+ private template;
14
+ private hasFatalError;
15
+ private hasBuffering;
16
+ constructor(container: Container);
17
+ private onBuffering;
18
+ private onBufferFull;
19
+ private onPlay;
20
+ private onStop;
21
+ private onError;
22
+ show(immediate?: boolean): void;
23
+ hide(): void;
24
+ render(): this;
25
+ }
26
+ //# sourceMappingURL=SpinnerThreeBounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpinnerThreeBounce.d.ts","sourceRoot":"","sources":["../../../src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAU,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAK9E,OAAO,mDAAmD,CAAC;AAM3D,qBAAa,kBAAmB,SAAQ,iBAAiB;IACvD,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,IAAa,UAAU;;;MAKtB;IAED,OAAO,CAAC,WAAW,CAAwB;IAE3C,OAAO,CAAC,QAAQ,CAAyB;IAEzC,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,YAAY,CAAQ;gBAEhB,SAAS,EAAE,SAAS;IAWhC,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,OAAO;IAef,IAAI,CAAC,SAAS,UAAQ;IAetB,IAAI;IAQK,MAAM;CAmBhB"}
@@ -0,0 +1,117 @@
1
+ // Copyright 2014 Globo.com Player authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+ import { Events, UIContainerPlugin, template } from '@clappr/core';
5
+ import { PlaybackErrorCode } from '../../playback.types';
6
+ import { trace } from '@gcorevideo/utils';
7
+ import spinnerHTML from '../../../assets/spinner-three-bounce/spinner.ejs';
8
+ import '../../../assets/spinner-three-bounce/spinner.scss';
9
+ import { CLAPPR_VERSION } from '../build.js';
10
+ const T = 'plugins.spinner';
11
+ export class SpinnerThreeBounce extends UIContainerPlugin {
12
+ get name() {
13
+ return 'spinner';
14
+ }
15
+ get supportedVersion() {
16
+ return { min: CLAPPR_VERSION };
17
+ }
18
+ get attributes() {
19
+ return {
20
+ 'data-spinner': '',
21
+ 'class': 'spinner-three-bounce'
22
+ };
23
+ }
24
+ showTimeout = null;
25
+ template = template(spinnerHTML);
26
+ hasFatalError = false;
27
+ hasBuffering = false;
28
+ constructor(container) {
29
+ super(container);
30
+ this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
31
+ this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferFull);
32
+ this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay);
33
+ this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
34
+ this.listenTo(this.container, Events.CONTAINER_ENDED, this.onStop);
35
+ this.listenTo(this.container, Events.CONTAINER_ERROR, this.onError);
36
+ this.listenTo(this.container, Events.CONTAINER_READY, this.render);
37
+ }
38
+ onBuffering() {
39
+ this.hasBuffering = true;
40
+ this.show();
41
+ }
42
+ onBufferFull() {
43
+ if (!this.hasFatalError && this.hasBuffering) {
44
+ this.hide();
45
+ }
46
+ this.hasBuffering = false;
47
+ }
48
+ onPlay() {
49
+ trace(`${T} onPlay`);
50
+ this.hide();
51
+ }
52
+ onStop() {
53
+ trace(`${T} onStop`, {
54
+ showOnError: this.options.spinner?.showOnError,
55
+ hasFatalError: this.hasFatalError,
56
+ });
57
+ if (!(this.hasFatalError && this.options.spinner?.showOnError)) {
58
+ this.hide();
59
+ }
60
+ }
61
+ onError(e) {
62
+ this.hasFatalError = e.code === PlaybackErrorCode.MediaSourceUnavailable;
63
+ trace(`${T} onError`, {
64
+ e,
65
+ showOnError: this.options.spinner?.showOnError,
66
+ hasFatalError: this.hasFatalError,
67
+ error: e.code,
68
+ });
69
+ if (this.options.spinner?.showOnError) {
70
+ this.show();
71
+ }
72
+ else {
73
+ this.hide();
74
+ }
75
+ }
76
+ show(immediate = false) {
77
+ trace(`${T} show`, {
78
+ immediate,
79
+ });
80
+ if (immediate) {
81
+ if (this.showTimeout !== null) {
82
+ clearTimeout(this.showTimeout);
83
+ this.showTimeout = null;
84
+ }
85
+ this.$el.show();
86
+ }
87
+ else if (this.showTimeout === null) {
88
+ this.showTimeout = setTimeout(() => this.$el.show(), 300);
89
+ }
90
+ }
91
+ hide() {
92
+ if (this.showTimeout !== null) {
93
+ clearTimeout(this.showTimeout);
94
+ this.showTimeout = null;
95
+ }
96
+ this.$el.hide();
97
+ }
98
+ render() {
99
+ const showOnStart = this.options.spinner?.showOnStart;
100
+ trace(`${T} render`, {
101
+ buffering: this.container.buffering,
102
+ showOnStart,
103
+ });
104
+ this.$el.html(this.template());
105
+ this.el.firstElementChild?.addEventListener('animationiteration', () => {
106
+ this.trigger('spinner:sync');
107
+ });
108
+ this.container.$el.append(this.$el[0]);
109
+ if (showOnStart || this.container.buffering) {
110
+ this.show();
111
+ }
112
+ else {
113
+ this.hide();
114
+ }
115
+ return this;
116
+ }
117
+ }