@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.
- package/assets/audio-selector/style.scss +156 -0
- package/assets/audio-selector/track-selector.ejs +12 -0
- package/assets/big-mute-button/big-mute-button.ejs +3 -0
- package/assets/big-mute-button/big-mute-button.scss +57 -0
- package/assets/bottom-gear/bottomgear.ejs +12 -0
- package/assets/bottom-gear/gear-sub-menu.scss +95 -0
- package/assets/bottom-gear/gear.scss +79 -0
- package/assets/clappr-nerd-stats/button.ejs +4 -0
- package/assets/clappr-nerd-stats/clappr-nerd-stats.ejs +212 -0
- package/assets/clappr-nerd-stats/clappr-nerd-stats.scss +488 -0
- package/assets/clappr-nerd-stats/options-list.ejs +9 -0
- package/assets/clappr-nerd-stats/settings.ejs +12 -0
- package/assets/clappr-nerd-stats/speedtest/speedtest.worker.js +775 -0
- package/assets/clips/clips.scss +3 -0
- package/assets/context-menu/context_menu.ejs +8 -0
- package/assets/context-menu/context_menu.scss +31 -0
- package/assets/dvr-controls/dvr_controls.scss +136 -0
- package/assets/dvr-controls/index.ejs +2 -0
- package/assets/error-screen/error_screen.ejs +13 -0
- package/assets/error-screen/error_screen.scss +40 -0
- package/assets/icons/new/arrow-left.svg +5 -0
- package/assets/icons/new/arrow-right.svg +5 -0
- package/assets/icons/new/check.svg +5 -0
- package/assets/icons/new/close.svg +12 -0
- package/assets/icons/new/full.svg +8 -0
- package/assets/icons/new/fullscreen-off.svg +14 -0
- package/assets/icons/new/fullscreen-on.svg +14 -0
- package/assets/icons/new/gear-hd.svg +16 -0
- package/assets/icons/new/gear.svg +12 -0
- package/assets/icons/new/hd.svg +8 -0
- package/assets/icons/new/pause.svg +5 -0
- package/assets/icons/new/pip.svg +5 -0
- package/assets/icons/new/play.svg +10 -0
- package/assets/icons/new/replayleft.svg +5 -0
- package/assets/icons/new/replayright.svg +5 -0
- package/assets/icons/new/speed.svg +5 -0
- package/assets/icons/new/stats.svg +3 -0
- package/assets/icons/new/stop.svg +3 -0
- package/assets/icons/new/subtitles-off.svg +5 -0
- package/assets/icons/new/subtitles-on.svg +6 -0
- package/assets/icons/new/volume-max.svg +5 -0
- package/assets/icons/new/volume-min.svg +5 -0
- package/assets/icons/new/volume-off.svg +5 -0
- package/assets/icons/old/cardboard.svg +4 -0
- package/assets/icons/old/close-share.svg +13 -0
- package/assets/icons/old/close.svg +13 -0
- package/assets/icons/old/fb.svg +13 -0
- package/assets/icons/old/fullscreen.svg +12 -0
- package/assets/icons/old/language.svg +1 -0
- package/assets/icons/old/pause.svg +12 -0
- package/assets/icons/old/play.svg +12 -0
- package/assets/icons/old/quality-arrow.svg +13 -0
- package/assets/icons/old/reload.svg +4 -0
- package/assets/icons/old/share.svg +13 -0
- package/assets/icons/old/sound-off.svg +15 -0
- package/assets/icons/old/sound-on.svg +15 -0
- package/assets/icons/old/streams.svg +3 -0
- package/assets/icons/old/twitter.svg +13 -0
- package/assets/icons/old/wn.svg +15 -0
- package/assets/icons/standard/01-play.svg +3 -0
- package/assets/icons/standard/02-pause.svg +3 -0
- package/assets/icons/standard/03-stop.svg +3 -0
- package/assets/icons/standard/04-volume.svg +3 -0
- package/assets/icons/standard/05-mute.svg +3 -0
- package/assets/icons/standard/06-expand.svg +3 -0
- package/assets/icons/standard/07-shrink.svg +3 -0
- package/assets/icons/standard/08-hd.svg +3 -0
- package/assets/icons/standard/09-cc.svg +8 -0
- package/assets/icons/standard/10-reload.svg +4 -0
- package/assets/level-selector/button.ejs +8 -0
- package/assets/level-selector/list.ejs +22 -0
- package/assets/level-selector/style.scss +4 -0
- package/assets/logo/styles/logo.scss +10 -0
- package/assets/logo/templates/logo.ejs +3 -0
- package/assets/media-control/closed-hand.cur +0 -0
- package/assets/media-control/container.scss +57 -0
- package/assets/media-control/media-control.ejs +133 -0
- package/assets/media-control/media-control.scss +390 -0
- package/assets/media-control/plugins.scss +94 -0
- package/assets/media-control/width270.scss +50 -0
- package/assets/media-control/width370.scss +263 -0
- package/assets/multi-camera/multicamera.ejs +29 -0
- package/assets/multi-camera/style.scss +176 -0
- package/assets/picture-in-picture/button.ejs +3 -0
- package/assets/picture-in-picture/button.scss +11 -0
- package/assets/playback-rate/button.ejs +6 -0
- package/assets/playback-rate/list.ejs +14 -0
- package/assets/playback-rate/playback-rate-selector.ejs +9 -0
- package/assets/poster/poster.ejs +1 -0
- package/assets/poster/poster.scss +32 -0
- package/assets/seek-time/seek-time.html +2 -0
- package/assets/seek-time/seek-time.scss +38 -0
- package/assets/share/share.ejs +37 -0
- package/assets/share/style.scss +104 -0
- package/assets/skip-time/skip-time.ejs +8 -0
- package/assets/skip-time/style.scss +24 -0
- package/assets/spinner-three-bounce/spinner.ejs +3 -0
- package/assets/spinner-three-bounce/spinner.scss +44 -0
- package/assets/style/main.scss +50 -0
- package/assets/style/theme.scss +42 -0
- package/assets/style/variables.scss +7 -0
- package/assets/subtitles/combobox copy.ejs +16 -0
- package/assets/subtitles/combobox.ejs +16 -0
- package/assets/subtitles/string.ejs +3 -0
- package/assets/subtitles/style.scss +99 -0
- package/assets/thumbnails/scrub-thumbnails.ejs +10 -0
- package/assets/thumbnails/style.scss +75 -0
- package/assets/vast-ads/style.scss +112 -0
- package/assets/video360/button.ejs +1 -0
- package/assets/video360/style.scss +8 -0
- package/build/vite-raw-plugin.js +18 -0
- package/dist/index.js +1 -1
- package/dist/plugins/index.css +2164 -0
- package/dist/plugins/index.js/index.plugins.js +40837 -0
- package/dist/plugins/index.plugins.js +40837 -0
- package/lib/index.core.d.ts +15 -0
- package/lib/index.core.d.ts.map +1 -0
- package/lib/index.core.js +14 -0
- package/lib/index.d.ts +2 -14
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -14
- package/lib/index.plugins.d.ts +38 -0
- package/lib/index.plugins.d.ts.map +1 -0
- package/lib/index.plugins.js +40 -0
- package/lib/plugins/audio-selector/AudioSelector.d.ts +3 -3
- package/lib/plugins/audio-selector/AudioSelector.d.ts.map +1 -1
- package/lib/plugins/audio-selector/AudioSelector.js +6 -12
- package/lib/plugins/big-mute-button/BigMuteButton.d.ts +2 -2
- package/lib/plugins/big-mute-button/BigMuteButton.d.ts.map +1 -1
- package/lib/plugins/big-mute-button/BigMuteButton.js +7 -12
- package/lib/plugins/bottom-gear/BottomGear.d.ts +4 -3
- package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +11 -16
- package/lib/plugins/build.d.ts +2 -0
- package/lib/plugins/build.d.ts.map +1 -0
- package/lib/plugins/build.js +1 -0
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts +44 -0
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.d.ts.map +1 -0
- package/lib/plugins/clappr-nerd-stats/ClapprNerdStats.js +294 -0
- package/lib/plugins/clappr-nerd-stats/formatter.d.ts +8 -0
- package/lib/plugins/clappr-nerd-stats/formatter.d.ts.map +1 -0
- package/lib/plugins/clappr-nerd-stats/formatter.js +91 -0
- package/lib/plugins/clappr-nerd-stats/speedtest/Speedtest.d.ts +54 -0
- package/lib/plugins/clappr-nerd-stats/speedtest/Speedtest.d.ts.map +1 -0
- package/lib/plugins/clappr-nerd-stats/speedtest/Speedtest.js +335 -0
- package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts +9 -0
- package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts.map +1 -0
- package/lib/plugins/clappr-nerd-stats/speedtest/index.js +154 -0
- package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts +6 -0
- package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts.map +1 -0
- package/lib/plugins/clappr-nerd-stats/speedtest/types.js +1 -0
- package/lib/plugins/clappr-nerd-stats/types.d.ts +4 -0
- package/lib/plugins/clappr-nerd-stats/types.d.ts.map +1 -0
- package/lib/plugins/clappr-nerd-stats/types.js +1 -0
- package/lib/plugins/clappr-stats/ClapprStats.d.ts +56 -0
- package/lib/plugins/clappr-stats/ClapprStats.d.ts.map +1 -0
- package/lib/plugins/clappr-stats/ClapprStats.js +332 -0
- package/lib/plugins/clappr-stats/types.d.ts +50 -0
- package/lib/plugins/clappr-stats/types.d.ts.map +1 -0
- package/lib/plugins/clappr-stats/types.js +5 -0
- package/lib/plugins/clappr-stats/utils.d.ts +3 -0
- package/lib/plugins/clappr-stats/utils.d.ts.map +1 -0
- package/lib/plugins/clappr-stats/utils.js +40 -0
- package/lib/plugins/click-to-pause/ClickToPause.d.ts +2 -2
- package/lib/plugins/click-to-pause/ClickToPause.d.ts.map +1 -1
- package/lib/plugins/click-to-pause/ClickToPause.js +4 -6
- package/lib/plugins/clips/Clips.d.ts +23 -0
- package/lib/plugins/clips/Clips.d.ts.map +1 -0
- package/lib/plugins/clips/Clips.js +109 -0
- package/lib/plugins/context-menu/ContextMenu.d.ts +36 -0
- package/lib/plugins/context-menu/ContextMenu.d.ts.map +1 -0
- package/lib/plugins/context-menu/ContextMenu.js +102 -0
- package/lib/plugins/disable-controls/DisableControls.d.ts +1 -1
- package/lib/plugins/disable-controls/DisableControls.d.ts.map +1 -1
- package/lib/plugins/disable-controls/DisableControls.js +3 -5
- package/lib/plugins/dvr-controls/DVRControls.d.ts +4 -4
- package/lib/plugins/dvr-controls/DVRControls.d.ts.map +1 -1
- package/lib/plugins/dvr-controls/DVRControls.js +5 -4
- package/lib/plugins/error-screen/ErrorScreen.d.ts +44 -0
- package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -0
- package/lib/plugins/error-screen/ErrorScreen.js +179 -0
- package/lib/plugins/favicon/Favicon.d.ts +24 -0
- package/lib/plugins/favicon/Favicon.d.ts.map +1 -0
- package/lib/plugins/favicon/Favicon.js +106 -0
- package/lib/plugins/google-analytics/GoogleAnalytics.d.ts +30 -0
- package/lib/plugins/google-analytics/GoogleAnalytics.d.ts.map +1 -0
- package/lib/plugins/google-analytics/GoogleAnalytics.js +114 -0
- package/lib/plugins/index.d.ts +38 -0
- package/lib/plugins/index.d.ts.map +1 -0
- package/lib/plugins/index.js +40 -0
- package/lib/plugins/kibo/index.d.ts +23 -0
- package/lib/plugins/kibo/index.d.ts.map +1 -0
- package/lib/plugins/kibo/index.js +199 -0
- package/lib/plugins/level-selector/LevelSelector.d.ts +48 -17
- package/lib/plugins/level-selector/LevelSelector.d.ts.map +1 -1
- package/lib/plugins/level-selector/LevelSelector.js +169 -155
- package/lib/plugins/logo/Logo.d.ts +29 -0
- package/lib/plugins/logo/Logo.d.ts.map +1 -0
- package/lib/plugins/logo/Logo.js +181 -0
- package/lib/plugins/logo/utils/index.d.ts +22 -0
- package/lib/plugins/logo/utils/index.d.ts.map +1 -0
- package/lib/plugins/logo/utils/index.js +32 -0
- package/lib/plugins/media-control/MediaControl.d.ts +20 -25
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +136 -106
- package/lib/plugins/multi-camera/MultiCamera.d.ts +59 -0
- package/lib/plugins/multi-camera/MultiCamera.d.ts.map +1 -0
- package/lib/plugins/multi-camera/MultiCamera.js +353 -0
- package/lib/plugins/picture-in-picture/PictureInPicture.d.ts +20 -0
- package/lib/plugins/picture-in-picture/PictureInPicture.d.ts.map +1 -0
- package/lib/plugins/picture-in-picture/PictureInPicture.js +68 -0
- package/lib/plugins/playback-rate/PlaybackRate.d.ts +42 -0
- package/lib/plugins/playback-rate/PlaybackRate.d.ts.map +1 -0
- package/lib/plugins/playback-rate/PlaybackRate.js +205 -0
- package/lib/plugins/poster/Poster.d.ts +18 -17
- package/lib/plugins/poster/Poster.d.ts.map +1 -1
- package/lib/plugins/poster/Poster.js +83 -37
- package/lib/plugins/seek-time/SeekTime.d.ts +38 -0
- package/lib/plugins/seek-time/SeekTime.d.ts.map +1 -0
- package/lib/plugins/seek-time/SeekTime.js +153 -0
- package/lib/plugins/share/Share.d.ts +38 -0
- package/lib/plugins/share/Share.d.ts.map +1 -0
- package/lib/plugins/share/Share.js +122 -0
- package/lib/plugins/skip-time/SkipTime.d.ts +28 -0
- package/lib/plugins/skip-time/SkipTime.d.ts.map +1 -0
- package/lib/plugins/skip-time/SkipTime.js +86 -0
- package/lib/plugins/source-controller/SourceController.d.ts +41 -0
- package/lib/plugins/source-controller/SourceController.d.ts.map +1 -0
- package/lib/plugins/source-controller/SourceController.js +199 -0
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts +26 -0
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -0
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +117 -0
- package/lib/plugins/statistics/Statistics.d.ts +52 -0
- package/lib/plugins/statistics/Statistics.d.ts.map +1 -0
- package/lib/plugins/statistics/Statistics.js +130 -0
- package/lib/plugins/subtitles/Subtitles.d.ts +61 -0
- package/lib/plugins/subtitles/Subtitles.d.ts.map +1 -0
- package/lib/plugins/subtitles/Subtitles.js +354 -0
- package/lib/plugins/thumbnails/Thumbnails.d.ts +47 -0
- package/lib/plugins/thumbnails/Thumbnails.d.ts.map +1 -0
- package/lib/plugins/thumbnails/Thumbnails.js +414 -0
- package/lib/plugins/types.d.ts +8 -0
- package/lib/plugins/types.d.ts.map +1 -0
- package/lib/plugins/types.js +1 -0
- package/lib/plugins/utils.d.ts +5 -0
- package/lib/plugins/utils.d.ts.map +1 -0
- package/lib/plugins/utils.js +68 -0
- package/lib/plugins/vast-ads/VastAds.d.ts +72 -0
- package/lib/plugins/vast-ads/VastAds.d.ts.map +1 -0
- package/lib/plugins/vast-ads/VastAds.js +686 -0
- package/lib/plugins/vast-ads/loaderxml.d.ts +32 -0
- package/lib/plugins/vast-ads/loaderxml.d.ts.map +1 -0
- package/lib/plugins/vast-ads/loaderxml.js +226 -0
- package/lib/plugins/vast-ads/roll.d.ts +60 -0
- package/lib/plugins/vast-ads/roll.d.ts.map +1 -0
- package/lib/plugins/vast-ads/roll.js +415 -0
- package/lib/plugins/vast-ads/rollmanager.d.ts +62 -0
- package/lib/plugins/vast-ads/rollmanager.d.ts.map +1 -0
- package/lib/plugins/vast-ads/rollmanager.js +347 -0
- package/lib/plugins/vast-ads/sctemanager.d.ts +18 -0
- package/lib/plugins/vast-ads/sctemanager.d.ts.map +1 -0
- package/lib/plugins/vast-ads/sctemanager.js +116 -0
- package/lib/plugins/vast-ads/types.d.ts +12 -0
- package/lib/plugins/vast-ads/types.d.ts.map +1 -0
- package/lib/plugins/vast-ads/types.js +1 -0
- package/lib/plugins/vast-ads/urlhandler.d.ts +4 -0
- package/lib/plugins/vast-ads/urlhandler.d.ts.map +1 -0
- package/lib/plugins/vast-ads/urlhandler.js +30 -0
- package/lib/plugins/vast-ads/xmlhttprequest.d.ts +6 -0
- package/lib/plugins/vast-ads/xmlhttprequest.d.ts.map +1 -0
- package/lib/plugins/vast-ads/xmlhttprequest.js +39 -0
- package/lib/plugins/vast-ads/xmlmerge.d.ts +12 -0
- package/lib/plugins/vast-ads/xmlmerge.d.ts.map +1 -0
- package/lib/plugins/vast-ads/xmlmerge.js +82 -0
- package/lib/plugins/volume-fade/VolumeFade.d.ts +21 -0
- package/lib/plugins/volume-fade/VolumeFade.d.ts.map +1 -0
- package/lib/plugins/volume-fade/VolumeFade.js +90 -0
- package/package.json +10 -2
- package/rollup.config.js +32 -2
- package/src/index.core.ts +15 -0
- package/src/index.plugins.ts +42 -0
- package/src/index.ts +2 -15
- package/src/plugins/audio-selector/AudioSelector.ts +370 -0
- package/src/plugins/big-mute-button/BigMuteButton.ts +187 -0
- package/src/plugins/bottom-gear/BottomGear.ts +122 -0
- package/src/plugins/build.ts +1 -0
- package/src/plugins/clappr-nerd-stats/ClapprNerdStats.ts +369 -0
- package/src/plugins/clappr-nerd-stats/formatter.ts +109 -0
- package/src/plugins/clappr-nerd-stats/speedtest/Speedtest.ts +414 -0
- package/src/plugins/clappr-nerd-stats/speedtest/index.ts +183 -0
- package/src/plugins/clappr-nerd-stats/speedtest/types.ts +5 -0
- package/src/plugins/clappr-nerd-stats/types.ts +3 -0
- package/src/plugins/clappr-stats/ClapprStats.ts +441 -0
- package/src/plugins/clappr-stats/types.ts +52 -0
- package/src/plugins/clappr-stats/utils.ts +42 -0
- package/src/plugins/click-to-pause/ClickToPause.ts +93 -0
- package/src/plugins/clips/Clips.ts +152 -0
- package/src/plugins/context-menu/ContextMenu.ts +134 -0
- package/src/plugins/disable-controls/DisableControls.ts +81 -0
- package/src/plugins/dvr-controls/DvrControls.ts +131 -0
- package/src/plugins/error-screen/ErrorScreen.ts +241 -0
- package/src/plugins/favicon/Favicon.ts +137 -0
- package/src/plugins/ga-events/GaEvents.js +395 -0
- package/src/plugins/ga-events/ga-tracking.js +46 -0
- package/src/plugins/google-analytics/GoogleAnalytics.ts +147 -0
- package/src/plugins/index.ts +42 -0
- package/src/plugins/kibo/index.ts +244 -0
- package/src/plugins/level-selector/LevelSelector.ts +400 -0
- package/src/plugins/level-selector/__tests__/LevelSelector.test.ts +72 -0
- package/src/plugins/level-selector/__tests__/__snapshots__/LevelSelector.test.ts.snap +11 -0
- package/src/plugins/logo/Logo.ts +233 -0
- package/src/plugins/logo/utils/index.ts +46 -0
- package/src/plugins/media-control/MediaControl.ts +1383 -0
- package/src/plugins/multi-camera/MultiCamera copy.xts +414 -0
- package/src/plugins/multi-camera/MultiCamera.ts +426 -0
- package/src/plugins/picture-in-picture/PictureInPicture.ts +87 -0
- package/src/plugins/playback-rate/PlaybackRate.ts +269 -0
- package/src/plugins/poster/Poster.ts +298 -0
- package/src/plugins/seek-time/SeekTime.ts +191 -0
- package/src/plugins/share/Share.ts +148 -0
- package/src/plugins/skip-time/SkipTime.ts +109 -0
- package/src/plugins/source-controller/SourceController.ts +239 -0
- package/src/plugins/source-controller/__tests__/SourceController.test.ts +230 -0
- package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +135 -0
- package/src/plugins/statistics/Statistics copy.xts +296 -0
- package/src/plugins/statistics/Statistics.ts +207 -0
- package/src/plugins/subtitles/Subtitles.ts +505 -0
- package/src/plugins/thumbnails/Thumbnails.ts +530 -0
- package/src/plugins/types.ts +7 -0
- package/src/plugins/typings/globals.d.ts +10 -0
- package/src/plugins/typings/parse-srt.d.ts +14 -0
- package/src/plugins/typings/workers.d.ts +3 -0
- package/src/plugins/utils.ts +77 -0
- package/src/plugins/vast-ads/VastAds.ts +915 -0
- package/src/plugins/vast-ads/loaderxml.ts +260 -0
- package/src/plugins/vast-ads/roll.ts +492 -0
- package/src/plugins/vast-ads/rollmanager.ts +403 -0
- package/src/plugins/vast-ads/sctemanager.ts +134 -0
- package/src/plugins/vast-ads/types.ts +14 -0
- package/src/plugins/vast-ads/urlhandler.ts +37 -0
- package/src/plugins/vast-ads/xmlhttprequest.ts +44 -0
- package/src/plugins/vast-ads/xmlmerge.ts +96 -0
- package/src/plugins/video360/VRControls.js +104 -0
- package/src/plugins/video360/VREffect.js +422 -0
- package/src/plugins/video360/Video360.js +979 -0
- package/src/plugins/video360/orbit-oriention-controls.js +1002 -0
- package/src/plugins/video360/utils.js +49 -0
- package/src/plugins/volume-fade/VolumeFade.ts +109 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { $, Browser, Events, HTML5Video, Log, Utils } from '@clappr/core';
|
|
2
|
+
import { reportError } from '@gcorevideo/utils';
|
|
3
|
+
import assert from 'assert';
|
|
4
|
+
import LoaderXML from './loaderxml.js';
|
|
5
|
+
import Roll from './roll.js';
|
|
6
|
+
export default class RollManager extends Events {
|
|
7
|
+
core;
|
|
8
|
+
options;
|
|
9
|
+
$skipAd;
|
|
10
|
+
$muteIcon;
|
|
11
|
+
$areaClick;
|
|
12
|
+
_adContainer;
|
|
13
|
+
type;
|
|
14
|
+
countRoll;
|
|
15
|
+
volume;
|
|
16
|
+
prevVolume;
|
|
17
|
+
_allURLRequest = false;
|
|
18
|
+
_container;
|
|
19
|
+
container;
|
|
20
|
+
_options;
|
|
21
|
+
vastAdsOptions;
|
|
22
|
+
_playback;
|
|
23
|
+
_contentElement;
|
|
24
|
+
_posterPlugin;
|
|
25
|
+
_clickToPausePlugin;
|
|
26
|
+
adTemplates = null;
|
|
27
|
+
// private _adDisplayContainer: HTMLElement | null = null;
|
|
28
|
+
extension = null;
|
|
29
|
+
firstRemaininTime = 0;
|
|
30
|
+
_imaContainer = null;
|
|
31
|
+
isPlaying = false;
|
|
32
|
+
loadXML = null;
|
|
33
|
+
_pr;
|
|
34
|
+
roll = null;
|
|
35
|
+
constructor(core, options, $skipAd, $muteIcon, $areaClick, _adContainer, type, countRoll, volume, prevVolume) {
|
|
36
|
+
super();
|
|
37
|
+
this.core = core;
|
|
38
|
+
this.options = options;
|
|
39
|
+
this.$skipAd = $skipAd;
|
|
40
|
+
this.$muteIcon = $muteIcon;
|
|
41
|
+
this.$areaClick = $areaClick;
|
|
42
|
+
this._adContainer = _adContainer;
|
|
43
|
+
this.type = type;
|
|
44
|
+
this.countRoll = countRoll;
|
|
45
|
+
this.volume = volume;
|
|
46
|
+
this.prevVolume = prevVolume;
|
|
47
|
+
this._options = options;
|
|
48
|
+
this.vastAdsOptions = this._options.vastAds;
|
|
49
|
+
this.container = this.core.activeContainer;
|
|
50
|
+
this._container = this.container;
|
|
51
|
+
// this.countRoll = countRoll || 0;
|
|
52
|
+
this.$skipAd = $skipAd;
|
|
53
|
+
this.type = type;
|
|
54
|
+
this.$muteIcon = $muteIcon;
|
|
55
|
+
this.$areaClick = $areaClick;
|
|
56
|
+
this._playback = this.core.activePlayback;
|
|
57
|
+
this._contentElement = this._playback.el;
|
|
58
|
+
this._posterPlugin = this._container.getPlugin('poster_custom');
|
|
59
|
+
this._clickToPausePlugin = this._container.getPlugin('click_to_pause_custom');
|
|
60
|
+
this._adContainer = _adContainer;
|
|
61
|
+
this._events = {};
|
|
62
|
+
this._pr = Math.floor(Math.random() * 1000000);
|
|
63
|
+
}
|
|
64
|
+
initializeRoll({ xml, url, extension }) {
|
|
65
|
+
try {
|
|
66
|
+
this.roll = new Roll({
|
|
67
|
+
core: this.core,
|
|
68
|
+
$skipAd: this.$skipAd,
|
|
69
|
+
$muteIcon: this.$muteIcon,
|
|
70
|
+
$areaClick: this.$areaClick,
|
|
71
|
+
mute: !!this.options.mute,
|
|
72
|
+
volume: this.volume,
|
|
73
|
+
prevVolume: this.prevVolume
|
|
74
|
+
});
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
this.roll.on('volume', this.changeVolume.bind(this));
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
this.roll.on('advertisement_started', this.onAdStarted.bind(this));
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
this.roll.on('advertisement_played', this.onAdPlayed.bind(this));
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
this.roll.on('continue_ad', this._cleverContinueAd.bind(this));
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
this.roll.on('advertisement_finish', this._playVideoContent.bind(this));
|
|
85
|
+
this.roll._requestAd({ xml, url, extension });
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
// LogManager.exception(error);
|
|
89
|
+
reportError(error);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
playerResize(_) {
|
|
93
|
+
if (this.roll) {
|
|
94
|
+
this.roll.playerResize();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
onAdStarted(_) {
|
|
98
|
+
this.removeContainer();
|
|
99
|
+
}
|
|
100
|
+
onAdPlayed() {
|
|
101
|
+
this.isPlaying = true;
|
|
102
|
+
}
|
|
103
|
+
removeContainer() {
|
|
104
|
+
this.trigger('advertisement_started');
|
|
105
|
+
}
|
|
106
|
+
changeVolume(obj) {
|
|
107
|
+
this.trigger('volume', obj);
|
|
108
|
+
}
|
|
109
|
+
// private _createAdDisplayContainer() {
|
|
110
|
+
// this._createImaContainer();
|
|
111
|
+
// assert('google' in window, 'google not found');
|
|
112
|
+
// this._adDisplayContainer = new (window.google as any).ima.AdDisplayContainer(this._imaContainer, this._contentElement);
|
|
113
|
+
// }
|
|
114
|
+
_createImaContainer() {
|
|
115
|
+
this._destroyImaContainer();
|
|
116
|
+
// IMA does not clean ad container when finished
|
|
117
|
+
// For the sake of simplicity, wrap into a <div> element
|
|
118
|
+
if (this._adContainer) {
|
|
119
|
+
this._imaContainer = document.createElement('div');
|
|
120
|
+
this._adContainer.appendChild(this._imaContainer);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
_destroyImaContainer() {
|
|
124
|
+
if (this._imaContainer && this._adContainer) {
|
|
125
|
+
this._adContainer.removeChild(this._imaContainer);
|
|
126
|
+
this._imaContainer = null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async setupRoll() {
|
|
130
|
+
// TODO: check if this is correct
|
|
131
|
+
const dataAd = this.vastAdsOptions[this.type] || { data: [] };
|
|
132
|
+
const { oneByOne = false } = dataAd;
|
|
133
|
+
let rollList = dataAd.data;
|
|
134
|
+
if (this.type === 'middleroll') {
|
|
135
|
+
const currentStartTime = dataAd.data[this.countRoll].startTimePercent;
|
|
136
|
+
rollList = dataAd.data.filter((el) => {
|
|
137
|
+
if (el.startTimePercent === currentStartTime) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (this.type === 'repeatableroll') {
|
|
143
|
+
const currentStartTime = dataAd.data[this.countRoll].startTime;
|
|
144
|
+
rollList = dataAd.data.filter((el) => {
|
|
145
|
+
if (el.startTime === currentStartTime) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (this.type === 'middleroll' || this.type === 'repeatableroll') {
|
|
151
|
+
this.trigger('change_counter', { type: this.type, value: this.countRoll + rollList.length });
|
|
152
|
+
}
|
|
153
|
+
await this.startAd(this.type, { data: rollList, oneByOne });
|
|
154
|
+
}
|
|
155
|
+
async startAd(type, roll) {
|
|
156
|
+
// TODO
|
|
157
|
+
// Player.player.trigger('advertisementWasStarted');
|
|
158
|
+
this.core.trigger('core:advertisement:start');
|
|
159
|
+
this.container.trigger('container:advertisement:start');
|
|
160
|
+
this.container.advertisement = { type: type };
|
|
161
|
+
if (type !== 'middleroll' && type !== 'repeatableroll') {
|
|
162
|
+
console.warn('disableControls');
|
|
163
|
+
setTimeout(() => this._disableControls(), 0);
|
|
164
|
+
}
|
|
165
|
+
if (!this.adTemplates && roll) {
|
|
166
|
+
this.adTemplates = this.parseAdUrl(roll.data);
|
|
167
|
+
if (!this.adTemplates) {
|
|
168
|
+
this.trigger('disable_plugin', { type: this.type });
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (type === 'preroll') {
|
|
173
|
+
if (Browser.isMobile) {
|
|
174
|
+
this._playback.consent(() => { });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
//чтобы реклама шла одна за другой
|
|
178
|
+
this._allURLRequest = !!roll.oneByOne;
|
|
179
|
+
try {
|
|
180
|
+
const customPosterPlugin = this.container.getPlugin('poster_custom');
|
|
181
|
+
customPosterPlugin.hidePlayButton();
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
// LogManager.exception(error);
|
|
185
|
+
reportError(error);
|
|
186
|
+
}
|
|
187
|
+
if (!this.adTemplates?.length) {
|
|
188
|
+
this.trigger('advertisement_dont_play', { type: this.type });
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
Log.debug('Advertisement', 'advertisement will start');
|
|
192
|
+
try {
|
|
193
|
+
const adTemplate = this.adTemplates.shift();
|
|
194
|
+
// @ts-ignore
|
|
195
|
+
await this.loadAd(adTemplate.url);
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
// LogManager.exception(error);
|
|
199
|
+
reportError(error);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
_disableControls() {
|
|
203
|
+
this.container.disableMediaControl();
|
|
204
|
+
this._clickToPausePlugin?.disable();
|
|
205
|
+
// @ts-ignore
|
|
206
|
+
this._posterPlugin?.$playWrapper.hide();
|
|
207
|
+
}
|
|
208
|
+
parseAdUrl(arr) {
|
|
209
|
+
if (!Array.isArray(arr)) {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
return arr.filter((el) => el.url);
|
|
213
|
+
}
|
|
214
|
+
paramsUrl(url) {
|
|
215
|
+
try {
|
|
216
|
+
url = url.replace(/\{width\}/g, this.container.$el.width());
|
|
217
|
+
url = url.replace(/\{height\}/g, this.container.$el.height());
|
|
218
|
+
url = url.replace(/\{pr\}/g, String(this._pr));
|
|
219
|
+
url = url.replace(/\{random\}/g, String(Math.floor(Math.random() * 1000000)));
|
|
220
|
+
url = url.replace(/\{session_id\}/g, Utils.uniqueId(''));
|
|
221
|
+
url = url.replace(/\{start_delay\}/g, '0');
|
|
222
|
+
if (this.options.referer) {
|
|
223
|
+
url = url.replace(new RegExp(/\{referer\}/g, 'g'), String(this.options.referer ?? ''));
|
|
224
|
+
}
|
|
225
|
+
let playback = 1;
|
|
226
|
+
if (this.options.autoPlay && this.options.mute) {
|
|
227
|
+
playback = 2;
|
|
228
|
+
}
|
|
229
|
+
if (!this.options.autoPlay) {
|
|
230
|
+
playback = 3;
|
|
231
|
+
}
|
|
232
|
+
url = url.replace(/\{playback\}/g, String(playback));
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
// LogManager.exception(error);
|
|
236
|
+
reportError(error);
|
|
237
|
+
}
|
|
238
|
+
return url;
|
|
239
|
+
}
|
|
240
|
+
async loadAd(url) {
|
|
241
|
+
if (!url) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
try {
|
|
245
|
+
if (!['middleroll', 'repeatableroll'].includes(this.container.advertisement.type)) {
|
|
246
|
+
const spinnerPlugin = this.container.getPlugin('spinner');
|
|
247
|
+
spinnerPlugin?.show();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
// LogManager.exception(error);
|
|
252
|
+
reportError(error);
|
|
253
|
+
}
|
|
254
|
+
url = this.paramsUrl(url);
|
|
255
|
+
Roll._adContainer = this._adContainer;
|
|
256
|
+
Roll._contentElement = this._contentElement;
|
|
257
|
+
Roll.createAdDisplayContainer();
|
|
258
|
+
this.loadXML = new LoaderXML(url);
|
|
259
|
+
let data;
|
|
260
|
+
try {
|
|
261
|
+
data = await this.loadXML.startLoad();
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
// LogManager.exception(error);
|
|
265
|
+
reportError(error);
|
|
266
|
+
if (this.adTemplates && this.adTemplates.length > 0) {
|
|
267
|
+
const adTemplate = this.adTemplates.shift();
|
|
268
|
+
// @ts-ignore
|
|
269
|
+
await this.loadAd(adTemplate.url);
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
const spinnerPlugin = this.container.getPlugin('spinner');
|
|
273
|
+
spinnerPlugin?.hide();
|
|
274
|
+
this.trigger('advertisement_dont_play', { type: this.type });
|
|
275
|
+
}
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
this.firstRemaininTime = 0;
|
|
280
|
+
this.$muteIcon.hide();
|
|
281
|
+
this.$skipAd.hide();
|
|
282
|
+
// this.volume = this._playback.volume;
|
|
283
|
+
assert(this._playback instanceof HTML5Video);
|
|
284
|
+
this.volume = this._playback.el.volume;
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
// LogManager.exception(error);
|
|
288
|
+
reportError(error);
|
|
289
|
+
}
|
|
290
|
+
this.extension = data;
|
|
291
|
+
this.initializeRoll({ xml: data.config, url: String(data.url || url), extension: data });
|
|
292
|
+
}
|
|
293
|
+
_onAdError(adErrorEvent) {
|
|
294
|
+
try {
|
|
295
|
+
const googleError = adErrorEvent.getError();
|
|
296
|
+
const error = new Error(googleError.getMessage() + ' ' + googleError.getErrorCode());
|
|
297
|
+
error.name = googleError.getType();
|
|
298
|
+
// LogManager.exception(error);
|
|
299
|
+
reportError(error);
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
// LogManager.exception(error);
|
|
303
|
+
reportError(error);
|
|
304
|
+
}
|
|
305
|
+
Log.debug('Advertisement', 'advertisement error');
|
|
306
|
+
this._cleverContinueAd(true);
|
|
307
|
+
}
|
|
308
|
+
_imaEvent(eventName, e) {
|
|
309
|
+
$.isFunction(this._events[eventName]) && this._events[eventName](e);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* определяет, что дальше будет запускаться реклама или контент
|
|
313
|
+
*
|
|
314
|
+
*/
|
|
315
|
+
async _cleverContinueAd(data) {
|
|
316
|
+
this.destroyRoll();
|
|
317
|
+
const error = data.error;
|
|
318
|
+
if ((this._allURLRequest || error) && this.adTemplates && this.adTemplates.length > 0) {
|
|
319
|
+
const adTemplate = this.adTemplates.shift();
|
|
320
|
+
// @ts-ignore
|
|
321
|
+
await this.loadAd(adTemplate.url);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
this._playVideoContent();
|
|
325
|
+
}
|
|
326
|
+
_playVideoContent() {
|
|
327
|
+
this.destroyRoll();
|
|
328
|
+
Roll.destroyImaContainer();
|
|
329
|
+
const spinnerPlugin = this.container.getPlugin('spinner');
|
|
330
|
+
spinnerPlugin?.hide();
|
|
331
|
+
if (this.isPlaying) {
|
|
332
|
+
this.trigger('advertisement_finish', { type: this.type });
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
this.trigger('advertisement_dont_play', { type: this.type });
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
destroyRoll() {
|
|
339
|
+
if (!this.roll) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
// @ts-ignore
|
|
343
|
+
this.roll.off();
|
|
344
|
+
this.roll.destroy();
|
|
345
|
+
this.roll = null;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Events, Playback } from '@clappr/core';
|
|
2
|
+
import { Events as HlsEvents, FragChangedData } from 'hls.js';
|
|
3
|
+
type CueResult = {
|
|
4
|
+
kind?: "in" | "out" | "out_cont";
|
|
5
|
+
duration?: number;
|
|
6
|
+
};
|
|
7
|
+
export default class SCTEManager extends Events {
|
|
8
|
+
private _playback;
|
|
9
|
+
private _scteIsStarted;
|
|
10
|
+
set playback(value: Playback);
|
|
11
|
+
get playback(): Playback | null;
|
|
12
|
+
_subscribedHlsEvents(): void;
|
|
13
|
+
_onHlsFragChanged(_: HlsEvents.FRAG_CHANGED, data: FragChangedData): void;
|
|
14
|
+
_stopScte(): void;
|
|
15
|
+
_getCue(tagList: string[][]): CueResult;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=sctemanager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sctemanager.d.ts","sourceRoot":"","sources":["../../../src/plugins/vast-ads/sctemanager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAM9D,KAAK,SAAS,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,UAAU,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,MAAM;IAC7C,OAAO,CAAC,SAAS,CAAyB;IAE1C,OAAO,CAAC,cAAc,CAAS;IAE/B,IAAI,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAkB3B;IAED,IAAI,QAAQ,IAAI,QAAQ,GAAG,IAAI,CAE9B;IAED,oBAAoB;IAUpB,iBAAiB,CAAC,CAAC,EAAE,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,eAAe;IA2BlE,SAAS;IAOT,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,SAAS;CAmDxC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Events } from '@clappr/core';
|
|
2
|
+
import { Events as HlsEvents } from 'hls.js';
|
|
3
|
+
const OUT = 'out', IN = 'in', OUT_CONT = 'out_cont';
|
|
4
|
+
export default class SCTEManager extends Events {
|
|
5
|
+
_playback = null;
|
|
6
|
+
_scteIsStarted = false;
|
|
7
|
+
set playback(value) {
|
|
8
|
+
if (this._playback) {
|
|
9
|
+
//удалить все подписанные евенты
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
if (this._playback._hls) {
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
this._playback._hls.off(HlsEvents.FRAG_CHANGED, this._onHlsFragChanged.bind(this));
|
|
14
|
+
}
|
|
15
|
+
this._playback.off(Events.PLAYBACK_PLAY_INTENT, this._subscribedHlsEvents, this);
|
|
16
|
+
}
|
|
17
|
+
this._playback = value;
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
if (!this._playback._hls) {
|
|
20
|
+
this._playback.once(Events.PLAYBACK_PLAY_INTENT, this._subscribedHlsEvents, this);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
this._subscribedHlsEvents();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
get playback() {
|
|
27
|
+
return this._playback;
|
|
28
|
+
}
|
|
29
|
+
_subscribedHlsEvents() {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
if (this._playback._hls) {
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
this._playback._hls.off(HlsEvents.FRAG_CHANGED, this._onHlsFragChanged.bind(this));
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
this._playback._hls.on(HlsEvents.FRAG_CHANGED, this._onHlsFragChanged.bind(this));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
_onHlsFragChanged(_, data) {
|
|
39
|
+
const { tagList } = data.frag;
|
|
40
|
+
if (tagList) {
|
|
41
|
+
const cue = this._getCue(tagList);
|
|
42
|
+
if (Object.keys(cue).length > 0) {
|
|
43
|
+
if (!this._scteIsStarted) {
|
|
44
|
+
if (cue.kind === OUT || cue.kind === OUT_CONT) {
|
|
45
|
+
this._scteIsStarted = true;
|
|
46
|
+
console.warn('scteroll will be started');
|
|
47
|
+
this.trigger('startSCTERoll', {
|
|
48
|
+
duration: cue.duration
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
if (cue.kind === IN) {
|
|
54
|
+
console.warn('scteroll will be stopped');
|
|
55
|
+
this._stopScte();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this._stopScte();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
_stopScte() {
|
|
65
|
+
if (this._scteIsStarted) {
|
|
66
|
+
this.trigger('stopSCTERoll');
|
|
67
|
+
this._scteIsStarted = false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
_getCue(tagList) {
|
|
71
|
+
let cueResult = {
|
|
72
|
+
kind: undefined,
|
|
73
|
+
duration: undefined,
|
|
74
|
+
};
|
|
75
|
+
for (let i = 0; i < tagList.length; i++) {
|
|
76
|
+
const infoSegment = tagList[i];
|
|
77
|
+
let kind;
|
|
78
|
+
let duration;
|
|
79
|
+
infoSegment.forEach((info) => {
|
|
80
|
+
if (kind) {
|
|
81
|
+
if (kind === OUT) {
|
|
82
|
+
const dur = parseInt(info);
|
|
83
|
+
!isNaN(dur) && (duration = dur);
|
|
84
|
+
}
|
|
85
|
+
if (kind === OUT_CONT) {
|
|
86
|
+
const durString = info.match(/Duration=\d+/g);
|
|
87
|
+
if (durString) {
|
|
88
|
+
const durNumb = durString[0].match(/\d+/g);
|
|
89
|
+
if (durNumb) {
|
|
90
|
+
duration = parseInt(durNumb[0]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
switch (info) {
|
|
97
|
+
case 'EXT-X-CUE-OUT':
|
|
98
|
+
kind = OUT;
|
|
99
|
+
break;
|
|
100
|
+
case 'EXT-X-CUE-OUT-CONT':
|
|
101
|
+
kind = OUT_CONT;
|
|
102
|
+
break;
|
|
103
|
+
case 'EXT-X-CUE-IN':
|
|
104
|
+
kind = IN;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
kind && (cueResult = {
|
|
110
|
+
kind,
|
|
111
|
+
duration
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return cueResult;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AdRollType = 'preroll' | 'middleroll' | 'repeatableroll' | 'pauseroll' | 'postroll' | 'scteroll';
|
|
2
|
+
export type AdRollItem = {
|
|
3
|
+
startTime: number;
|
|
4
|
+
startTimePercent: number;
|
|
5
|
+
tag: string;
|
|
6
|
+
};
|
|
7
|
+
export type AdRollDesc = {
|
|
8
|
+
data: AdRollItem[];
|
|
9
|
+
oneByOne?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type VastAdsOptions = Partial<Record<AdRollType, AdRollDesc>>;
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/vast-ads/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;AAE7G,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlhandler.d.ts","sourceRoot":"","sources":["../../../src/plugins/vast-ads/urlhandler.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,GAAG,KAAK,IAAI;CA6BrF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import XHRURLHandler from './xmlhttprequest.js';
|
|
3
|
+
// eslint-disable-next-line max-len
|
|
4
|
+
const ERROR_MESSAGE = 'Current context is not supported by any of the default URLHandlers. Please provide a custom URLHandler';
|
|
5
|
+
export default class URLHandler {
|
|
6
|
+
static get(url, options, cb) {
|
|
7
|
+
// Allow skip of the options param
|
|
8
|
+
if (!cb) {
|
|
9
|
+
if (typeof options === 'function') {
|
|
10
|
+
cb = options;
|
|
11
|
+
}
|
|
12
|
+
options = {};
|
|
13
|
+
}
|
|
14
|
+
assert(cb, 'URLHandler.get: callback is required');
|
|
15
|
+
if (options.response) {
|
|
16
|
+
// Trick: the VAST response XML document is passed as an option
|
|
17
|
+
const { response } = options;
|
|
18
|
+
delete options.response;
|
|
19
|
+
return cb(null, response);
|
|
20
|
+
}
|
|
21
|
+
if (options.urlhandler?.supported()) {
|
|
22
|
+
// explicitly supply your own URLHandler object
|
|
23
|
+
return options.urlhandler.get(url, options, cb);
|
|
24
|
+
}
|
|
25
|
+
if (XHRURLHandler.supported()) {
|
|
26
|
+
return XHRURLHandler.get(url, options, cb);
|
|
27
|
+
}
|
|
28
|
+
return cb(new Error(ERROR_MESSAGE));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xmlhttprequest.d.ts","sourceRoot":"","sources":["../../../src/plugins/vast-ads/xmlhttprequest.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,MAAM,CAAC,SAAS,IAAI,cAAc,GAAG,KAAK;IAU1C,MAAM,CAAC,SAAS;IAIhB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,GAAG,KAAK,IAAI;CAyBtF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { reportError } from '@gcorevideo/utils';
|
|
2
|
+
import assert from "assert";
|
|
3
|
+
export default class XHRURLHandler {
|
|
4
|
+
static xhrCreate() {
|
|
5
|
+
const xhr = new window.XMLHttpRequest();
|
|
6
|
+
if ('withCredentials' in xhr) { // check CORS support
|
|
7
|
+
return xhr;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
static supported() {
|
|
12
|
+
return !!this.xhrCreate();
|
|
13
|
+
}
|
|
14
|
+
static get(url, options, cb) {
|
|
15
|
+
try {
|
|
16
|
+
const xhr = this.xhrCreate();
|
|
17
|
+
assert(xhr, 'XHRURLHandler: XMLHttpRequest is not supported');
|
|
18
|
+
xhr.open('GET', url);
|
|
19
|
+
xhr.timeout = options.timeout || 0;
|
|
20
|
+
xhr.withCredentials = options.withCredentials || false;
|
|
21
|
+
xhr.onreadystatechange = function () {
|
|
22
|
+
if (xhr.readyState === 4) {
|
|
23
|
+
if (xhr.status === 200) {
|
|
24
|
+
return cb(null, xhr.response);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return cb(new Error(`XHRURLHandler: ${xhr.statusText}`));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return xhr.send();
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
// LogManager.exception(error);
|
|
35
|
+
reportError(error);
|
|
36
|
+
return cb(new Error('XHRURLHandler: Unexpected error'));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default class MergeVast {
|
|
2
|
+
private firstXML;
|
|
3
|
+
private secondXML;
|
|
4
|
+
private firstVAST;
|
|
5
|
+
private secondVAST;
|
|
6
|
+
constructor(xml1: string, xml2: string);
|
|
7
|
+
merge(): string;
|
|
8
|
+
_mergeXML(first: HTMLCollectionOf<Element>, second: HTMLCollectionOf<Element>, parent?: Element): HTMLCollectionOf<Element>;
|
|
9
|
+
_getPieceTree(nodeName: string, xml: HTMLCollectionOf<Element>): Element | null;
|
|
10
|
+
_stringToXML(val: string): Document;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=xmlmerge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xmlmerge.d.ts","sourceRoot":"","sources":["../../../src/plugins/vast-ads/xmlmerge.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,SAAS,CAAW;IAE5B,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,UAAU,CAA4B;gBAElC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAOtC,KAAK;IAaL,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;IAsC3H,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,IAAI;IAc/E,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;CAapC"}
|