@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,403 @@
1
+ import { $, Browser, Container, ContainerPlugin, Core, Events, HTML5Video, Log, Playback, UIContainerPlugin, Utils } from '@clappr/core';
2
+ import { reportError } from '@gcorevideo/utils';
3
+ import assert from 'assert';
4
+
5
+ import LoaderXML from './loaderxml.js';
6
+ import Roll from './roll.js';
7
+ import { ZeptoResult } from '../types.js';
8
+ import { AdRollDesc, AdRollItem, AdRollType, VastAdsOptions } from './types.js';
9
+
10
+ type CoreOptions = Record<string, unknown>;
11
+
12
+ type ExtensionData = Record<string, unknown>;
13
+
14
+ export default class RollManager extends Events {
15
+ private _allURLRequest = false;
16
+
17
+ private _container: Container;
18
+ private container: Container;
19
+
20
+ private _options: CoreOptions;
21
+
22
+ private vastAdsOptions: VastAdsOptions;
23
+
24
+ private _playback: Playback;
25
+
26
+ private _contentElement: HTMLMediaElement;
27
+
28
+ private _posterPlugin: UIContainerPlugin;
29
+
30
+ private _clickToPausePlugin: ContainerPlugin;
31
+
32
+ private adTemplates: AdRollItem[] | null = null;
33
+
34
+ // private _adDisplayContainer: HTMLElement | null = null;
35
+
36
+ private extension: ExtensionData | null = null;
37
+
38
+ private firstRemaininTime = 0;
39
+
40
+ private _imaContainer: HTMLElement | null = null;
41
+
42
+ private isPlaying = false;
43
+
44
+ private loadXML: LoaderXML | null = null;
45
+
46
+ private _pr: number;
47
+
48
+ private roll: Roll | null = null;
49
+
50
+ constructor(
51
+ private core: Core,
52
+ private options: CoreOptions,
53
+ private $skipAd: ZeptoResult,
54
+ private $muteIcon: ZeptoResult,
55
+ private $areaClick: ZeptoResult,
56
+ private _adContainer: HTMLElement,
57
+ private type: AdRollType,
58
+ private countRoll: number,
59
+ private volume: number,
60
+ private prevVolume: number
61
+ ) {
62
+ super();
63
+ this._options = options;
64
+ this.vastAdsOptions = this._options.vastAds as any;
65
+ this.container = this.core.activeContainer;
66
+ this._container = this.container;
67
+ // this.countRoll = countRoll || 0;
68
+ this.$skipAd = $skipAd;
69
+ this.type = type;
70
+ this.$muteIcon = $muteIcon;
71
+ this.$areaClick = $areaClick;
72
+ this._playback = this.core.activePlayback;
73
+ this._contentElement = this._playback.el as HTMLMediaElement;
74
+ this._posterPlugin = this._container.getPlugin('poster_custom');
75
+ this._clickToPausePlugin = this._container.getPlugin('click_to_pause_custom');
76
+ this._adContainer = _adContainer;
77
+ this._events = {};
78
+ this._pr = Math.floor(Math.random() * 1000000);
79
+ }
80
+
81
+ private initializeRoll({ xml, url, extension }: { xml: any; url: string; extension: any }) {
82
+ try {
83
+ this.roll = new Roll({
84
+ core: this.core,
85
+ $skipAd: this.$skipAd,
86
+ $muteIcon: this.$muteIcon,
87
+ $areaClick: this.$areaClick,
88
+ mute: !!this.options.mute,
89
+ volume: this.volume,
90
+ prevVolume: this.prevVolume
91
+ });
92
+ // @ts-ignore
93
+ this.roll.on('volume', this.changeVolume.bind(this));
94
+ // @ts-ignore
95
+ this.roll.on('advertisement_started', this.onAdStarted.bind(this));
96
+ // @ts-ignore
97
+ this.roll.on('advertisement_played', this.onAdPlayed.bind(this));
98
+ // @ts-ignore
99
+ this.roll.on('continue_ad', this._cleverContinueAd.bind(this));
100
+ // @ts-ignore
101
+ this.roll.on('advertisement_finish', this._playVideoContent.bind(this));
102
+
103
+ this.roll._requestAd({ xml, url, extension });
104
+ } catch (error) {
105
+ // LogManager.exception(error);
106
+ reportError(error);
107
+ }
108
+ }
109
+
110
+ playerResize(_: { width: number; height: number }) {
111
+ if (this.roll) {
112
+ this.roll.playerResize();
113
+ }
114
+ }
115
+
116
+ private onAdStarted(_: { url: string}) {
117
+ this.removeContainer();
118
+ }
119
+
120
+ onAdPlayed() {
121
+ this.isPlaying = true;
122
+ }
123
+
124
+ private removeContainer() {
125
+ this.trigger('advertisement_started');
126
+ }
127
+
128
+ private changeVolume(obj: { volume: number; mute: boolean; }) {
129
+ this.trigger('volume', obj);
130
+ }
131
+
132
+ // private _createAdDisplayContainer() {
133
+ // this._createImaContainer();
134
+ // assert('google' in window, 'google not found');
135
+ // this._adDisplayContainer = new (window.google as any).ima.AdDisplayContainer(this._imaContainer, this._contentElement);
136
+ // }
137
+
138
+ _createImaContainer() {
139
+ this._destroyImaContainer();
140
+ // IMA does not clean ad container when finished
141
+ // For the sake of simplicity, wrap into a <div> element
142
+ if (this._adContainer) {
143
+ this._imaContainer = document.createElement('div');
144
+ this._adContainer.appendChild(this._imaContainer);
145
+ }
146
+ }
147
+
148
+ _destroyImaContainer() {
149
+ if (this._imaContainer && this._adContainer) {
150
+ this._adContainer.removeChild(this._imaContainer);
151
+ this._imaContainer = null;
152
+ }
153
+ }
154
+
155
+ async setupRoll() {
156
+ // TODO: check if this is correct
157
+ const dataAd = this.vastAdsOptions[this.type] || { data: [] };
158
+ const { oneByOne = false } = dataAd;
159
+ let rollList = dataAd.data;
160
+
161
+ if (this.type === 'middleroll') {
162
+ const currentStartTime = dataAd.data[this.countRoll].startTimePercent;
163
+
164
+ rollList = dataAd.data.filter((el) => {
165
+ if (el.startTimePercent === currentStartTime) {
166
+ return true;
167
+ }
168
+ });
169
+ }
170
+ if (this.type === 'repeatableroll') {
171
+ const currentStartTime = dataAd.data[this.countRoll].startTime;
172
+
173
+ rollList = dataAd.data.filter((el) => {
174
+ if (el.startTime === currentStartTime) {
175
+ return true;
176
+ }
177
+ });
178
+ }
179
+
180
+ if (this.type === 'middleroll' || this.type === 'repeatableroll') {
181
+ this.trigger('change_counter', { type: this.type, value: this.countRoll + rollList.length });
182
+ }
183
+ await this.startAd(this.type, { data: rollList, oneByOne });
184
+ }
185
+
186
+ async startAd(type: AdRollType, roll: AdRollDesc) {
187
+ // TODO
188
+ // Player.player.trigger('advertisementWasStarted');
189
+ this.core.trigger('core:advertisement:start');
190
+ this.container.trigger('container:advertisement:start');
191
+ (this.container as any).advertisement = { type: type };
192
+ if (type !== 'middleroll' && type !== 'repeatableroll') {
193
+ console.warn('disableControls');
194
+ setTimeout(() => this._disableControls(), 0);
195
+ }
196
+
197
+ if (!this.adTemplates && roll) {
198
+ this.adTemplates = this.parseAdUrl(roll.data);
199
+ if (!this.adTemplates) {
200
+ this.trigger('disable_plugin', { type: this.type });
201
+
202
+ return;
203
+ }
204
+ }
205
+ if (type === 'preroll') {
206
+ if (Browser.isMobile) {
207
+ this._playback.consent(() => {});
208
+ }
209
+ }
210
+ //чтобы реклама шла одна за другой
211
+ this._allURLRequest = !!roll.oneByOne;
212
+ try {
213
+ const customPosterPlugin = this.container.getPlugin('poster_custom');
214
+
215
+ customPosterPlugin.hidePlayButton();
216
+ } catch (error) {
217
+ // LogManager.exception(error);
218
+ reportError(error);
219
+ }
220
+
221
+ if (!this.adTemplates?.length) {
222
+ this.trigger('advertisement_dont_play', { type: this.type });
223
+
224
+ return;
225
+ }
226
+ Log.debug('Advertisement', 'advertisement will start');
227
+ try {
228
+ const adTemplate = this.adTemplates.shift();
229
+ // @ts-ignore
230
+ await this.loadAd(adTemplate.url);
231
+ } catch (error) {
232
+ // LogManager.exception(error);
233
+ reportError(error);
234
+ }
235
+ }
236
+
237
+ _disableControls() {
238
+ this.container.disableMediaControl();
239
+ this._clickToPausePlugin?.disable();
240
+ // @ts-ignore
241
+ this._posterPlugin?.$playWrapper.hide();
242
+ }
243
+
244
+ private parseAdUrl(arr: any): AdRollItem[] | null {
245
+ if (!Array.isArray(arr)) {
246
+ return null;
247
+ }
248
+
249
+ return arr.filter((el) => el.url);
250
+ }
251
+
252
+ paramsUrl(url: string): string {
253
+ try {
254
+ url = url.replace(/\{width\}/g, this.container.$el.width());
255
+ url = url.replace(/\{height\}/g, this.container.$el.height());
256
+ url = url.replace(/\{pr\}/g, String(this._pr));
257
+ url = url.replace(/\{random\}/g, String(Math.floor(Math.random() * 1000000)));
258
+ url = url.replace(/\{session_id\}/g, Utils.uniqueId(''));
259
+ url = url.replace(/\{start_delay\}/g, '0');
260
+
261
+ if (this.options.referer) {
262
+ url = url.replace(new RegExp(/\{referer\}/g, 'g'), String(this.options.referer ?? ''));
263
+ }
264
+
265
+ let playback = 1;
266
+
267
+ if (this.options.autoPlay && this.options.mute) {
268
+ playback = 2;
269
+ }
270
+
271
+ if (!this.options.autoPlay) {
272
+ playback = 3;
273
+ }
274
+
275
+ url = url.replace(/\{playback\}/g, String(playback));
276
+ } catch (error) {
277
+ // LogManager.exception(error);
278
+ reportError(error);
279
+ }
280
+
281
+ return url;
282
+ }
283
+
284
+ async loadAd(url: string) {
285
+ if (!url) {
286
+ return;
287
+ }
288
+ try {
289
+ if (!['middleroll', 'repeatableroll'].includes((this.container as any).advertisement.type)) {
290
+ const spinnerPlugin = this.container.getPlugin('spinner');
291
+
292
+ spinnerPlugin?.show();
293
+ }
294
+ } catch (error) {
295
+ // LogManager.exception(error);
296
+ reportError(error);
297
+ }
298
+ url = this.paramsUrl(url);
299
+
300
+ Roll._adContainer = this._adContainer;
301
+ Roll._contentElement = this._contentElement;
302
+ Roll.createAdDisplayContainer();
303
+ this.loadXML = new LoaderXML(url);
304
+ let data: ExtensionData;
305
+
306
+ try {
307
+ data = await this.loadXML.startLoad();
308
+ } catch (error) {
309
+ // LogManager.exception(error);
310
+ reportError(error);
311
+ if (this.adTemplates && this.adTemplates.length > 0) {
312
+ const adTemplate = this.adTemplates.shift();
313
+ // @ts-ignore
314
+ await this.loadAd(adTemplate.url);
315
+ } else {
316
+ const spinnerPlugin = this.container.getPlugin('spinner');
317
+
318
+ spinnerPlugin?.hide();
319
+ this.trigger('advertisement_dont_play', { type: this.type });
320
+ }
321
+
322
+ return;
323
+ }
324
+ try {
325
+ this.firstRemaininTime = 0;
326
+ this.$muteIcon.hide();
327
+ this.$skipAd.hide();
328
+
329
+ // this.volume = this._playback.volume;
330
+ assert(this._playback instanceof HTML5Video);
331
+ this.volume = (this._playback.el as HTMLMediaElement).volume;
332
+ } catch (error) {
333
+ // LogManager.exception(error);
334
+ reportError(error);
335
+ }
336
+ this.extension = data;
337
+ this.initializeRoll({ xml: data.config, url: String(data.url || url), extension: data });
338
+ }
339
+
340
+ _onAdError(adErrorEvent: any) {
341
+ try {
342
+ const googleError = adErrorEvent.getError();
343
+ const error = new Error(googleError.getMessage() + ' ' + googleError.getErrorCode());
344
+
345
+ error.name = googleError.getType();
346
+ // LogManager.exception(error);
347
+ reportError(error);
348
+ } catch (error) {
349
+ // LogManager.exception(error);
350
+ reportError(error);
351
+ }
352
+ Log.debug('Advertisement', 'advertisement error');
353
+
354
+ this._cleverContinueAd(true);
355
+ }
356
+
357
+ _imaEvent(eventName: string, e: any) {
358
+ $.isFunction((this._events as any)[eventName]) && (this._events as any)[eventName](e);
359
+ }
360
+
361
+ /**
362
+ * определяет, что дальше будет запускаться реклама или контент
363
+ *
364
+ */
365
+ async _cleverContinueAd(data: any) {
366
+ this.destroyRoll();
367
+ const error = data.error;
368
+
369
+ if ((this._allURLRequest || error) && this.adTemplates && this.adTemplates.length > 0) {
370
+ const adTemplate = this.adTemplates.shift();
371
+ // @ts-ignore
372
+ await this.loadAd(adTemplate.url);
373
+
374
+ return;
375
+ }
376
+ this._playVideoContent();
377
+ }
378
+
379
+ _playVideoContent() {
380
+ this.destroyRoll();
381
+ Roll.destroyImaContainer();
382
+
383
+ const spinnerPlugin = this.container.getPlugin('spinner');
384
+
385
+ spinnerPlugin?.hide();
386
+
387
+ if (this.isPlaying) {
388
+ this.trigger('advertisement_finish', { type: this.type });
389
+ } else {
390
+ this.trigger('advertisement_dont_play', { type: this.type });
391
+ }
392
+ }
393
+
394
+ destroyRoll() {
395
+ if (!this.roll) {
396
+ return;
397
+ }
398
+ // @ts-ignore
399
+ this.roll.off();
400
+ this.roll.destroy();
401
+ this.roll = null;
402
+ }
403
+ }
@@ -0,0 +1,134 @@
1
+ import { Events, Playback } from '@clappr/core';
2
+ import { Events as HlsEvents, FragChangedData } from 'hls.js';
3
+
4
+ const OUT = 'out',
5
+ IN = 'in',
6
+ OUT_CONT = 'out_cont';
7
+
8
+ type CueResult = { kind?: "in" | "out" | "out_cont"; duration?: number };
9
+
10
+ export default class SCTEManager extends Events {
11
+ private _playback: Playback | null = null;
12
+
13
+ private _scteIsStarted = false;
14
+
15
+ set playback(value: Playback) {
16
+ if (this._playback) {
17
+ //удалить все подписанные евенты
18
+ // @ts-ignore
19
+ if (this._playback._hls) {
20
+ // @ts-ignore
21
+ this._playback._hls.off(HlsEvents.FRAG_CHANGED, this._onHlsFragChanged.bind(this));
22
+ }
23
+
24
+ this._playback.off(Events.PLAYBACK_PLAY_INTENT, this._subscribedHlsEvents, this);
25
+ }
26
+ this._playback = value;
27
+ // @ts-ignore
28
+ if (!this._playback._hls) {
29
+ this._playback.once(Events.PLAYBACK_PLAY_INTENT, this._subscribedHlsEvents, this);
30
+ } else {
31
+ this._subscribedHlsEvents();
32
+ }
33
+ }
34
+
35
+ get playback(): Playback | null {
36
+ return this._playback;
37
+ }
38
+
39
+ _subscribedHlsEvents() {
40
+ // @ts-ignore
41
+ if (this._playback._hls) {
42
+ // @ts-ignore
43
+ this._playback._hls.off(HlsEvents.FRAG_CHANGED, this._onHlsFragChanged.bind(this));
44
+ // @ts-ignore
45
+ this._playback._hls.on(HlsEvents.FRAG_CHANGED, this._onHlsFragChanged.bind(this));
46
+ }
47
+ }
48
+
49
+ _onHlsFragChanged(_: HlsEvents.FRAG_CHANGED, data: FragChangedData) {
50
+ const { tagList } = data.frag;
51
+
52
+ if (tagList) {
53
+ const cue = this._getCue(tagList);
54
+
55
+ if (Object.keys(cue).length > 0) {
56
+ if (!this._scteIsStarted) {
57
+ if (cue.kind === OUT || cue.kind === OUT_CONT) {
58
+ this._scteIsStarted = true;
59
+ console.warn('scteroll will be started');
60
+ this.trigger('startSCTERoll', {
61
+ duration: cue.duration
62
+ });
63
+ }
64
+ } else {
65
+ if (cue.kind === IN) {
66
+ console.warn('scteroll will be stopped');
67
+ this._stopScte();
68
+ }
69
+ }
70
+ } else {
71
+ this._stopScte();
72
+ }
73
+ }
74
+ }
75
+
76
+ _stopScte() {
77
+ if (this._scteIsStarted) {
78
+ this.trigger('stopSCTERoll');
79
+ this._scteIsStarted = false;
80
+ }
81
+ }
82
+
83
+ _getCue(tagList: string[][]): CueResult {
84
+ let cueResult: CueResult = {
85
+ kind: undefined,
86
+ duration: undefined,
87
+ };
88
+
89
+ for (let i = 0; i < tagList.length; i++) {
90
+ const infoSegment = tagList[i];
91
+ let kind: "in" | "out" | "out_cont" | undefined;
92
+ let duration: number | undefined;
93
+
94
+ infoSegment.forEach((info) => {
95
+ if (kind) {
96
+ if (kind === OUT) {
97
+ const dur = parseInt(info);
98
+
99
+ !isNaN(dur) && (duration = dur);
100
+ }
101
+ if (kind === OUT_CONT) {
102
+ const durString = info.match(/Duration=\d+/g);
103
+
104
+ if (durString) {
105
+ const durNumb = durString[0].match(/\d+/g);
106
+
107
+ if (durNumb) {
108
+ duration = parseInt(durNumb[0]);
109
+ }
110
+ }
111
+ }
112
+ } else {
113
+ switch (info) {
114
+ case 'EXT-X-CUE-OUT':
115
+ kind = OUT;
116
+ break;
117
+ case 'EXT-X-CUE-OUT-CONT':
118
+ kind = OUT_CONT;
119
+ break;
120
+ case 'EXT-X-CUE-IN':
121
+ kind = IN;
122
+ break;
123
+ }
124
+ }
125
+ });
126
+ kind && (cueResult = {
127
+ kind,
128
+ duration
129
+ });
130
+ }
131
+
132
+ return cueResult;
133
+ }
134
+ }
@@ -0,0 +1,14 @@
1
+ export type AdRollType = 'preroll' | 'middleroll' | 'repeatableroll' | 'pauseroll' | 'postroll' | 'scteroll';
2
+
3
+ export type AdRollItem = {
4
+ startTime: number;
5
+ startTimePercent: number;
6
+ tag: string;
7
+ };
8
+
9
+ export type AdRollDesc = {
10
+ data: AdRollItem[];
11
+ oneByOne?: boolean;
12
+ };
13
+
14
+ export type VastAdsOptions = Partial<Record<AdRollType, AdRollDesc>>;
@@ -0,0 +1,37 @@
1
+ import assert from 'assert';
2
+ import XHRURLHandler from './xmlhttprequest.js';
3
+
4
+ // eslint-disable-next-line max-len
5
+ const ERROR_MESSAGE = 'Current context is not supported by any of the default URLHandlers. Please provide a custom URLHandler';
6
+
7
+ export default class URLHandler {
8
+ static get(url: string, options: any, cb?: (err: any | null, response?: any) => void) {
9
+ // Allow skip of the options param
10
+ if (!cb) {
11
+ if (typeof options === 'function') {
12
+ cb = options;
13
+ }
14
+ options = {};
15
+ }
16
+
17
+ assert(cb, 'URLHandler.get: callback is required');
18
+ if (options.response) {
19
+ // Trick: the VAST response XML document is passed as an option
20
+ const { response } = options;
21
+
22
+ delete options.response;
23
+
24
+ return cb(null, response);
25
+ }
26
+
27
+ if (options.urlhandler?.supported()) {
28
+ // explicitly supply your own URLHandler object
29
+ return options.urlhandler.get(url, options, cb);
30
+ }
31
+ if (XHRURLHandler.supported()) {
32
+ return XHRURLHandler.get(url, options, cb);
33
+ }
34
+
35
+ return cb(new Error(ERROR_MESSAGE));
36
+ }
37
+ }
@@ -0,0 +1,44 @@
1
+ import { reportError } from '@gcorevideo/utils';
2
+ import assert from "assert";
3
+
4
+ export default class XHRURLHandler {
5
+ static xhrCreate(): XMLHttpRequest | false {
6
+ const xhr = new window.XMLHttpRequest();
7
+
8
+ if ('withCredentials' in xhr) { // check CORS support
9
+ return xhr;
10
+ }
11
+
12
+ return false;
13
+ }
14
+
15
+ static supported() {
16
+ return !!this.xhrCreate();
17
+ }
18
+
19
+ static get(url: string, options: any, cb: (err: Error | null, response?: any) => void) {
20
+ try {
21
+ const xhr = this.xhrCreate();
22
+ assert(xhr, 'XHRURLHandler: XMLHttpRequest is not supported');
23
+
24
+ xhr.open('GET', url);
25
+ xhr.timeout = options.timeout || 0;
26
+ xhr.withCredentials = options.withCredentials || false;
27
+ xhr.onreadystatechange = function() {
28
+ if (xhr.readyState === 4) {
29
+ if (xhr.status === 200) {
30
+ return cb(null, xhr.response);
31
+ } else {
32
+ return cb(new Error(`XHRURLHandler: ${xhr.statusText}`));
33
+ }
34
+ }
35
+ };
36
+
37
+ return xhr.send();
38
+ } catch (error) {
39
+ // LogManager.exception(error);
40
+ reportError(error);
41
+ return cb(new Error('XHRURLHandler: Unexpected error'));
42
+ }
43
+ }
44
+ }