@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,414 @@
|
|
|
1
|
+
import { UICorePlugin, Events, template, $ } from '@clappr/core';
|
|
2
|
+
import { reportError, trace } from '@gcorevideo/utils';
|
|
3
|
+
import parseSRT from 'parse-srt';
|
|
4
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
5
|
+
import pluginHtml from '../../../assets/thumbnails/scrub-thumbnails.ejs';
|
|
6
|
+
import '../../../assets/thumbnails/style.scss';
|
|
7
|
+
import { getPageX } from '../utils.js';
|
|
8
|
+
const T = 'plugins.thumbnails';
|
|
9
|
+
export class Thumbnails extends UICorePlugin {
|
|
10
|
+
_$spotlight = null;
|
|
11
|
+
_$backdrop = null;
|
|
12
|
+
$container = null;
|
|
13
|
+
$img = null;
|
|
14
|
+
_$carousel = null;
|
|
15
|
+
$textThumbnail = null;
|
|
16
|
+
_$backdropCarouselImgs = [];
|
|
17
|
+
spriteSheetHeight = 0;
|
|
18
|
+
_hoverPosition = 0;
|
|
19
|
+
_show = false;
|
|
20
|
+
_thumbsLoaded = false;
|
|
21
|
+
_oldContainer = null;
|
|
22
|
+
_thumbs = [];
|
|
23
|
+
get name() {
|
|
24
|
+
return 'thumbnails';
|
|
25
|
+
}
|
|
26
|
+
get supportedVersion() {
|
|
27
|
+
return { min: CLAPPR_VERSION };
|
|
28
|
+
}
|
|
29
|
+
get attributes() {
|
|
30
|
+
return {
|
|
31
|
+
'class': this.name
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
get template() {
|
|
35
|
+
return template(pluginHtml);
|
|
36
|
+
}
|
|
37
|
+
/*
|
|
38
|
+
* Helper to build the "thumbs" property for a sprite sheet.
|
|
39
|
+
*
|
|
40
|
+
* spriteSheetUrl- The url to the sprite sheet image
|
|
41
|
+
* numThumbs- The number of thumbnails on the sprite sheet
|
|
42
|
+
* thumbWidth- The width of each thumbnail.
|
|
43
|
+
* thumbHeight- The height of each thumbnail.
|
|
44
|
+
* numColumns- The number of columns in the sprite sheet.
|
|
45
|
+
* timeInterval- The interval (in seconds) between the thumbnails.
|
|
46
|
+
* startTime- The time (in seconds) that the first thumbnail represents. (defaults to 0)
|
|
47
|
+
*/
|
|
48
|
+
// buildSpriteConfig(vtt, spriteSheetUrl, numThumbs, thumbWidth, thumbHeight, numColumns, timeInterval, startTime) {
|
|
49
|
+
buildSpriteConfig(vtt, spriteSheetUrl) {
|
|
50
|
+
const thumbs = [];
|
|
51
|
+
// let coor: string[] = [];
|
|
52
|
+
for (const vt of vtt) {
|
|
53
|
+
const el = vt.text;
|
|
54
|
+
// if (el && el.search(/\d*,\d*,\d*,\d*/g) > -1) {
|
|
55
|
+
// el = el.match(/\d*,\d*,\d*,\d*/g)[0];
|
|
56
|
+
// coor = el.split(',');
|
|
57
|
+
// }
|
|
58
|
+
if (el) {
|
|
59
|
+
const m = el.match(/xywh=\d*,\d*,\d*,\d*/g);
|
|
60
|
+
if (m) {
|
|
61
|
+
const coor = m[0].split(',');
|
|
62
|
+
const w = parseInt(coor[2], 10);
|
|
63
|
+
const h = parseInt(coor[3], 10);
|
|
64
|
+
if (w > 0 && h > 0) {
|
|
65
|
+
thumbs.push({
|
|
66
|
+
url: spriteSheetUrl,
|
|
67
|
+
time: vt.start,
|
|
68
|
+
w,
|
|
69
|
+
h,
|
|
70
|
+
x: parseInt(coor[0], 10) || 0,
|
|
71
|
+
y: parseInt(coor[1], 10) || 0,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return thumbs;
|
|
78
|
+
}
|
|
79
|
+
// TODO check if seek enabled
|
|
80
|
+
bindEvents() {
|
|
81
|
+
this.listenToOnce(this.core, Events.CORE_READY, this._onCoreReady);
|
|
82
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR, this._onMouseMove);
|
|
83
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR, this._onMouseLeave);
|
|
84
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this._init);
|
|
85
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this._onMediaControlContainerChanged);
|
|
86
|
+
}
|
|
87
|
+
_bindContainerEvents() {
|
|
88
|
+
if (this._oldContainer) {
|
|
89
|
+
this.stopListening(this._oldContainer, Events.CONTAINER_TIMEUPDATE, this._renderPlugin);
|
|
90
|
+
}
|
|
91
|
+
this._oldContainer = this.core.mediaControl.container;
|
|
92
|
+
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_TIMEUPDATE, this._renderPlugin);
|
|
93
|
+
}
|
|
94
|
+
_onCoreReady() {
|
|
95
|
+
try {
|
|
96
|
+
if (!this.options.thumbnails || !this.options.thumbnails.sprite || !this.options.thumbnails.vtt) {
|
|
97
|
+
this.destroy();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
reportError(error);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
// TODO options
|
|
106
|
+
const spriteSheet = this.options.thumbnails.sprite;
|
|
107
|
+
this._thumbs = this.buildSpriteConfig(parseSRT(this.options.thumbnails.vtt), spriteSheet);
|
|
108
|
+
if (!this._thumbs.length) {
|
|
109
|
+
this.destroy();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this.loadSpriteSheet(spriteSheet).then(() => {
|
|
113
|
+
this._thumbsLoaded = true;
|
|
114
|
+
this.core.options.thumbnails.spotlightHeight = this._thumbs[0].h;
|
|
115
|
+
this._init();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
async loadSpriteSheet(spriteSheetUrl) {
|
|
119
|
+
return new Promise((resolve, reject) => {
|
|
120
|
+
const img = new Image();
|
|
121
|
+
img.onload = () => {
|
|
122
|
+
this.spriteSheetHeight = img.height;
|
|
123
|
+
resolve();
|
|
124
|
+
};
|
|
125
|
+
img.onerror = reject;
|
|
126
|
+
img.src = spriteSheetUrl;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
_onMediaControlContainerChanged() {
|
|
130
|
+
this._bindContainerEvents();
|
|
131
|
+
}
|
|
132
|
+
_init() {
|
|
133
|
+
if (!this._thumbsLoaded) {
|
|
134
|
+
// _init() will be called when the thumbs are loaded,
|
|
135
|
+
// and whenever the media control rendered event is fired as just before this the dom elements get wiped in IE (https://github.com/tjenkinson/clappr-thumbnails-plugin/issues/5)
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
// Init the backdropCarousel as array to keep reference of thumbnail images
|
|
139
|
+
this._$backdropCarouselImgs = [];
|
|
140
|
+
// create/recreate the dom elements for the plugin
|
|
141
|
+
this._createElements();
|
|
142
|
+
this._loadBackdrop();
|
|
143
|
+
this._renderPlugin();
|
|
144
|
+
}
|
|
145
|
+
_getOptions() {
|
|
146
|
+
if (!('thumbnails' in this.core.options)) {
|
|
147
|
+
throw '\'thumbnail property missing from options object.';
|
|
148
|
+
}
|
|
149
|
+
return this.core.options.thumbnails;
|
|
150
|
+
}
|
|
151
|
+
_appendElToMediaControl() {
|
|
152
|
+
// insert after the background
|
|
153
|
+
this.core.mediaControl.$el.find('.seek-time').css('bottom', 56);
|
|
154
|
+
this.core.mediaControl.$el.first().after(this.el);
|
|
155
|
+
}
|
|
156
|
+
_onMouseMove(e) {
|
|
157
|
+
// trace(`${T} _onMouseMove`, {
|
|
158
|
+
// e: (e as any).name,
|
|
159
|
+
// t: typeof e,
|
|
160
|
+
// t2: typeof arguments[1],
|
|
161
|
+
// });
|
|
162
|
+
this._calculateHoverPosition(e);
|
|
163
|
+
this._show = true;
|
|
164
|
+
this._renderPlugin();
|
|
165
|
+
}
|
|
166
|
+
_onMouseLeave() {
|
|
167
|
+
this._show = false;
|
|
168
|
+
this._renderPlugin();
|
|
169
|
+
}
|
|
170
|
+
_calculateHoverPosition(e) {
|
|
171
|
+
const offset = getPageX(e) - this.core.mediaControl.$seekBarContainer.offset().left;
|
|
172
|
+
// proportion into the seek bar that the mouse is hovered over 0-1
|
|
173
|
+
this._hoverPosition = Math.min(1, Math.max(offset / this.core.mediaControl.$seekBarContainer.width(), 0));
|
|
174
|
+
}
|
|
175
|
+
// private _buildThumbsFromOptions() {
|
|
176
|
+
// const thumbs = this._thumbs;
|
|
177
|
+
// const promises = thumbs.map((thumb) => {
|
|
178
|
+
// return this._addThumbFromSrc(thumb);
|
|
179
|
+
// });
|
|
180
|
+
// return Promise.all(promises);
|
|
181
|
+
// }
|
|
182
|
+
// private _addThumbFromSrc(thumbSrc) {
|
|
183
|
+
// return new Promise((resolve, reject) => {
|
|
184
|
+
// const img = new Image();
|
|
185
|
+
// img.onload = () => {
|
|
186
|
+
// resolve(img);
|
|
187
|
+
// };
|
|
188
|
+
// img.onerror = reject;
|
|
189
|
+
// img.src = thumbSrc.url;
|
|
190
|
+
// }).then((img) => {
|
|
191
|
+
// const startTime = thumbSrc.time;
|
|
192
|
+
// // determine the thumb index
|
|
193
|
+
// let index = null;
|
|
194
|
+
// this._thumbs.some((thumb, i) => {
|
|
195
|
+
// if (startTime < thumb.time) {
|
|
196
|
+
// index = i;
|
|
197
|
+
// return true;
|
|
198
|
+
// }
|
|
199
|
+
// return false;
|
|
200
|
+
// });
|
|
201
|
+
// if (index === null) {
|
|
202
|
+
// index = this._thumbs.length;
|
|
203
|
+
// }
|
|
204
|
+
// const next = index < this._thumbs.length ? this._thumbs[index] : null;
|
|
205
|
+
// const prev = index > 0 ? this._thumbs[index - 1] : null;
|
|
206
|
+
// if (prev) {
|
|
207
|
+
// // update the duration of the previous thumbnail
|
|
208
|
+
// prev.duration = startTime - prev.time;
|
|
209
|
+
// }
|
|
210
|
+
// // the duration this thumb lasts for
|
|
211
|
+
// // if it is the last thumb then duration will be null
|
|
212
|
+
// const duration = next ? next.time - thumbSrc.time : null;
|
|
213
|
+
// const imageW = img.width;
|
|
214
|
+
// const imageH = img.height;
|
|
215
|
+
// const thumb = {
|
|
216
|
+
// imageW: imageW, // actual width of image
|
|
217
|
+
// imageH: imageH, // actual height of image
|
|
218
|
+
// x: thumbSrc.x || 0, // x coord in image of sprite
|
|
219
|
+
// y: thumbSrc.y || 0, // y coord in image of sprite
|
|
220
|
+
// w: thumbSrc.w || imageW, // width of sprite
|
|
221
|
+
// h: thumbSrc.h || imageH, // height of sprite
|
|
222
|
+
// url: thumbSrc.url,
|
|
223
|
+
// time: startTime, // time this thumb represents
|
|
224
|
+
// duration: duration, // how long (from time) this thumb represents
|
|
225
|
+
// src: thumbSrc
|
|
226
|
+
// };
|
|
227
|
+
// this._thumbs.splice(index, 0, thumb);
|
|
228
|
+
// return thumb;
|
|
229
|
+
// });
|
|
230
|
+
// }
|
|
231
|
+
// builds a dom element which represents the thumbnail
|
|
232
|
+
// scaled to the provided height
|
|
233
|
+
_buildImg(thumb, height) {
|
|
234
|
+
const scaleFactor = height / thumb.h;
|
|
235
|
+
if (!this.$img) {
|
|
236
|
+
this.$img = $('<img />').addClass('thumbnail-img').attr('src', thumb.url);
|
|
237
|
+
}
|
|
238
|
+
// the container will contain the image positioned so that the correct sprite
|
|
239
|
+
// is visible
|
|
240
|
+
if (!this.$container) {
|
|
241
|
+
this.$container = $('<div />').addClass('thumbnail-container');
|
|
242
|
+
}
|
|
243
|
+
this.$container.css('width', thumb.w * scaleFactor);
|
|
244
|
+
this.$container.css('height', height);
|
|
245
|
+
this.$img.css({
|
|
246
|
+
height: this.spriteSheetHeight * scaleFactor,
|
|
247
|
+
left: -1 * thumb.x * scaleFactor,
|
|
248
|
+
top: -1 * thumb.y * scaleFactor
|
|
249
|
+
});
|
|
250
|
+
if (this.$container.find(this.$img).length === 0) {
|
|
251
|
+
this.$container.append(this.$img);
|
|
252
|
+
}
|
|
253
|
+
return this.$container;
|
|
254
|
+
}
|
|
255
|
+
_loadBackdrop() {
|
|
256
|
+
if (!this._getOptions().backdropHeight) {
|
|
257
|
+
// disabled
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
// append each of the thumbnails to the backdrop carousel
|
|
261
|
+
const $carousel = this._$carousel;
|
|
262
|
+
for (const thumb of this._thumbs) {
|
|
263
|
+
const $img = this._buildImg(thumb, this._getOptions().backdropHeight);
|
|
264
|
+
// Keep reference to thumbnail
|
|
265
|
+
this._$backdropCarouselImgs.push($img);
|
|
266
|
+
// Add thumbnail to DOM
|
|
267
|
+
$carousel.append($img);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
setText(time) {
|
|
271
|
+
if (this.core.getPlugin('clips')) {
|
|
272
|
+
const txt = this.core.getPlugin('clips').getText(time);
|
|
273
|
+
this.$textThumbnail.text(txt);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// calculate how far along the carousel should currently be slid
|
|
277
|
+
// depending on where the user is hovering on the progress bar
|
|
278
|
+
_updateCarousel() {
|
|
279
|
+
trace(`${T} _updateCarousel`, {
|
|
280
|
+
backdropHeight: this._getOptions().backdropHeight,
|
|
281
|
+
});
|
|
282
|
+
if (!this._getOptions().backdropHeight) {
|
|
283
|
+
// disabled
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const hoverPosition = this._hoverPosition;
|
|
287
|
+
const videoDuration = this.core.mediaControl.container.getDuration();
|
|
288
|
+
const startTimeOffset = this.core.mediaControl.container.getStartTimeOffset();
|
|
289
|
+
// the time into the video at the current hover position
|
|
290
|
+
const hoverTime = startTimeOffset + (videoDuration * hoverPosition);
|
|
291
|
+
const backdropWidth = this._$backdrop.width();
|
|
292
|
+
const $carousel = this._$carousel;
|
|
293
|
+
const carouselWidth = $carousel.width();
|
|
294
|
+
// slide the carousel so that the image on the carousel that is above where the person
|
|
295
|
+
// is hovering maps to that position in time.
|
|
296
|
+
// Thumbnails may not be distributed at even times along the video
|
|
297
|
+
const thumbs = this._thumbs;
|
|
298
|
+
// assuming that each thumbnail has the same width
|
|
299
|
+
const thumbWidth = carouselWidth / thumbs.length;
|
|
300
|
+
// determine which thumbnail applies to the current time
|
|
301
|
+
const thumbIndex = this._getThumbIndexForTime(hoverTime);
|
|
302
|
+
const thumb = thumbs[thumbIndex];
|
|
303
|
+
let thumbDuration = thumb.duration;
|
|
304
|
+
if (!thumbDuration) {
|
|
305
|
+
// the last thumbnail duration will be null as it can't be determined
|
|
306
|
+
// e.g the duration of the video may increase over time (live stream)
|
|
307
|
+
// so calculate the duration now so this last thumbnail lasts till the end
|
|
308
|
+
thumbDuration = Math.max(videoDuration + startTimeOffset - thumb.time, 0);
|
|
309
|
+
}
|
|
310
|
+
// determine how far accross that thumbnail we are
|
|
311
|
+
const timeIntoThumb = hoverTime - thumb.time;
|
|
312
|
+
const positionInThumb = timeIntoThumb / thumbDuration;
|
|
313
|
+
const xCoordInThumb = thumbWidth * positionInThumb;
|
|
314
|
+
// now calculate the position along carousel that we want to be above the hover position
|
|
315
|
+
const xCoordInCarousel = (thumbIndex * thumbWidth) + xCoordInThumb;
|
|
316
|
+
// and finally the position of the carousel when the hover position is taken in to consideration
|
|
317
|
+
const carouselXCoord = xCoordInCarousel - (hoverPosition * backdropWidth);
|
|
318
|
+
$carousel.css('left', -carouselXCoord);
|
|
319
|
+
const maxOpacity = this._getOptions().backdropMaxOpacity || 0.6;
|
|
320
|
+
const minOpacity = this._getOptions().backdropMinOpacity || 0.08;
|
|
321
|
+
// now update the transparencies so that they fade in around the active one
|
|
322
|
+
for (let i = 0; i < thumbs.length; i++) {
|
|
323
|
+
const thumbXCoord = thumbWidth * i;
|
|
324
|
+
let distance = thumbXCoord - xCoordInCarousel;
|
|
325
|
+
if (distance < 0) {
|
|
326
|
+
// adjust so that distance is always a measure away from
|
|
327
|
+
// each side of the active thumbnail
|
|
328
|
+
// at every point on the active thumbnail the distance should
|
|
329
|
+
// be 0
|
|
330
|
+
distance = Math.min(0, distance + thumbWidth);
|
|
331
|
+
}
|
|
332
|
+
// fade over the width of 2 thumbnails
|
|
333
|
+
const opacity = Math.max(maxOpacity - (Math.abs(distance) / (2 * thumbWidth)), minOpacity);
|
|
334
|
+
this._$backdropCarouselImgs[i].css('opacity', opacity);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
_updateSpotlightThumb() {
|
|
338
|
+
trace(`${T} _updateSpotlightThumb`, {
|
|
339
|
+
spotlightHeight: this._getOptions().spotlightHeight,
|
|
340
|
+
});
|
|
341
|
+
if (!this._getOptions().spotlightHeight) {
|
|
342
|
+
// disabled
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const hoverPosition = this._hoverPosition;
|
|
346
|
+
const videoDuration = this.core.mediaControl.container.getDuration();
|
|
347
|
+
// the time into the video at the current hover position
|
|
348
|
+
const startTimeOffset = this.core.mediaControl.container.getStartTimeOffset();
|
|
349
|
+
const hoverTime = startTimeOffset + (videoDuration * hoverPosition);
|
|
350
|
+
this.setText(hoverTime);
|
|
351
|
+
// determine which thumbnail applies to the current time
|
|
352
|
+
const thumbIndex = this._getThumbIndexForTime(hoverTime);
|
|
353
|
+
const thumb = this._thumbs[thumbIndex];
|
|
354
|
+
// update thumbnail
|
|
355
|
+
const $spotlight = this._$spotlight;
|
|
356
|
+
$spotlight.empty();
|
|
357
|
+
$spotlight.append(this._buildImg(thumb, this._getOptions().spotlightHeight));
|
|
358
|
+
const elWidth = this.$el.width();
|
|
359
|
+
const thumbWidth = $spotlight.width();
|
|
360
|
+
const thumbHeight = $spotlight.height();
|
|
361
|
+
let spotlightXPos = (elWidth * hoverPosition) - (thumbWidth / 2);
|
|
362
|
+
// adjust so the entire thumbnail is always visible
|
|
363
|
+
spotlightXPos = Math.max(Math.min(spotlightXPos, elWidth - thumbWidth), 0);
|
|
364
|
+
$spotlight.css('left', spotlightXPos);
|
|
365
|
+
this.$textThumbnail.css('left', spotlightXPos);
|
|
366
|
+
this.$textThumbnail.css('width', thumbWidth);
|
|
367
|
+
this.$textThumbnail.css('bottom', thumbHeight + 1);
|
|
368
|
+
}
|
|
369
|
+
// returns the thumbnail which represents a time in the video
|
|
370
|
+
// or null if there is no thumbnail that can represent the time
|
|
371
|
+
_getThumbIndexForTime(time) {
|
|
372
|
+
const thumbs = this._thumbs;
|
|
373
|
+
for (let i = thumbs.length - 1; i >= 0; i--) {
|
|
374
|
+
const thumb = thumbs[i];
|
|
375
|
+
if (thumb.time <= time) {
|
|
376
|
+
return i;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
// stretch the first thumbnail back to the start
|
|
380
|
+
return 0;
|
|
381
|
+
}
|
|
382
|
+
_renderPlugin() {
|
|
383
|
+
trace(`${T} _renderPlugin`, {
|
|
384
|
+
show: this._show,
|
|
385
|
+
thumbsLoaded: this._thumbsLoaded,
|
|
386
|
+
thumbs: this._thumbs.length,
|
|
387
|
+
});
|
|
388
|
+
if (!this._thumbsLoaded) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
if (this._show && this._thumbs.length > 0) {
|
|
392
|
+
this.$el.removeClass('hidden');
|
|
393
|
+
this._updateCarousel();
|
|
394
|
+
this._updateSpotlightThumb();
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
this.$el.addClass('hidden');
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
_createElements() {
|
|
401
|
+
trace(`${T} _createElements`);
|
|
402
|
+
this.$el.html(this.template({
|
|
403
|
+
'backdropHeight': this._getOptions().backdropHeight,
|
|
404
|
+
'spotlightHeight': this._getOptions().spotlightHeight
|
|
405
|
+
}));
|
|
406
|
+
// cache dom references
|
|
407
|
+
this._$spotlight = this.$el.find('.spotlight');
|
|
408
|
+
this._$backdrop = this.$el.find('.backdrop');
|
|
409
|
+
this._$carousel = this._$backdrop.find('.carousel');
|
|
410
|
+
this.$textThumbnail = this.$el.find('.thumbnails-text');
|
|
411
|
+
this.$el.addClass('hidden');
|
|
412
|
+
this._appendElToMediaControl();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getLocation(href: string): HTMLAnchorElement;
|
|
2
|
+
export declare function strtimeToMiliseconds(str: string): number;
|
|
3
|
+
export declare function isFullscreen(el: HTMLElement): boolean;
|
|
4
|
+
export declare function getPageX(event: MouseEvent | TouchEvent): number;
|
|
5
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/plugins/utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,qBAMvC;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAyBxD;AAGD,wBAAgB,YAAY,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CASrD;AAkBD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,CAU/D"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Browser } from '@clappr/core';
|
|
2
|
+
import { reportError } from '@gcorevideo/utils';
|
|
3
|
+
export function getLocation(href) {
|
|
4
|
+
const l = document.createElement('a');
|
|
5
|
+
l.href = href;
|
|
6
|
+
return l;
|
|
7
|
+
}
|
|
8
|
+
export function strtimeToMiliseconds(str) {
|
|
9
|
+
if (!str) {
|
|
10
|
+
return 0;
|
|
11
|
+
}
|
|
12
|
+
const arr = str.split(/:/);
|
|
13
|
+
let h = 0, m = 0, s = 0;
|
|
14
|
+
if (arr.length >= 3) {
|
|
15
|
+
h = parseInt(arr[arr.length - 3]) * 60 * 60;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
h = 0;
|
|
19
|
+
}
|
|
20
|
+
if (arr.length >= 2) {
|
|
21
|
+
m = parseInt(arr[arr.length - 2]) * 60;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
m = 0;
|
|
25
|
+
}
|
|
26
|
+
if (arr.length >= 1) {
|
|
27
|
+
s = parseInt(arr[arr.length - 1]);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
s = 0;
|
|
31
|
+
}
|
|
32
|
+
return (h + m + s);
|
|
33
|
+
}
|
|
34
|
+
// TODO refactor
|
|
35
|
+
export function isFullscreen(el) {
|
|
36
|
+
const video = el.nodeName === "video" ? el : el.querySelector('video');
|
|
37
|
+
if (!video) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (Browser.isiOS) {
|
|
41
|
+
return FullscreenIOS.isFullscreen(video);
|
|
42
|
+
}
|
|
43
|
+
return !!(document.fullscreenElement);
|
|
44
|
+
}
|
|
45
|
+
const FullscreenIOS = {
|
|
46
|
+
isFullscreen: function (el) {
|
|
47
|
+
try {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
if (el.webkitDisplayingFullscreen !== undefined) {
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
return !!(el.webkitDisplayingFullscreen);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
reportError(e);
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export function getPageX(event) {
|
|
61
|
+
if (event.pageX) {
|
|
62
|
+
return event.pageX;
|
|
63
|
+
}
|
|
64
|
+
if (event.changedTouches) {
|
|
65
|
+
return event.changedTouches[event.changedTouches.length - 1].pageX;
|
|
66
|
+
}
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Core, Playback, UICorePlugin } from '@clappr/core';
|
|
2
|
+
import '../../../assets/vast-ads/style.scss';
|
|
3
|
+
export declare class VastAds extends UICorePlugin {
|
|
4
|
+
private _clickToPausePlugin;
|
|
5
|
+
private _cloneContainerEvents;
|
|
6
|
+
private _clonePlaybackEvents;
|
|
7
|
+
private countMiddleRoll;
|
|
8
|
+
private countRepeatableRoll;
|
|
9
|
+
private _container;
|
|
10
|
+
private container;
|
|
11
|
+
private _contentElement;
|
|
12
|
+
private _currentPosition;
|
|
13
|
+
private currentState;
|
|
14
|
+
private _imaIsloaded;
|
|
15
|
+
private _imaLoadResult;
|
|
16
|
+
private intervalTimer;
|
|
17
|
+
private _playback;
|
|
18
|
+
private _pluginIsReady;
|
|
19
|
+
private _posterBigPlayStyle;
|
|
20
|
+
private _posterPlugin;
|
|
21
|
+
private _prevVolumeValue;
|
|
22
|
+
private vast;
|
|
23
|
+
private _volume;
|
|
24
|
+
private startTimeRepeatableRoll;
|
|
25
|
+
private startTimeRepeatableRollGap;
|
|
26
|
+
private _scteManager;
|
|
27
|
+
private $skipAd;
|
|
28
|
+
private $muteIcon;
|
|
29
|
+
private $areaClick;
|
|
30
|
+
private _$adContainer;
|
|
31
|
+
private _adContainer;
|
|
32
|
+
get name(): string;
|
|
33
|
+
get supportedVersion(): {
|
|
34
|
+
min: string;
|
|
35
|
+
};
|
|
36
|
+
static get version(): string;
|
|
37
|
+
get mediaControl(): any;
|
|
38
|
+
get attributes(): {
|
|
39
|
+
class: string;
|
|
40
|
+
'data-vast-ads': string;
|
|
41
|
+
};
|
|
42
|
+
constructor(core: Core);
|
|
43
|
+
bindEvents(): void;
|
|
44
|
+
private onPlaybackEnded;
|
|
45
|
+
private onPlaybackPlay;
|
|
46
|
+
private onPlaybackPrerollRequest;
|
|
47
|
+
private onPlaybackTimeUpdate;
|
|
48
|
+
private rebindNextAd;
|
|
49
|
+
private initializeRollManager;
|
|
50
|
+
private changeVolume;
|
|
51
|
+
private findCloserAdvertisement;
|
|
52
|
+
private _validateData;
|
|
53
|
+
private playerResize;
|
|
54
|
+
private _stopPauserollListeners;
|
|
55
|
+
private _pauserollListeners;
|
|
56
|
+
unBindEvents(): void;
|
|
57
|
+
private containerChanged;
|
|
58
|
+
private _pluginError;
|
|
59
|
+
private _onCoreReady;
|
|
60
|
+
set playback(value: Playback);
|
|
61
|
+
get playback(): Playback | null;
|
|
62
|
+
private _onContainerVolume;
|
|
63
|
+
_onVolumeChanged(e: number): void;
|
|
64
|
+
_stopListening(): void;
|
|
65
|
+
_startListening(): void;
|
|
66
|
+
_initPlugin(): void;
|
|
67
|
+
private adsPlaying;
|
|
68
|
+
private destroyRoll;
|
|
69
|
+
private _playVideoContent;
|
|
70
|
+
render(): this;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=VastAds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VastAds.d.ts","sourceRoot":"","sources":["../../../src/plugins/vast-ads/VastAds.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAIJ,QAAQ,EAER,YAAY,EAEb,MAAM,cAAc,CAAA;AAYrB,OAAO,qCAAqC,CAAA;AAQ5C,qBAAa,OAAQ,SAAQ,YAAY;IACvC,OAAO,CAAC,mBAAmB,CAAiC;IAE5D,OAAO,CAAC,qBAAqB,CAAwC;IAErE,OAAO,CAAC,oBAAoB,CAAwC;IAEpE,OAAO,CAAC,eAAe,CAAI;IAE3B,OAAO,CAAC,mBAAmB,CAAI;IAE/B,OAAO,CAAC,UAAU,CAAyB;IAE3C,OAAO,CAAC,SAAS,CAAyB;IAE1C,OAAO,CAAC,eAAe,CAA2B;IAElD,OAAO,CAAC,gBAAgB,CAAI;IAE5B,OAAO,CAAC,YAAY,CAAY;IAEhC,OAAO,CAAC,YAAY,CAAQ;IAE5B,OAAO,CAAC,cAAc,CAAQ;IAE9B,OAAO,CAAC,aAAa,CAAuB;IAE5C,OAAO,CAAC,SAAS,CAAwB;IAEzC,OAAO,CAAC,cAAc,CAAQ;IAE9B,OAAO,CAAC,mBAAmB,CAA2B;IAEtD,OAAO,CAAC,aAAa,CAAiC;IAEtD,OAAO,CAAC,gBAAgB,CAAI;IAE5B,OAAO,CAAC,IAAI,CAA2B;IAEvC,OAAO,CAAC,OAAO,CAAK;IAEpB,OAAO,CAAC,uBAAuB,CAAI;IAEnC,OAAO,CAAC,0BAA0B,CAAI;IAEtC,OAAO,CAAC,YAAY,CAAoB;IAExC,OAAO,CAAC,OAAO,CAA2B;IAE1C,OAAO,CAAC,SAAS,CAA2B;IAE5C,OAAO,CAAC,UAAU,CAA2B;IAE7C,OAAO,CAAC,aAAa,CAA2B;IAEhD,OAAO,CAAC,YAAY,CAA2B;IAE/C,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,MAAM,KAAK,OAAO,WAEjB;IAED,IAAI,YAAY,QAEf;IAED,IAAa,UAAU;;;MAKtB;gBAEW,IAAI,EAAE,IAAI;IAqEb,UAAU;IA8FnB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,oBAAoB;IAkE5B,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,qBAAqB;IAwD7B,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,uBAAuB;IAuC/B,OAAO,CAAC,aAAa;IAsBrB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,mBAAmB;IAiD3B,YAAY;IASZ,OAAO,CAAC,gBAAgB;IA0BxB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;IA6BpB,IAAI,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAG3B;IAED,IAAI,QAAQ,IAAI,QAAQ,GAAG,IAAI,CAE9B;IAED,OAAO,CAAC,kBAAkB;IAU1B,gBAAgB,CAAC,CAAC,EAAE,MAAM;IAQ1B,cAAc;IAsBd,eAAe;IAkBf,WAAW;IAiBX,OAAO,CAAC,UAAU;IA+ClB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,iBAAiB;IAiHhB,MAAM;CAwBhB"}
|