@gcorevideo/player 2.18.3 → 2.19.1

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 (404) 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/{index-C02TmVOf.js → plugins/index.js/index.plugins.js} +29283 -29567
  115. package/lib/index.core.d.ts +15 -0
  116. package/lib/index.core.d.ts.map +1 -0
  117. package/lib/index.core.js +14 -0
  118. package/lib/index.d.ts +2 -14
  119. package/lib/index.d.ts.map +1 -1
  120. package/lib/index.js +2 -14
  121. package/lib/index.plugins.d.ts +37 -0
  122. package/lib/index.plugins.d.ts.map +1 -0
  123. package/lib/index.plugins.js +39 -0
  124. package/lib/plugins/audio-selector/AudioSelector.d.ts +3 -3
  125. package/lib/plugins/audio-selector/AudioSelector.d.ts.map +1 -1
  126. package/lib/plugins/audio-selector/AudioSelector.js +6 -12
  127. package/lib/plugins/big-mute-button/BigMuteButton.d.ts +2 -2
  128. package/lib/plugins/big-mute-button/BigMuteButton.d.ts.map +1 -1
  129. package/lib/plugins/big-mute-button/BigMuteButton.js +7 -12
  130. package/lib/plugins/bottom-gear/BottomGear.d.ts +4 -3
  131. package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
  132. package/lib/plugins/bottom-gear/BottomGear.js +11 -16
  133. package/lib/plugins/build.d.ts +2 -0
  134. package/lib/plugins/build.d.ts.map +1 -0
  135. package/lib/plugins/build.js +1 -0
  136. package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts +44 -0
  137. package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts.map +1 -0
  138. package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.js +294 -0
  139. package/lib/plugins/clappr-nerd-stats/formatter.d.ts +8 -0
  140. package/lib/plugins/clappr-nerd-stats/formatter.d.ts.map +1 -0
  141. package/lib/plugins/clappr-nerd-stats/formatter.js +91 -0
  142. package/lib/plugins/clappr-nerd-stats/speedtest/Speedtest.d.ts +54 -0
  143. package/lib/plugins/clappr-nerd-stats/speedtest/Speedtest.d.ts.map +1 -0
  144. package/lib/plugins/clappr-nerd-stats/speedtest/Speedtest.js +335 -0
  145. package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts +9 -0
  146. package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts.map +1 -0
  147. package/lib/plugins/clappr-nerd-stats/speedtest/index.js +154 -0
  148. package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts +6 -0
  149. package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts.map +1 -0
  150. package/lib/plugins/clappr-nerd-stats/types.d.ts +4 -0
  151. package/lib/plugins/clappr-nerd-stats/types.d.ts.map +1 -0
  152. package/lib/plugins/clappr-stats/ClapprStats.d.ts +56 -0
  153. package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -0
  154. package/lib/plugins/clappr-stats/ClapprStats.js +332 -0
  155. package/lib/plugins/clappr-stats/types.d.ts +50 -0
  156. package/lib/plugins/clappr-stats/types.d.ts.map +1 -0
  157. package/lib/plugins/clappr-stats/types.js +5 -0
  158. package/lib/plugins/clappr-stats/utils.d.ts +3 -0
  159. package/lib/plugins/clappr-stats/utils.d.ts.map +1 -0
  160. package/lib/plugins/clappr-stats/utils.js +40 -0
  161. package/lib/plugins/click-to-pause/ClickToPause.d.ts +2 -2
  162. package/lib/plugins/click-to-pause/ClickToPause.d.ts.map +1 -1
  163. package/lib/plugins/click-to-pause/ClickToPause.js +4 -6
  164. package/lib/plugins/clips/Clips.d.ts +23 -0
  165. package/lib/plugins/clips/Clips.d.ts.map +1 -0
  166. package/lib/plugins/clips/Clips.js +109 -0
  167. package/lib/plugins/context-menu/ContextMenu.d.ts +36 -0
  168. package/lib/plugins/context-menu/ContextMenu.d.ts.map +1 -0
  169. package/lib/plugins/context-menu/ContextMenu.js +102 -0
  170. package/lib/plugins/disable-controls/DisableControls.d.ts +1 -1
  171. package/lib/plugins/disable-controls/DisableControls.d.ts.map +1 -1
  172. package/lib/plugins/disable-controls/DisableControls.js +3 -5
  173. package/lib/plugins/dvr-controls/{DVRControls.d.ts → DvrControls.d.ts} +4 -4
  174. package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -0
  175. package/lib/plugins/dvr-controls/{DVRControls.js → DvrControls.js} +5 -4
  176. package/lib/plugins/error-screen/ErrorScreen.d.ts +44 -0
  177. package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -0
  178. package/lib/plugins/error-screen/ErrorScreen.js +179 -0
  179. package/lib/plugins/favicon/Favicon.d.ts +24 -0
  180. package/lib/plugins/favicon/Favicon.d.ts.map +1 -0
  181. package/lib/plugins/favicon/Favicon.js +106 -0
  182. package/lib/plugins/google-analytics/GoogleAnalytics.d.ts +30 -0
  183. package/lib/plugins/google-analytics/GoogleAnalytics.d.ts.map +1 -0
  184. package/lib/plugins/google-analytics/GoogleAnalytics.js +114 -0
  185. package/lib/plugins/index.d.ts +38 -0
  186. package/lib/plugins/index.d.ts.map +1 -0
  187. package/lib/plugins/index.js +40 -0
  188. package/lib/plugins/kibo/index.d.ts +23 -0
  189. package/lib/plugins/kibo/index.d.ts.map +1 -0
  190. package/lib/plugins/kibo/index.js +199 -0
  191. package/lib/plugins/level-selector/LevelSelector.d.ts +48 -17
  192. package/lib/plugins/level-selector/LevelSelector.d.ts.map +1 -1
  193. package/lib/plugins/level-selector/LevelSelector.js +169 -155
  194. package/lib/plugins/logo/Logo.d.ts +29 -0
  195. package/lib/plugins/logo/Logo.d.ts.map +1 -0
  196. package/lib/plugins/logo/Logo.js +181 -0
  197. package/lib/plugins/logo/utils/index.d.ts +22 -0
  198. package/lib/plugins/logo/utils/index.d.ts.map +1 -0
  199. package/lib/plugins/logo/utils/index.js +32 -0
  200. package/lib/plugins/media-control/MediaControl.d.ts +20 -25
  201. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  202. package/lib/plugins/media-control/MediaControl.js +136 -106
  203. package/lib/plugins/multi-camera/MultiCamera.d.ts +59 -0
  204. package/lib/plugins/multi-camera/MultiCamera.d.ts.map +1 -0
  205. package/lib/plugins/multi-camera/MultiCamera.js +353 -0
  206. package/lib/plugins/picture-in-picture/PictureInPicture.d.ts +20 -0
  207. package/lib/plugins/picture-in-picture/PictureInPicture.d.ts.map +1 -0
  208. package/lib/plugins/picture-in-picture/PictureInPicture.js +68 -0
  209. package/lib/plugins/playback-rate/PlaybackRate.d.ts +42 -0
  210. package/lib/plugins/playback-rate/PlaybackRate.d.ts.map +1 -0
  211. package/lib/plugins/playback-rate/PlaybackRate.js +205 -0
  212. package/lib/plugins/poster/Poster.d.ts +18 -17
  213. package/lib/plugins/poster/Poster.d.ts.map +1 -1
  214. package/lib/plugins/poster/Poster.js +83 -37
  215. package/lib/plugins/seek-time/SeekTime.d.ts +38 -0
  216. package/lib/plugins/seek-time/SeekTime.d.ts.map +1 -0
  217. package/lib/plugins/seek-time/SeekTime.js +153 -0
  218. package/lib/plugins/share/Share.d.ts +38 -0
  219. package/lib/plugins/share/Share.d.ts.map +1 -0
  220. package/lib/plugins/share/Share.js +122 -0
  221. package/lib/plugins/skip-time/SkipTime.d.ts +28 -0
  222. package/lib/plugins/skip-time/SkipTime.d.ts.map +1 -0
  223. package/lib/plugins/skip-time/SkipTime.js +86 -0
  224. package/lib/plugins/source-controller/SourceController.d.ts +41 -0
  225. package/lib/plugins/source-controller/SourceController.d.ts.map +1 -0
  226. package/lib/plugins/source-controller/SourceController.js +199 -0
  227. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts +26 -0
  228. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -0
  229. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +117 -0
  230. package/lib/plugins/statistics/Statistics.d.ts +52 -0
  231. package/lib/plugins/statistics/Statistics.d.ts.map +1 -0
  232. package/lib/plugins/statistics/Statistics.js +130 -0
  233. package/lib/plugins/subtitles/Subtitles.d.ts +61 -0
  234. package/lib/plugins/subtitles/Subtitles.d.ts.map +1 -0
  235. package/lib/plugins/subtitles/Subtitles.js +354 -0
  236. package/lib/plugins/thumbnails/Thumbnails.d.ts +47 -0
  237. package/lib/plugins/thumbnails/Thumbnails.d.ts.map +1 -0
  238. package/lib/plugins/thumbnails/Thumbnails.js +414 -0
  239. package/lib/plugins/types.d.ts +8 -0
  240. package/lib/plugins/types.d.ts.map +1 -0
  241. package/lib/plugins/types.js +1 -0
  242. package/lib/plugins/utils.d.ts +5 -0
  243. package/lib/plugins/utils.d.ts.map +1 -0
  244. package/lib/plugins/utils.js +68 -0
  245. package/lib/plugins/vast-ads/VastAds.d.ts +72 -0
  246. package/lib/plugins/vast-ads/VastAds.d.ts.map +1 -0
  247. package/lib/plugins/vast-ads/VastAds.js +686 -0
  248. package/lib/plugins/vast-ads/loaderxml.d.ts +32 -0
  249. package/lib/plugins/vast-ads/loaderxml.d.ts.map +1 -0
  250. package/lib/plugins/vast-ads/loaderxml.js +226 -0
  251. package/lib/plugins/vast-ads/roll.d.ts +60 -0
  252. package/lib/plugins/vast-ads/roll.d.ts.map +1 -0
  253. package/lib/plugins/vast-ads/roll.js +415 -0
  254. package/lib/plugins/vast-ads/rollmanager.d.ts +62 -0
  255. package/lib/plugins/vast-ads/rollmanager.d.ts.map +1 -0
  256. package/lib/plugins/vast-ads/rollmanager.js +347 -0
  257. package/lib/plugins/vast-ads/sctemanager.d.ts +18 -0
  258. package/lib/plugins/vast-ads/sctemanager.d.ts.map +1 -0
  259. package/lib/plugins/vast-ads/sctemanager.js +116 -0
  260. package/lib/plugins/vast-ads/types.d.ts +12 -0
  261. package/lib/plugins/vast-ads/types.d.ts.map +1 -0
  262. package/lib/plugins/vast-ads/types.js +1 -0
  263. package/lib/plugins/vast-ads/urlhandler.d.ts +4 -0
  264. package/lib/plugins/vast-ads/urlhandler.d.ts.map +1 -0
  265. package/lib/plugins/vast-ads/urlhandler.js +30 -0
  266. package/lib/plugins/vast-ads/xmlhttprequest.d.ts +6 -0
  267. package/lib/plugins/vast-ads/xmlhttprequest.d.ts.map +1 -0
  268. package/lib/plugins/vast-ads/xmlhttprequest.js +39 -0
  269. package/lib/plugins/vast-ads/xmlmerge.d.ts +12 -0
  270. package/lib/plugins/vast-ads/xmlmerge.d.ts.map +1 -0
  271. package/lib/plugins/vast-ads/xmlmerge.js +82 -0
  272. package/lib/plugins/volume-fade/VolumeFade.d.ts +21 -0
  273. package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -0
  274. package/lib/plugins/volume-fade/VolumeFade.js +90 -0
  275. package/package.json +10 -2
  276. package/rollup.config.js +32 -2
  277. package/src/index.core.ts +15 -0
  278. package/src/index.plugins.ts +41 -0
  279. package/src/index.ts +2 -15
  280. package/src/plugins/audio-selector/AudioSelector.ts +370 -0
  281. package/src/plugins/big-mute-button/BigMuteButton.ts +187 -0
  282. package/src/plugins/bottom-gear/BottomGear.ts +122 -0
  283. package/src/plugins/build.ts +1 -0
  284. package/src/plugins/clappr-nerd-stats/ClapprNerdStats.ts +369 -0
  285. package/src/plugins/clappr-nerd-stats/formatter.ts +109 -0
  286. package/src/plugins/clappr-nerd-stats/speedtest/Speedtest.ts +414 -0
  287. package/src/plugins/clappr-nerd-stats/speedtest/index.ts +183 -0
  288. package/src/plugins/clappr-nerd-stats/speedtest/types.ts +5 -0
  289. package/src/plugins/clappr-nerd-stats/types.ts +3 -0
  290. package/src/plugins/clappr-stats/ClapprStats.ts +441 -0
  291. package/src/plugins/clappr-stats/types.ts +52 -0
  292. package/src/plugins/clappr-stats/utils.ts +42 -0
  293. package/src/plugins/click-to-pause/ClickToPause.ts +93 -0
  294. package/src/plugins/clips/Clips.ts +152 -0
  295. package/src/plugins/context-menu/ContextMenu.ts +134 -0
  296. package/src/plugins/disable-controls/DisableControls.ts +81 -0
  297. package/src/plugins/dvr-controls/DvrControls.ts +131 -0
  298. package/src/plugins/error-screen/ErrorScreen.ts +241 -0
  299. package/src/plugins/favicon/Favicon.ts +137 -0
  300. package/src/plugins/ga-events/GaEvents.js +395 -0
  301. package/src/plugins/ga-events/ga-tracking.js +46 -0
  302. package/src/plugins/google-analytics/GoogleAnalytics.ts +147 -0
  303. package/src/plugins/index.ts +42 -0
  304. package/src/plugins/kibo/index.ts +244 -0
  305. package/src/plugins/level-selector/LevelSelector.ts +400 -0
  306. package/src/plugins/level-selector/__tests__/LevelSelector.test.ts +72 -0
  307. package/src/plugins/level-selector/__tests__/__snapshots__/LevelSelector.test.ts.snap +11 -0
  308. package/src/plugins/logo/Logo.ts +233 -0
  309. package/src/plugins/logo/utils/index.ts +46 -0
  310. package/src/plugins/media-control/MediaControl.ts +1383 -0
  311. package/src/plugins/multi-camera/MultiCamera copy.xts +414 -0
  312. package/src/plugins/multi-camera/MultiCamera.ts +426 -0
  313. package/src/plugins/picture-in-picture/PictureInPicture.ts +87 -0
  314. package/src/plugins/playback-rate/PlaybackRate.ts +269 -0
  315. package/src/plugins/poster/Poster.ts +298 -0
  316. package/src/plugins/seek-time/SeekTime.ts +191 -0
  317. package/src/plugins/share/Share.ts +148 -0
  318. package/src/plugins/skip-time/SkipTime.ts +109 -0
  319. package/src/plugins/source-controller/SourceController.ts +239 -0
  320. package/src/plugins/source-controller/__tests__/SourceController.test.ts +230 -0
  321. package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +135 -0
  322. package/src/plugins/statistics/Statistics copy.xts +296 -0
  323. package/src/plugins/statistics/Statistics.ts +207 -0
  324. package/src/plugins/subtitles/Subtitles.ts +505 -0
  325. package/src/plugins/thumbnails/Thumbnails.ts +530 -0
  326. package/src/plugins/types.ts +7 -0
  327. package/src/plugins/typings/globals.d.ts +10 -0
  328. package/src/plugins/typings/parse-srt.d.ts +14 -0
  329. package/src/plugins/typings/workers.d.ts +3 -0
  330. package/src/plugins/utils.ts +77 -0
  331. package/src/plugins/vast-ads/VastAds.ts +915 -0
  332. package/src/plugins/vast-ads/loaderxml.ts +260 -0
  333. package/src/plugins/vast-ads/roll.ts +492 -0
  334. package/src/plugins/vast-ads/rollmanager.ts +403 -0
  335. package/src/plugins/vast-ads/sctemanager.ts +134 -0
  336. package/src/plugins/vast-ads/types.ts +14 -0
  337. package/src/plugins/vast-ads/urlhandler.ts +37 -0
  338. package/src/plugins/vast-ads/xmlhttprequest.ts +44 -0
  339. package/src/plugins/vast-ads/xmlmerge.ts +96 -0
  340. package/src/plugins/video360/VRControls.js +104 -0
  341. package/src/plugins/video360/VREffect.js +422 -0
  342. package/src/plugins/video360/Video360.js +979 -0
  343. package/src/plugins/video360/orbit-oriention-controls.js +1002 -0
  344. package/src/plugins/video360/utils.js +49 -0
  345. package/src/plugins/volume-fade/VolumeFade.ts +109 -0
  346. package/tsconfig.tsbuildinfo +1 -1
  347. package/dist/HlsPlayback-D9EmONbV.js +0 -747
  348. package/dist/player.d.ts +0 -646
  349. package/lib/backend.d.ts +0 -3
  350. package/lib/backend.d.ts.map +0 -1
  351. package/lib/backend.js +0 -10
  352. package/lib/constants.d.ts +0 -1
  353. package/lib/constants.d.ts.map +0 -1
  354. package/lib/constants.js +0 -1
  355. package/lib/gcore.types.d.ts +0 -84
  356. package/lib/gcore.types.d.ts.map +0 -1
  357. package/lib/gcore.types.js +0 -9
  358. package/lib/plugins/dash-playback/DashPlayback.d.ts +0 -73
  359. package/lib/plugins/dash-playback/DashPlayback.d.ts.map +0 -1
  360. package/lib/plugins/dash-playback/DashPlayback.js +0 -455
  361. package/lib/plugins/dash-playback/types.d.ts +0 -6
  362. package/lib/plugins/dash-playback/types.d.ts.map +0 -1
  363. package/lib/plugins/dash-plugin/DashPlayback.d.ts +0 -86
  364. package/lib/plugins/dash-plugin/DashPlayback.d.ts.map +0 -1
  365. package/lib/plugins/dash-plugin/DashPlayback.js +0 -659
  366. package/lib/plugins/dvr-controls/DVRControls.d.ts.map +0 -1
  367. package/lib/plugins/hls-playback/HlsPlayback.d.ts +0 -102
  368. package/lib/plugins/hls-playback/HlsPlayback.d.ts.map +0 -1
  369. package/lib/plugins/hls-playback/HlsPlayback.js +0 -815
  370. package/lib/trace/LogTracer.d.ts +0 -12
  371. package/lib/trace/LogTracer.d.ts.map +0 -1
  372. package/lib/trace/LogTracer.js +0 -17
  373. package/lib/trace/SentryTracer.d.ts +0 -12
  374. package/lib/trace/SentryTracer.d.ts.map +0 -1
  375. package/lib/trace/SentryTracer.js +0 -23
  376. package/lib/trace/Tracer.d.ts +0 -13
  377. package/lib/trace/Tracer.d.ts.map +0 -1
  378. package/lib/trace/Tracer.js +0 -15
  379. package/lib/trace/index.d.ts +0 -18
  380. package/lib/trace/index.d.ts.map +0 -1
  381. package/lib/trace/index.js +0 -27
  382. package/lib/trace/types.d.ts +0 -8
  383. package/lib/trace/types.d.ts.map +0 -1
  384. package/lib/tsdoc-metadata.json +0 -11
  385. package/lib/utils/Logger.d.ts +0 -23
  386. package/lib/utils/Logger.d.ts.map +0 -1
  387. package/lib/utils/Logger.js +0 -81
  388. package/lib/utils/canAutoplay.d.ts +0 -6
  389. package/lib/utils/canAutoplay.d.ts.map +0 -1
  390. package/lib/utils/canAutoplay.js +0 -30
  391. package/lib/utils/queryParams.d.ts +0 -2
  392. package/lib/utils/queryParams.d.ts.map +0 -1
  393. package/lib/utils/queryParams.js +0 -4
  394. package/lib/utils/scripts-load.d.ts +0 -2
  395. package/lib/utils/scripts-load.d.ts.map +0 -1
  396. package/lib/utils/scripts-load.js +0 -20
  397. package/lib/utils/testUtils.d.ts +0 -3
  398. package/lib/utils/testUtils.d.ts.map +0 -1
  399. package/lib/utils/testUtils.js +0 -12
  400. package/lib/utils/utils.d.ts +0 -3
  401. package/lib/utils/utils.d.ts.map +0 -1
  402. package/lib/utils/utils.js +0 -31
  403. /package/lib/plugins/{dash-playback → clappr-nerd-stats/speedtest}/types.js +0 -0
  404. /package/lib/{trace → plugins/clappr-nerd-stats}/types.js +0 -0
