@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,152 @@
|
|
|
1
|
+
import { Container, Events, UICorePlugin } from '@clappr/core';
|
|
2
|
+
import { TimeProgress } from '../../playback.types';
|
|
3
|
+
|
|
4
|
+
import { strtimeToMiliseconds } from '../utils.js';
|
|
5
|
+
import '../../../assets/clips/clips.scss';
|
|
6
|
+
|
|
7
|
+
type ClipDesc = {
|
|
8
|
+
start: number;
|
|
9
|
+
text: string;
|
|
10
|
+
end: number;
|
|
11
|
+
index: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type ClipItem = {
|
|
15
|
+
start: number;
|
|
16
|
+
text: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class ClipsPlugin extends UICorePlugin {
|
|
20
|
+
private clips: Map<number, ClipDesc> = new Map()
|
|
21
|
+
|
|
22
|
+
private duration: number = 0;
|
|
23
|
+
|
|
24
|
+
private durationGetting = false;
|
|
25
|
+
|
|
26
|
+
private _oldContainer: Container | undefined;
|
|
27
|
+
|
|
28
|
+
get name() {
|
|
29
|
+
return 'clips';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
override get attributes() {
|
|
33
|
+
return {
|
|
34
|
+
'class': this.name
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override bindEvents() {
|
|
39
|
+
this.listenToOnce(this.core, Events.CORE_READY, this._onCoreReady);
|
|
40
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this._onMediaControlContainerChanged);
|
|
41
|
+
this.listenTo(this.core, Events.CORE_RESIZE, this.playerResize);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private _onCoreReady() {
|
|
45
|
+
if (!this.options.clips) {
|
|
46
|
+
this.destroy();
|
|
47
|
+
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this.parseClips();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
unbindEvents() {
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
this.stopListening(this.core, Events.CORE_READY);
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private _onMediaControlContainerChanged() {
|
|
62
|
+
this._bindContainerEvents();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private playerResize() {
|
|
66
|
+
this.durationGetting = false;
|
|
67
|
+
if (this.durationGetting) {
|
|
68
|
+
this.makeSvg(this.duration);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private _bindContainerEvents() {
|
|
73
|
+
if (this._oldContainer) {
|
|
74
|
+
this.stopListening(this._oldContainer, Events.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
this._oldContainer = this.core.mediaControl.container;
|
|
78
|
+
this.durationGetting = false;
|
|
79
|
+
this.listenTo(this.core.mediaControl.container, Events.CONTAINER_TIMEUPDATE, this.onTimeUpdate);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private onTimeUpdate(event: TimeProgress) {
|
|
83
|
+
if (!this.durationGetting) {
|
|
84
|
+
this.duration = event.total;
|
|
85
|
+
this.makeSvg(event.total);
|
|
86
|
+
this.durationGetting = true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
for (const value of this.clips.values()) {
|
|
90
|
+
if (event.current >= value.start && event.current < value.end) {
|
|
91
|
+
this.core.mediaControl.setClipText(value.text);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private parseClips() {
|
|
98
|
+
const textArr = this.options.clips.text.split('\n');
|
|
99
|
+
|
|
100
|
+
const clipsArr = textArr.map((val: string) => {
|
|
101
|
+
const matchRes = val.match(/(\d+:\d+|:\d+) (.+)/i);
|
|
102
|
+
|
|
103
|
+
return matchRes ? {
|
|
104
|
+
start: strtimeToMiliseconds(matchRes[1]),
|
|
105
|
+
text: matchRes[2],
|
|
106
|
+
} : null;
|
|
107
|
+
}).filter((clip: ClipItem | null) => clip !== null);
|
|
108
|
+
|
|
109
|
+
clipsArr.sort((a: ClipDesc, b: ClipDesc) => a.start - b.start);
|
|
110
|
+
|
|
111
|
+
clipsArr.forEach((clip: ClipDesc, index: number) => {
|
|
112
|
+
this.clips.set(clip.start, {
|
|
113
|
+
index,
|
|
114
|
+
start: clip.start,
|
|
115
|
+
text: clip.text,
|
|
116
|
+
end: clipsArr[index + 1] ? clipsArr[index + 1].start : null,
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
getText(time: number) {
|
|
122
|
+
for (const [key, value] of this.clips.entries()) {
|
|
123
|
+
if (time >= value.start && time < value.end) {
|
|
124
|
+
return value.text;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return '';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
makeSvg(duration: number) {
|
|
131
|
+
let svg = '<svg width="0" height="0">\n' + '<defs>\n' + '<clipPath id="myClip">\n';
|
|
132
|
+
const widthOfSeek = this.core.mediaControl.container.$el.width();
|
|
133
|
+
let finishValue = 0;
|
|
134
|
+
|
|
135
|
+
this.clips.forEach(val => {
|
|
136
|
+
let end = val.end;
|
|
137
|
+
|
|
138
|
+
if (!end) {
|
|
139
|
+
end = val.end = duration;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const widthChunk = (end - val.start) * widthOfSeek / duration;
|
|
143
|
+
|
|
144
|
+
svg += `<rect x="${finishValue}" y="0" width="${widthChunk - 2}" height="30"/>\n`;
|
|
145
|
+
finishValue += widthChunk;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
svg += `<rect x="${finishValue}" y="0" width="${widthOfSeek - finishValue}" height="30"/>\n`;
|
|
149
|
+
svg += '</clipPath>' + '</defs>' + '</svg>';
|
|
150
|
+
this.core.mediaControl.setSVGMask(svg);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { UICorePlugin, Events, template, $, Core, Container } from '@clappr/core';
|
|
2
|
+
|
|
3
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
4
|
+
|
|
5
|
+
import '../../../assets/context-menu/context_menu.scss';
|
|
6
|
+
import templateHtml from '../../../assets/context-menu/context_menu.ejs';
|
|
7
|
+
|
|
8
|
+
type MenuOption = {
|
|
9
|
+
label: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class ContextMenu extends UICorePlugin {
|
|
14
|
+
private _label: string = '';
|
|
15
|
+
|
|
16
|
+
private _url: string = '';
|
|
17
|
+
|
|
18
|
+
private container: Container | null = null;
|
|
19
|
+
|
|
20
|
+
private menuOptions: MenuOption[] = [];
|
|
21
|
+
|
|
22
|
+
get name() {
|
|
23
|
+
return 'context_menu';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get supportedVersion() {
|
|
27
|
+
return { min: CLAPPR_VERSION };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
override get attributes() {
|
|
31
|
+
return { 'class': 'context-menu' };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get mediaControl() {
|
|
35
|
+
return this.core.mediaControl;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get template() {
|
|
39
|
+
return template(templateHtml);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get label() {
|
|
43
|
+
return this._label || 'Gcore player ver. ' + process.env.VERSION;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get url() {
|
|
47
|
+
return this._url || 'https://gcore.com/';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get exposeVersion() {
|
|
51
|
+
return {
|
|
52
|
+
label: this.label,
|
|
53
|
+
name: 'version'
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override get events() {
|
|
58
|
+
return {
|
|
59
|
+
'click [data-version]': 'onOpenMainPage'
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
constructor(core: Core) {
|
|
64
|
+
super(core);
|
|
65
|
+
if (this.options.contextMenu && this.options.contextMenu.label) {
|
|
66
|
+
this._label = this.options.contextMenu.label;
|
|
67
|
+
}
|
|
68
|
+
if (this.options.contextMenu && this.options.contextMenu.url) {
|
|
69
|
+
this._url = this.options.contextMenu.url;
|
|
70
|
+
}
|
|
71
|
+
this.render();
|
|
72
|
+
this.bindEvents();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
override bindEvents() {
|
|
76
|
+
if (this.mediaControl) {
|
|
77
|
+
this.listenTo(this.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.containerChanged);
|
|
78
|
+
|
|
79
|
+
if (this.container) {
|
|
80
|
+
this.listenTo(this.container, Events.CONTAINER_CONTEXTMENU, this.toggleContextMenu);
|
|
81
|
+
this.listenTo(this.container, Events.CONTAINER_CLICK, this.hide);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
$('body').on('click', this.hide.bind(this));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
override destroy() {
|
|
88
|
+
$('body').off('click', this.hide.bind(this));
|
|
89
|
+
// @ts-ignore
|
|
90
|
+
this.stopListening();
|
|
91
|
+
return super.destroy();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private containerChanged() {
|
|
95
|
+
this.container = this.core.activeContainer;
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
this.stopListening();
|
|
98
|
+
this.bindEvents();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private toggleContextMenu(event: MouseEvent) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
const offset = this.container?.$el.offset();
|
|
104
|
+
|
|
105
|
+
this.show(event.pageY - offset.top, event.pageX - offset.left);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private show(top: number, left: number) {
|
|
109
|
+
this.hide();
|
|
110
|
+
if (this.options.contextMenu && this.options.contextMenu.preventShowContextMenu) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.$el.css({ top, left });
|
|
114
|
+
this.$el.show();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private hide() {
|
|
118
|
+
this.$el.hide();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private onOpenMainPage() {
|
|
122
|
+
window.open(this.url, '_blank');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
override render() {
|
|
126
|
+
this.menuOptions = [this.exposeVersion];
|
|
127
|
+
this.$el.html(this.template({ options: this.menuOptions }));
|
|
128
|
+
this.core.$el.append(this.$el);
|
|
129
|
+
this.hide();
|
|
130
|
+
this.disable();
|
|
131
|
+
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { UICorePlugin, Events } from '@clappr/core';
|
|
2
|
+
|
|
3
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
4
|
+
|
|
5
|
+
export class DisableControls extends UICorePlugin {
|
|
6
|
+
get name() {
|
|
7
|
+
return 'disable_controls';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
get container() {
|
|
11
|
+
return this.core && this.core.activeContainer;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get supportedVersion() {
|
|
15
|
+
return { min: CLAPPR_VERSION };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override bindEvents() {
|
|
19
|
+
if (this.container) {
|
|
20
|
+
this.listenTo(this.container, Events.CONTAINER_MEDIACONTROL_ENABLE, this.enableControls);
|
|
21
|
+
this.listenTo(this.container, Events.CONTAINER_PLAY, this.enableControls);
|
|
22
|
+
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.enableControls);
|
|
23
|
+
this.listenTo(this.container, Events.CONTAINER_STOP, this.enableControls);
|
|
24
|
+
this.listenTo(this.container, Events.CONTAINER_ENDED, this.enableControls);
|
|
25
|
+
this.listenTo(this.container, 'container:advertisement:start', this.enableControls);
|
|
26
|
+
}
|
|
27
|
+
this.listenTo(this.core, Events.CORE_READY, this.onCoreReady);
|
|
28
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_SHOW, this.enableControls);
|
|
29
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.enableControls);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
unbindEvents() {
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
this.stopListening(this.core, Events.CORE_READY);
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_SHOW);
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED);
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
this.stopListening(this.container, Events.CONTAINER_MEDIACONTROL_ENABLE);
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
this.stopListening(this.container, Events.CONTAINER_PLAY);
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
this.stopListening(this.container, Events.CONTAINER_PAUSE);
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
this.stopListening(this.container, Events.CONTAINER_STOP);
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
this.stopListening(this.container, Events.CONTAINER_ENDED);
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
this.stopListening(this.container, 'container:advertisement:start');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private setDisableStyles() {
|
|
54
|
+
const css = document.createElement('style');
|
|
55
|
+
|
|
56
|
+
const styles = '.control-need-disable { display: none!important; }';
|
|
57
|
+
|
|
58
|
+
css.appendChild(document.createTextNode(styles));
|
|
59
|
+
|
|
60
|
+
this.core.$el.get(0).appendChild(css);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private onCoreReady() {
|
|
64
|
+
this.setDisableStyles();
|
|
65
|
+
this.bindEvents();
|
|
66
|
+
this.enableControls();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private enableControls() {
|
|
70
|
+
this.disableAllControls();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private disableAllControls() {
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
const spinnerPlugin = this.container.getPlugin('spinner');
|
|
76
|
+
|
|
77
|
+
spinnerPlugin?.destroy();
|
|
78
|
+
this.container.disableMediaControl();
|
|
79
|
+
}, 0);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Core, Events, Playback, UICorePlugin, template } from '@clappr/core';
|
|
2
|
+
|
|
3
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
4
|
+
|
|
5
|
+
import dvrHTML from '../../../assets/dvr-controls/index.ejs';
|
|
6
|
+
import '../../../assets/dvr-controls/dvr_controls.scss';
|
|
7
|
+
|
|
8
|
+
export class DvrControls extends UICorePlugin {
|
|
9
|
+
get template() {
|
|
10
|
+
return template(dvrHTML);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get name() {
|
|
14
|
+
return 'dvr_controls';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get supportedVersion() {
|
|
18
|
+
return { min: CLAPPR_VERSION };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override get events() {
|
|
22
|
+
return {
|
|
23
|
+
'click .live-button': 'click'
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override get attributes() {
|
|
28
|
+
return {
|
|
29
|
+
'class': 'dvr-controls',
|
|
30
|
+
'data-dvr-controls': ''
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
constructor(core: Core) {
|
|
35
|
+
super(core);
|
|
36
|
+
this.settingsUpdate();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override bindEvents() {
|
|
40
|
+
this.bindCoreEvents();
|
|
41
|
+
this.bindContainerEvents();
|
|
42
|
+
|
|
43
|
+
if (this.core.activeContainer) {
|
|
44
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.dvrChanged);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private bindCoreEvents() {
|
|
49
|
+
if (this.core.mediaControl.settings) {
|
|
50
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.containerChanged);
|
|
51
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.settingsUpdate);
|
|
52
|
+
this.listenTo(this.core, Events.CORE_OPTIONS_CHANGE, this.render);
|
|
53
|
+
} else {
|
|
54
|
+
setTimeout(() => this.bindCoreEvents(), 100);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private bindContainerEvents() {
|
|
59
|
+
if (this.core.activeContainer) {
|
|
60
|
+
this.listenToOnce(this.core.activeContainer, Events.CONTAINER_TIMEUPDATE, this.render);
|
|
61
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.dvrChanged);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private containerChanged() {
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
this.stopListening();
|
|
68
|
+
this.bindEvents();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private dvrChanged(dvrEnabled: boolean) {
|
|
72
|
+
if (this.core.getPlaybackType() !== Playback.LIVE) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.settingsUpdate();
|
|
76
|
+
this.core.mediaControl.$el.addClass('live');
|
|
77
|
+
if (dvrEnabled) {
|
|
78
|
+
this.core.mediaControl.$playbackRate.removeClass('playbackrate-enable');
|
|
79
|
+
this.core.mediaControl.$el
|
|
80
|
+
.addClass('dvr')
|
|
81
|
+
.find('.media-control-indicator[data-position], .media-control-indicator[data-duration]')
|
|
82
|
+
.hide();
|
|
83
|
+
} else {
|
|
84
|
+
this.core.mediaControl.$playbackRate.addClass('playbackrate-enable');
|
|
85
|
+
this.core.mediaControl.$el.removeClass('dvr');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
click() {
|
|
90
|
+
const mediaControl = this.core.mediaControl;
|
|
91
|
+
const container = mediaControl.container;
|
|
92
|
+
|
|
93
|
+
if (!container.isPlaying()) {
|
|
94
|
+
container.play();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (mediaControl.$el.hasClass('dvr')) {
|
|
98
|
+
container.seek(container.getDuration());
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
settingsUpdate() {
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
this.stopListening();
|
|
105
|
+
this.core.mediaControl.$el.removeClass('live');
|
|
106
|
+
if (this.shouldRender()) {
|
|
107
|
+
this.render();
|
|
108
|
+
this.$el.click(() => this.click());
|
|
109
|
+
}
|
|
110
|
+
this.bindEvents();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
shouldRender() {
|
|
114
|
+
const useDvrControls = this.core.options.useDvrControls === undefined || !!this.core.options.useDvrControls;
|
|
115
|
+
|
|
116
|
+
return useDvrControls && this.core.getPlaybackType() === Playback.LIVE;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
override render() {
|
|
120
|
+
this.$el.html(this.template({
|
|
121
|
+
live: this.core.i18n.t('live'),
|
|
122
|
+
backToLive: this.core.i18n.t('back_to_live')
|
|
123
|
+
}));
|
|
124
|
+
if (this.shouldRender()) {
|
|
125
|
+
this.core.mediaControl.$el.addClass('live');
|
|
126
|
+
this.core.mediaControl.$('.media-control-left-panel[data-media-control]').append(this.$el);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
}
|