@@ -0,0 +1,686 @@
1
+ import { $, Browser, Events, HTML5Video, Log, UICorePlugin, Utils, } from '@clappr/core';
2
+ import { reportError } from '@gcorevideo/utils';
3
+ import assert from 'assert';
4
+ import { CLAPPR_VERSION } from '../build.js';
5
+ import RollManager from './rollmanager.js';
6
+ import SCTEManager from './sctemanager.js';
7
+ import { VolumeFadeEvents } from '../volume-fade/VolumeFade.js';
8
+ import '../../../assets/vast-ads/style.scss';
9
+ import volumeIcon from '../../../assets/icons/new/volume-max.svg';
10
+ import volumeMuteIcon from '../../../assets/icons/new/volume-off.svg';
11
+ const VERSION = '0.0.1';
12
+ export class VastAds extends UICorePlugin {
13
+ _clickToPausePlugin = null;
14
+ _cloneContainerEvents = null;
15
+ _clonePlaybackEvents = null;
16
+ countMiddleRoll = 0;
17
+ countRepeatableRoll = 0;
18
+ _container = null;
19
+ container = null;
20
+ _contentElement = null;
21
+ _currentPosition = 0;
22
+ currentState = '';
23
+ _imaIsloaded = false;
24
+ _imaLoadResult = false;
25
+ intervalTimer = null;
26
+ _playback = null;
27
+ _pluginIsReady = false;
28
+ _posterBigPlayStyle = null;
29
+ _posterPlugin = null;
30
+ _prevVolumeValue = 0;
31
+ vast = null;
32
+ _volume = 80;
33
+ startTimeRepeatableRoll = 0;
34
+ startTimeRepeatableRollGap = 0;
35
+ _scteManager = new SCTEManager();
36
+ $skipAd = null;
37
+ $muteIcon = null;
38
+ $areaClick = null;
39
+ _$adContainer = null;
40
+ _adContainer = null;
41
+ get name() {
42
+ return 'clappr-vast-ad-plugin';
43
+ }
44
+ get supportedVersion() {
45
+ return { min: CLAPPR_VERSION };
46
+ }
47
+ static get version() {
48
+ return VERSION;
49
+ }
50
+ get mediaControl() {
51
+ return this.core.mediaControl;
52
+ }
53
+ get attributes() {
54
+ return {
55
+ class: this.name,
56
+ 'data-vast-ads': '',
57
+ };
58
+ }
59
+ constructor(core) {
60
+ super(core);
61
+ const cfg = this.options.vastAds;
62
+ try {
63
+ const no_lib = 'google' in window && window.google.ima;
64
+ if (!no_lib || !cfg) {
65
+ this.disable();
66
+ return;
67
+ }
68
+ }
69
+ catch (error) {
70
+ // LogManager.exception(error);
71
+ reportError(error);
72
+ this.disable();
73
+ return;
74
+ }
75
+ // TODO: Add an option which is an array of plugin name to disable
76
+ try {
77
+ if (!cfg.preroll) {
78
+ this._pluginError('tag option is required');
79
+ this.disable();
80
+ return;
81
+ }
82
+ }
83
+ catch (error) {
84
+ this._pluginError('tag option is required');
85
+ this.disable();
86
+ // LogManager.message('Advertisement: tag option is required', SentryLogLevel.ERROR);
87
+ reportError(error);
88
+ return;
89
+ }
90
+ if (cfg.middleroll?.data?.length > 0) {
91
+ cfg.middleroll.data = cfg.middleroll.data
92
+ .filter(({ startTimePercent }) => startTimePercent >= 10 && startTimePercent <= 90)
93
+ .sort((a, b) => a.startTimePercent - b.startTimePercent);
94
+ }
95
+ if (cfg.repeatableroll?.data?.length > 0) {
96
+ cfg.repeatableroll.data = cfg.repeatableroll.data
97
+ .filter(({ startTime }) => startTime >= 2)
98
+ .sort((a, b) => a.startTime - b.startTime);
99
+ }
100
+ let lang = (this.core.options.language || Utils.getBrowserLanguage())
101
+ .toLowerCase()
102
+ .replace(/_/g, '-');
103
+ if (lang.indexOf('_') < 0) {
104
+ lang += '_' + lang;
105
+ }
106
+ if ('google' in window && window.google.ima) {
107
+ ;
108
+ window.google.ima.settings.setLocale(lang);
109
+ }
110
+ }
111
+ bindEvents() {
112
+ const no_lib = 'google' in window && window.google.ima;
113
+ if (!no_lib) {
114
+ return;
115
+ }
116
+ if (this._scteManager) {
117
+ // @ts-ignore
118
+ this._scteManager.on('startSCTERoll', () => {
119
+ this.initializeRollManager({
120
+ type: 'scteroll',
121
+ });
122
+ });
123
+ // @ts-ignore
124
+ this._scteManager.on('stopSCTERoll', () => {
125
+ this._playVideoContent('scteroll');
126
+ });
127
+ }
128
+ this.listenToOnce(this.core, Events.CORE_READY, this._onCoreReady);
129
+ this.listenTo(this.core, Events.CORE_RESIZE, this.playerResize);
130
+ if (this.container) {
131
+ this.listenTo(this.container, Events.CONTAINER_VOLUME, this._onContainerVolume);
132
+ }
133
+ this.listenTo(this.core, VolumeFadeEvents.FADE, this._onVolumeChanged);
134
+ if (this.playback) {
135
+ this.listenTo(this.container, Events.CONTAINER_SEEK, (e) => {
136
+ if (this.container.advertisement.type === 'middleroll') {
137
+ this.countMiddleRoll = this.findCloserAdvertisement(this.options.vastAds.middleroll, 'startTimePercent', this.countMiddleRoll, e);
138
+ }
139
+ else {
140
+ this.countRepeatableRoll = this.findCloserAdvertisement(this.options.vastAds.repeatableroll, 'startTime', this.countRepeatableRoll, e);
141
+ }
142
+ });
143
+ this.listenTo(this.playback, Events.PLAYBACK_LEVEL_SWITCH_START, () => {
144
+ if (this.currentState === 'pause') {
145
+ return;
146
+ }
147
+ this.currentState = 'switch';
148
+ });
149
+ this.listenTo(this.playback, Events.PLAYBACK_TIMEUPDATE, this.onPlaybackTimeUpdate);
150
+ this.listenTo(this.playback, Events.PLAYBACK_ENDED, this.onPlaybackEnded);
151
+ this._pauserollListeners();
152
+ this.listenToOnce(this.playback, Events.PLAYBACK_PLAY, () => {
153
+ if (this._posterBigPlayStyle) {
154
+ this._posterBigPlayStyle.remove();
155
+ this._posterBigPlayStyle = null;
156
+ }
157
+ });
158
+ this.listenTo(this.playback, Events.PLAYBACK_PLAY, this.onPlaybackPlay.bind(this));
159
+ this.listenToOnce(this.playback, 'playback:preroll:request', this.onPlaybackPrerollRequest);
160
+ }
161
+ if (this.mediaControl) {
162
+ this.listenToOnce(this.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.containerChanged);
163
+ }
164
+ }
165
+ onPlaybackEnded() {
166
+ if (this.playback?.getPlaybackType() !== 'live') {
167
+ this.countMiddleRoll = 0;
168
+ this.countRepeatableRoll = 0;
169
+ this.initializeRollManager({
170
+ type: 'postroll',
171
+ });
172
+ this._pauserollListeners();
173
+ }
174
+ }
175
+ onPlaybackPlay() {
176
+ setTimeout(() => {
177
+ const posterPlugin = this.container?.getPlugin('poster_custom');
178
+ posterPlugin?.enable();
179
+ posterPlugin?.$el.hide();
180
+ this._posterPlugin?.$playWrapper.show();
181
+ // TODO trigger event or call a method instead
182
+ }, 0);
183
+ }
184
+ onPlaybackPrerollRequest() {
185
+ try {
186
+ this.initializeRollManager({
187
+ type: 'preroll',
188
+ });
189
+ }
190
+ catch (error) {
191
+ // LogManager.exception(error);
192
+ reportError(error);
193
+ }
194
+ }
195
+ onPlaybackTimeUpdate(e) {
196
+ if (this.container?.advertisement.type !== 'idle') {
197
+ return;
198
+ }
199
+ const middleroll = this._options.VastAds.middleroll;
200
+ assert(this.playback, 'playback is not defined');
201
+ if (middleroll && this.playback.getPlaybackType() === 'vod') {
202
+ const currentPercent = Math.floor((e.current / e.total) * 100);
203
+ const middlerollData = middleroll.data[this.countMiddleRoll];
204
+ if (middlerollData && middlerollData.startTimePercent <= currentPercent) {
205
+ // TODO fixit
206
+ // @ts-ignore
207
+ this._currentPosition = this.playback.getCurrentTime();
208
+ this.initializeRollManager({
209
+ type: 'middleroll',
210
+ count: this.countMiddleRoll,
211
+ });
212
+ }
213
+ }
214
+ if (this._options.VastAds.repeatableroll &&
215
+ this.playback.getPlaybackType() === 'live') {
216
+ try {
217
+ if (!this.playback.el.played ||
218
+ !this.playback.el.played.length) {
219
+ return;
220
+ }
221
+ let startTime = this.playback.el.played.start(0) ||
222
+ this.startTimeRepeatableRoll;
223
+ if (!this.startTimeRepeatableRoll) {
224
+ if (!startTime) {
225
+ this.startTimeRepeatableRoll = startTime = this.playback.el.currentTime;
226
+ }
227
+ }
228
+ const currentTime = this.playback.el.currentTime -
229
+ startTime +
230
+ this.startTimeRepeatableRollGap;
231
+ const repeatablerollData = this._options.VastAds.repeatableroll.data[this.countRepeatableRoll];
232
+ if (repeatablerollData && repeatablerollData.startTime <= currentTime) {
233
+ this.startTimeRepeatableRollGap = currentTime;
234
+ this.initializeRollManager({
235
+ type: 'repeatableroll',
236
+ });
237
+ }
238
+ }
239
+ catch (error) {
240
+ // LogManager.exception(error);
241
+ reportError(error);
242
+ }
243
+ }
244
+ }
245
+ rebindNextAd() {
246
+ if (Object.keys(this._scteManager).length > 0) {
247
+ this.containerChanged();
248
+ }
249
+ }
250
+ initializeRollManager({ type, count, }) {
251
+ this.destroyRoll();
252
+ assert(this._adContainer, '_adContainer is not defined');
253
+ const vast = new RollManager(this.core, this.options, this.$skipAd, this.$muteIcon, this.$areaClick, this._adContainer, type, count || 0, this._volume, this._prevVolumeValue);
254
+ // @ts-ignore
255
+ vast.on('advertisement_finish', (data) => {
256
+ this._playVideoContent(data.type, !!Browser.isiOS);
257
+ });
258
+ // @ts-ignore
259
+ vast.on('advertisement_dont_play', (data) => {
260
+ this._playVideoContent(data.type, true);
261
+ });
262
+ // @ts-ignore
263
+ vast.on('disable_plugin', (data) => {
264
+ this._playVideoContent(data.type);
265
+ this.disable();
266
+ });
267
+ // @ts-ignore
268
+ vast.on('advertisement_started', () => {
269
+ this.adsPlaying();
270
+ });
271
+ // @ts-ignore
272
+ vast.on('volume', (obj) => {
273
+ this.changeVolume(obj);
274
+ });
275
+ // @ts-ignore
276
+ vast.on('change_counter', (data) => {
277
+ if (data.type === 'middleroll') {
278
+ this.countMiddleRoll = data.value;
279
+ }
280
+ if (data.type === 'repeatableroll') {
281
+ this.countRepeatableRoll = data.value;
282
+ }
283
+ });
284
+ this.vast = vast;
285
+ vast.setupRoll();
286
+ }
287
+ changeVolume(obj) {
288
+ this._volume = obj.volume;
289
+ this.core.options.mute = this.options.mute = obj.mute;
290
+ Utils.Config.persist('volume', this._volume);
291
+ }
292
+ findCloserAdvertisement(roll, key, counter, time) {
293
+ if (!roll) {
294
+ return -1;
295
+ }
296
+ if (roll.data.length <= counter) {
297
+ return -1;
298
+ }
299
+ let val = 0;
300
+ assert(this.playback, 'playback is not defined');
301
+ if (~key.indexOf('Percent')) {
302
+ val = (time / this.playback.getDuration()) * 100;
303
+ }
304
+ else {
305
+ val = time;
306
+ }
307
+ const getNumber = (arr, searchNum) => arr.find((it) => Math.abs(it[key] - searchNum) ===
308
+ Math.min(...arr.map((it) => Math.abs(it[key] - searchNum))));
309
+ const searchEl = getNumber(roll.data, val);
310
+ if (!searchEl) {
311
+ return -1;
312
+ }
313
+ return roll.data.findIndex((el) => el.startTimePercent === searchEl.startTimePercent);
314
+ }
315
+ _validateData(roll) {
316
+ try {
317
+ if (roll.data.length) {
318
+ if (!Object.prototype.hasOwnProperty.call(roll, 'oneByOne')) {
319
+ roll.oneByOne = false;
320
+ }
321
+ return true;
322
+ }
323
+ else {
324
+ return false;
325
+ }
326
+ }
327
+ catch (error) {
328
+ // LogManager.exception(error);
329
+ reportError(error);
330
+ return false;
331
+ }
332
+ }
333
+ playerResize(size) {
334
+ this.$el.removeClass('w370');
335
+ if (size.width <= 370 || this.options.hideVolumeBar) {
336
+ this.$el.addClass('w370');
337
+ }
338
+ if (this.vast) {
339
+ this.vast.playerResize(size);
340
+ }
341
+ }
342
+ _stopPauserollListeners() {
343
+ // @ts-ignore
344
+ this.stopListening(this.playback, Events.PLAYBACK_PLAY);
345
+ // @ts-ignore
346
+ this.stopListening(this.playback, Events.PLAYBACK_PAUSE);
347
+ }
348
+ _pauserollListeners() {
349
+ if (!this._validateData(this._options.VastAds.pauseroll)) {
350
+ return;
351
+ }
352
+ this._stopPauserollListeners();
353
+ this.currentState = '';
354
+ this.listenTo(this.playback, Events.PLAYBACK_PLAY, () => {
355
+ if (this.currentState === 'pause') {
356
+ this.currentState = 'play';
357
+ setTimeout(() => {
358
+ assert(this.playback, 'playback is not defined');
359
+ this.playback.pause();
360
+ // @ts-ignore
361
+ this._currentPosition = this.playback.getCurrentTime();
362
+ this.initializeRollManager({
363
+ type: 'pauseroll',
364
+ });
365
+ }, 0);
366
+ return;
367
+ }
368
+ // @ts-ignore
369
+ this.stopListening(this.playback, Events.PLAYBACK_PAUSE);
370
+ // @ts-ignore
371
+ this.stopListening(this.playback, Events.PLAYBACK_STOP);
372
+ const wsPlugin = this.core.getPlugin('ws_plugin');
373
+ if (this.playback?.getPlaybackType() === 'live' &&
374
+ wsPlugin?.state === 'live') {
375
+ this.listenToOnce(this.playback, Events.PLAYBACK_STOP, () => {
376
+ console.warn('stop stream', this.currentState);
377
+ this.currentState = 'pause';
378
+ });
379
+ }
380
+ else {
381
+ this.listenToOnce(this.playback, Events.PLAYBACK_PAUSE, () => {
382
+ console.warn('pause stream', this.currentState);
383
+ if (this.currentState === 'switch') {
384
+ return;
385
+ }
386
+ this.currentState = 'pause';
387
+ });
388
+ }
389
+ this.currentState = 'play';
390
+ });
391
+ }
392
+ unBindEvents() {
393
+ // @ts-ignore
394
+ this.stopListening(this.core, Events.CORE_READY);
395
+ // @ts-ignore
396
+ this.stopListening(this.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED);
397
+ // @ts-ignore
398
+ this.stopListening(this.container, Events.CONTAINER_LOADEDMETADATA);
399
+ }
400
+ containerChanged() {
401
+ this.container = this.core.activeContainer;
402
+ this.container.advertisement = { type: 'idle' };
403
+ this._container = this.container;
404
+ this.playback = this.container?.playback;
405
+ assert(this.playback, 'playback is not defined');
406
+ this._contentElement = this.playback.el;
407
+ this._volume =
408
+ this.core &&
409
+ this.core.mediaControl &&
410
+ this.core.mediaControl.volume !== null &&
411
+ this.core.mediaControl.volume !== undefined &&
412
+ !isNaN(this.core.mediaControl.volume)
413
+ ? this.core.mediaControl.volume
414
+ : 80;
415
+ this._prevVolumeValue = this._volume ? this._volume : 80;
416
+ this.core.mediaControl.container.$el.append(this.el);
417
+ this.$el.hide();
418
+ // @ts-ignore
419
+ this.stopListening();
420
+ // @ts-ignore
421
+ this._scteManager.off();
422
+ this.bindEvents();
423
+ }
424
+ _pluginError(msg) {
425
+ console.error(this.name + ': ' + msg);
426
+ }
427
+ _onCoreReady() {
428
+ this._container = this.core.activeContainer;
429
+ if (!this._container) {
430
+ this._pluginError('failed to get Clappr current container');
431
+ }
432
+ // Get current playback. (To get playback element)
433
+ this.playback = this.core.activePlayback;
434
+ if (!this.playback) {
435
+ this._pluginError('failed to get Clappr playback');
436
+ }
437
+ // Attempt to get poster plugin. (May interfere with media control)
438
+ this._posterPlugin = this._container?.getPlugin('poster_custom');
439
+ // Attempt to get click-to-pause plugin. (May interfere with advert click handling)
440
+ this._clickToPausePlugin = this._container?.getPlugin('click_to_pause_custom');
441
+ assert(this.playback, 'playback is not defined');
442
+ this._contentElement = this.playback.el;
443
+ if (this._pluginIsReady) {
444
+ return;
445
+ }
446
+ this._initPlugin();
447
+ }
448
+ set playback(value) {
449
+ this._scteManager.playback = value;
450
+ this._playback = value;
451
+ }
452
+ get playback() {
453
+ return this._playback;
454
+ }
455
+ _onContainerVolume(value) {
456
+ if (value === 0) {
457
+ this.options.mute = true;
458
+ }
459
+ else {
460
+ this._prevVolumeValue = value;
461
+ this.options.mute = false;
462
+ }
463
+ this._volume = value;
464
+ }
465
+ _onVolumeChanged(e) {
466
+ if (this._volume === e || e === 0) {
467
+ return;
468
+ }
469
+ this.options.mute = e === 0;
470
+ this._volume = e;
471
+ }
472
+ _stopListening() {
473
+ try {
474
+ assert(this._container, 'container is not defined');
475
+ if (!this._clonePlaybackEvents) {
476
+ for (const id in this._container._listeningTo) {
477
+ this._clonePlaybackEvents = Object.assign({}, this._container._listeningTo[id]._events);
478
+ this._container._listeningTo[id]._events = {};
479
+ }
480
+ }
481
+ if (!this._cloneContainerEvents) {
482
+ this._cloneContainerEvents = Object.assign({}, this._container._events);
483
+ this._container._events = {};
484
+ }
485
+ }
486
+ catch (error) {
487
+ // LogManager.exception(error);
488
+ reportError(error);
489
+ }
490
+ }
491
+ _startListening() {
492
+ try {
493
+ assert(this._container, 'container is not defined');
494
+ for (const id in this._container._listeningTo) {
495
+ ;
496
+ this._container._listeningTo[id]._events = Object.assign({}, this._clonePlaybackEvents);
497
+ }
498
+ this._container._events = Object.assign({}, this._cloneContainerEvents);
499
+ this._cloneContainerEvents = null;
500
+ this._clonePlaybackEvents = null;
501
+ }
502
+ catch (error) {
503
+ // LogManager.exception(error);
504
+ reportError(error);
505
+ }
506
+ }
507
+ _initPlugin() {
508
+ assert(this.playback, 'playback is not defined');
509
+ // Ensure browser can play video content. (Avoid to display an ad with nothing after)
510
+ if (this.playback.name === 'no_op') {
511
+ return;
512
+ }
513
+ // Ensure playback is using HTML5 video element if mobile device
514
+ if (this.playback.tagName !== 'video' && Browser.isMobile) {
515
+ this.destroy();
516
+ return;
517
+ }
518
+ this._pluginIsReady = true;
519
+ }
520
+ adsPlaying() {
521
+ assert(this.container, 'container is not defined');
522
+ const poster = this.container.getPlugin('poster_custom');
523
+ poster && poster.disable();
524
+ try {
525
+ const logo = this.container.getPlugin('logo');
526
+ logo && logo.disable();
527
+ }
528
+ catch (error) {
529
+ // LogManager.exception(error);
530
+ reportError(error);
531
+ }
532
+ this.core.mediaControl.disable();
533
+ this.$el.show();
534
+ if (this.container.advertisement.type !== 'scteroll') {
535
+ if (!Browser.isiOS) {
536
+ setTimeout(() => {
537
+ this.playback?.pause();
538
+ }, 0);
539
+ }
540
+ this._stopListening();
541
+ }
542
+ else {
543
+ assert(this.playback instanceof HTML5Video, 'playback is not an instance of HTML5Video');
544
+ if (!this.playback.isMuted()) {
545
+ ;
546
+ this.container.advertisement.isMuted = true;
547
+ this.playback.mute();
548
+ }
549
+ }
550
+ // TODO trigger event on the core object
551
+ // Player.player.trigger('advertisementIsPlaying', data);
552
+ try {
553
+ const spinnerPlugin = this.container?.getPlugin('spinner');
554
+ spinnerPlugin?.hide();
555
+ spinnerPlugin?.disable();
556
+ }
557
+ catch (error) {
558
+ // LogManager.exception(error);
559
+ reportError(error);
560
+ }
561
+ }
562
+ destroyRoll() {
563
+ if (this.vast) {
564
+ // @ts-ignore
565
+ this.vast.off();
566
+ this.vast.destroyRoll();
567
+ this.vast = null;
568
+ }
569
+ }
570
+ _playVideoContent(currentRoll, justPlay) {
571
+ // const currentRoll = type;
572
+ this.destroyRoll();
573
+ if (currentRoll === 'preroll') {
574
+ this.options.vastAds[currentRoll] = [];
575
+ }
576
+ this.currentState = '';
577
+ this.$el.hide();
578
+ if (!this.options.disableClickOnPause) {
579
+ this._clickToPausePlugin?.enable();
580
+ }
581
+ try {
582
+ const logoPlugin = this.container?.getPlugin('logo');
583
+ logoPlugin?.enable();
584
+ }
585
+ catch (error) {
586
+ // LogManager.exception(error);
587
+ reportError(error);
588
+ }
589
+ try {
590
+ const spinnerPlugin = this.container?.getPlugin('spinner');
591
+ spinnerPlugin?.enable();
592
+ spinnerPlugin?.hide();
593
+ }
594
+ catch (error) {
595
+ // LogManager.exception(error);
596
+ reportError(error);
597
+ }
598
+ if (this.intervalTimer !== null) {
599
+ clearInterval(this.intervalTimer);
600
+ this.intervalTimer = null;
601
+ }
602
+ // @ts-ignore
603
+ this.stopListening(this.playback, Events.PLAYBACK_PAUSE);
604
+ setTimeout(async () => {
605
+ if (currentRoll === 'scteroll') {
606
+ this.options.mute = this.core.options.mute;
607
+ this.core.mediaControl.setMuted(this.core.options.mute);
608
+ this.core.mediaControl.setInitialVolume();
609
+ }
610
+ // this.adTemplates = null;
611
+ this._posterBigPlayStyle = $('<style>div.play-wrapper { display:none; }</style>');
612
+ this._posterBigPlayStyle.appendTo(this.$el);
613
+ // TODO check that the core event is enough
614
+ // Player.player.trigger('advertisementWasFinished');
615
+ this.core.trigger('core:advertisement:finish');
616
+ assert(this.container, 'container is not defined');
617
+ this.container.trigger('container:advertisement:finish');
618
+ this.container.advertisement = { type: 'idle' };
619
+ this.container.enableMediaControl();
620
+ Log.debug('Advertisement', 'advertisement finished and start video');
621
+ const playbackOptions = this.core.options.playback || {};
622
+ playbackOptions.recycleVideo = Browser.isMobile;
623
+ if (this._clonePlaybackEvents || this._cloneContainerEvents) {
624
+ this._startListening();
625
+ }
626
+ if (currentRoll === 'preroll' || currentRoll === 'repeatableroll') {
627
+ if (currentRoll === 'repeatableroll') {
628
+ this.startTimeRepeatableRoll = 0;
629
+ }
630
+ if (!justPlay) {
631
+ if (this.core.containers) {
632
+ this.core.containers.forEach(function (container) {
633
+ container.destroy();
634
+ });
635
+ this.core.containers = [];
636
+ }
637
+ }
638
+ setTimeout(() => {
639
+ this.core.configure({
640
+ playback: playbackOptions,
641
+ sources: this.options.source,
642
+ autoPlay: true,
643
+ disableCanAutoPlay: true,
644
+ mute: this.core.options.mute,
645
+ });
646
+ this.core.activeContainer.mediaControlDisabled = false;
647
+ }, 0);
648
+ // TODO figure out where it should go
649
+ // if (currentRoll === 'postroll') {
650
+ // this.playback.stop();
651
+ // }
652
+ }
653
+ if (currentRoll === 'pauseroll' || currentRoll === 'middleroll') {
654
+ if (Browser.isiOS && this._currentPosition > 0) {
655
+ this.listenToOnce(this.playback, Events.PLAYBACK_PLAY, () => {
656
+ this.playback?.seek(this._currentPosition);
657
+ this._currentPosition = 0;
658
+ });
659
+ }
660
+ await this.playback?.play();
661
+ this.options.mute = this.core.options.mute;
662
+ this.core.mediaControl.setMuted(this.core.options.mute);
663
+ this.core.mediaControl.setInitialVolume();
664
+ }
665
+ }, 0);
666
+ }
667
+ render() {
668
+ this.$skipAd = $("<div class='skip-ad-button control-need-disable'></div>");
669
+ this.$muteIcon = $("<div class='mute-ad-icon control-need-disable'></div>");
670
+ this.$areaClick = $("<div class='area-ad-click enable'></div>");
671
+ this.$muteIcon.append(volumeIcon);
672
+ this.$muteIcon.append(volumeMuteIcon);
673
+ this.$el.append(this.$areaClick);
674
+ this.$el.append(this.$skipAd);
675
+ this.$el.append(this.$muteIcon);
676
+ this.$muteIcon.hide();
677
+ this.$skipAd.hide();
678
+ this.$areaClick.hide();
679
+ this._$adContainer = $('<div />')
680
+ .addClass('preroll-container')
681
+ .attr('data-preroll', '');
682
+ this.$el.append(this._$adContainer);
683
+ this._adContainer = this._$adContainer[0];
684
+ return this;
685
+ }
686
+ }