@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 { Browser, Core, Events, Playback, template, UICorePlugin } from '@clappr/core';
|
|
2
|
+
import type { GcoreStreamMediaSource } from '@gcorevideo/player';
|
|
3
|
+
import { reportError, trace } from '@gcorevideo/utils';
|
|
4
|
+
|
|
5
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
6
|
+
|
|
7
|
+
import pluginHtml from '../../assets/multi-camera/multicamera.ejs';
|
|
8
|
+
import '../../assets/multi-camera/style.scss';
|
|
9
|
+
|
|
10
|
+
import streamsIcon from '../../assets/icons/old/streams.svg';
|
|
11
|
+
import streamsMomentoIcon from '../../assets/icons/old/language.svg';
|
|
12
|
+
import streamsWhiteNightsIcon from '../../assets/icons/old/wn.svg';
|
|
13
|
+
import { ZeptoResult } from '../types.js';
|
|
14
|
+
|
|
15
|
+
type MultisourcesMode = 'one_first' | 'only_live' | 'show_all';
|
|
16
|
+
|
|
17
|
+
const VERSION = '0.0.1';
|
|
18
|
+
|
|
19
|
+
const T = 'plugins.multicamera';
|
|
20
|
+
|
|
21
|
+
export class MultiCamera extends UICorePlugin {
|
|
22
|
+
private currentCamera: GcoreStreamMediaSource | null = null;
|
|
23
|
+
|
|
24
|
+
private currentTime: number = 0;
|
|
25
|
+
|
|
26
|
+
private playing = false;
|
|
27
|
+
|
|
28
|
+
private multicamera: GcoreStreamMediaSource[] = [];
|
|
29
|
+
|
|
30
|
+
private noActiveStreams = false;
|
|
31
|
+
|
|
32
|
+
get name() {
|
|
33
|
+
return 'multicamera';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get supportedVersion() {
|
|
37
|
+
return { min: CLAPPR_VERSION };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static get version() {
|
|
41
|
+
return VERSION;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get template() {
|
|
45
|
+
return template(pluginHtml);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override get attributes() {
|
|
49
|
+
return {
|
|
50
|
+
'class': this.name,
|
|
51
|
+
'data-multicamera': ''
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
override get events() {
|
|
56
|
+
return {
|
|
57
|
+
'click [data-multicamera-selector-select]': 'onCameraSelect',
|
|
58
|
+
'click [data-multicamera-button]': 'onShowLevelSelectMenu'
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
constructor(core: Core) {
|
|
63
|
+
super(core);
|
|
64
|
+
if (!this.options.multisources || !Array.isArray(this.options.multisources)) {
|
|
65
|
+
this.destroy();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.playing = this.options.multicameraPlay;
|
|
69
|
+
// Don't mutate the options, TODO check if some plugin observes the options.multicamera
|
|
70
|
+
this.multicamera = this.options.multisources.map((item: GcoreStreamMediaSource) => ({ ...item }));
|
|
71
|
+
this.noActiveStreams = this.multicamera.every((item) => !item.live);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
override bindEvents() {
|
|
75
|
+
this.listenTo(this.core, Events.CORE_READY, this.bindPlaybackEvents);
|
|
76
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
77
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.render);
|
|
78
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_HIDE, this.hideSelectLevelMenu);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
unBindEvents() {
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
this.stopListening(this.core, Events.CORE_READY);
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED);
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_RENDERED);
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_HIDE);
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
this.stopListening(this.core.activePlayback, Events.PLAYBACK_PLAY, this.onPlay);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private onPlay() {
|
|
95
|
+
this.playing = true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private bindPlaybackEvents() {
|
|
99
|
+
const currentPlayback = this.core.activePlayback;
|
|
100
|
+
|
|
101
|
+
this.listenToOnce(currentPlayback, Events.PLAYBACK_PLAY, this.onPlay);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private reload() {
|
|
105
|
+
this.unBindEvents();
|
|
106
|
+
this.bindEvents();
|
|
107
|
+
this.bindPlaybackEvents();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private shouldRender() {
|
|
111
|
+
if (!this.core.activeContainer || this.noActiveStreams) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!this.core.activePlayback) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return this.multicamera.length >= 2;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
override render() {
|
|
123
|
+
if (this.shouldRender()) {
|
|
124
|
+
let numActiveSources = 0;
|
|
125
|
+
|
|
126
|
+
for (let i = 0; i < this.multicamera.length; i++) {
|
|
127
|
+
if (this.multicamera[i].live) {
|
|
128
|
+
numActiveSources++;
|
|
129
|
+
}
|
|
130
|
+
if (this.multicamera[i].source === this.core.options.source && !this.currentCamera) {
|
|
131
|
+
this.currentCamera = this.multicamera[i];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (
|
|
136
|
+
this.currentTime &&
|
|
137
|
+
!this.core.mediaControl.$el.hasClass('live') &&
|
|
138
|
+
this.core.getPlaybackType() !== Playback.LIVE
|
|
139
|
+
) {
|
|
140
|
+
if (this.currentTime < this.core.activePlayback.getDuration()) {
|
|
141
|
+
this.core.activePlayback.seek(this.currentTime);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
this.currentTime = 0;
|
|
145
|
+
|
|
146
|
+
if (this.core.mediaControl.$el.hasClass('dvr')) {
|
|
147
|
+
this.core.activeContainer.dvrInUse = true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// TODO current source
|
|
152
|
+
this.$el
|
|
153
|
+
.html(this.template({ 'streams': this.multicamera, 'multisources_mode': this.options.multisourcesMode }));
|
|
154
|
+
|
|
155
|
+
if (
|
|
156
|
+
(numActiveSources <= 1 && this.options.multisourcesMode !== "show_all") ||
|
|
157
|
+
this.options.multisourcesMode === "one_first"
|
|
158
|
+
) {
|
|
159
|
+
this.$el.hide();
|
|
160
|
+
} else {
|
|
161
|
+
this.$el.show();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (
|
|
165
|
+
this.core.mediaControl.$multiCameraSelector &&
|
|
166
|
+
this.core.mediaControl.$multiCameraSelector.length > 0
|
|
167
|
+
) {
|
|
168
|
+
this.core.mediaControl.$multiCameraSelector.append(this.el);
|
|
169
|
+
} else {
|
|
170
|
+
this.core.mediaControl.$('.media-control-right-panel').append(this.el);
|
|
171
|
+
}
|
|
172
|
+
if (
|
|
173
|
+
Object.prototype.hasOwnProperty.call(this.core.mediaControl, '$multiCameraSelector') &&
|
|
174
|
+
this.core.mediaControl.$multiCameraSelector.find('span.multicamera-icon').length > 0
|
|
175
|
+
) {
|
|
176
|
+
if (~window.location.href.indexOf('whitenights.gcdn.co')) {
|
|
177
|
+
this.core.mediaControl.$multiCameraSelector.find('span.multicamera-icon').append(streamsWhiteNightsIcon);
|
|
178
|
+
} else if (~window.location.href.indexOf('momentosolutions.gcdn.co')) {
|
|
179
|
+
this.core.mediaControl.$multiCameraSelector.find('span.multicamera-icon').append(streamsMomentoIcon);
|
|
180
|
+
} else {
|
|
181
|
+
this.core.mediaControl.$multiCameraSelector.find('span.multicamera-icon').append(streamsIcon);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
this.highlightCurrentLevel();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return this;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private onCameraSelect(event: MouseEvent) {
|
|
191
|
+
const value = (event.currentTarget as HTMLElement).dataset.multicameraSelectorSelect;
|
|
192
|
+
trace(`${T} onCameraSelect ${value}`);
|
|
193
|
+
if (value !== undefined) {
|
|
194
|
+
this.changeById(parseInt(value, 10));
|
|
195
|
+
}
|
|
196
|
+
event.stopPropagation();
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
activeById(id: number, active: boolean) {
|
|
201
|
+
this.setLiveStatus(id, active);
|
|
202
|
+
|
|
203
|
+
if (!this.currentCamera && !this.noActiveStreams) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (this.noActiveStreams && !active) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (this.currentCamera) {
|
|
211
|
+
if (this.options.multisourcesMode === "only_live") {
|
|
212
|
+
this.behaviorLive(id, active);
|
|
213
|
+
}
|
|
214
|
+
if (this.options.multisourcesMode === "one_first") {
|
|
215
|
+
this.behaviorOne(id, active);
|
|
216
|
+
}
|
|
217
|
+
if (this.options.multisourcesMode === "show_all") {
|
|
218
|
+
this.behaviorAll(id, active);
|
|
219
|
+
}
|
|
220
|
+
} else {
|
|
221
|
+
if (this.noActiveStreams && active) {
|
|
222
|
+
this.changeById(id);
|
|
223
|
+
this.noActiveStreams = false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
this.render();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
setLiveStatus(id: number, active: boolean) {
|
|
231
|
+
try {
|
|
232
|
+
const index = this.findIndexById(id);
|
|
233
|
+
if (index < 0) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
this.multicamera[index].live = active;
|
|
237
|
+
if (this.levelElement(id).length) {
|
|
238
|
+
this.levelElement(id)[0].dataset.multicameraSelectorLive = active;
|
|
239
|
+
}
|
|
240
|
+
} catch (error) {
|
|
241
|
+
reportError(error);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private behaviorLive(id: number, active: boolean) {
|
|
246
|
+
try {
|
|
247
|
+
if (active) {
|
|
248
|
+
this.levelElement(id).parent().show();
|
|
249
|
+
} else {
|
|
250
|
+
this.levelElement(id).parent().hide();
|
|
251
|
+
}
|
|
252
|
+
} catch (error) {
|
|
253
|
+
reportError(error);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
this.findAndInitNextStream(id, active);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
private behaviorOne(id: number, active: boolean) {
|
|
261
|
+
this.$el.hide();
|
|
262
|
+
this.findAndInitNextStream(id, active);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
private behaviorAll(id: number, active: boolean) {
|
|
266
|
+
if (this.currentCamera?.id === id) {
|
|
267
|
+
if (active) {
|
|
268
|
+
this.hideError();
|
|
269
|
+
this.changeById(id);
|
|
270
|
+
} else {
|
|
271
|
+
this.showError();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
private findAndInitNextStream(id: number, active: boolean) {
|
|
277
|
+
if (active || this.currentCamera?.id !== id) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const current = this.findIndexById(id);
|
|
282
|
+
let counter = 1;
|
|
283
|
+
|
|
284
|
+
while (counter < this.multicamera.length) {
|
|
285
|
+
const changeIndex = (counter + current) % this.multicamera.length;
|
|
286
|
+
if (this.multicamera[changeIndex].live) {
|
|
287
|
+
this.changeById(this.multicamera[changeIndex].id);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
counter++;
|
|
291
|
+
}
|
|
292
|
+
this.currentCamera = null;
|
|
293
|
+
this.noActiveStreams = true;
|
|
294
|
+
this.core.trigger('core:multicamera:no_active_translation');
|
|
295
|
+
// this.changeById(this.multicamera[nextIndex].id);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
private showError() {
|
|
299
|
+
this.core.activePlayback.pause();
|
|
300
|
+
setTimeout(() => {
|
|
301
|
+
this.core.activePlayback.destroy();
|
|
302
|
+
}, 0);
|
|
303
|
+
try {
|
|
304
|
+
this.core.mediaControl.disabledControlButton();
|
|
305
|
+
} catch (error) {
|
|
306
|
+
reportError(error);
|
|
307
|
+
}
|
|
308
|
+
this.core.getPlugin('error_gplayer')?.show({
|
|
309
|
+
title: this.core.i18n.t('source_offline'),
|
|
310
|
+
message: '',
|
|
311
|
+
code: '',
|
|
312
|
+
icon: '',
|
|
313
|
+
reloadIcon: '',
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
private hideError() {
|
|
318
|
+
try {
|
|
319
|
+
this.core.mediaControl.enableControlButton();
|
|
320
|
+
} catch (error) {
|
|
321
|
+
reportError(error);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
private changeById(id: number) {
|
|
326
|
+
trace(`${T} changeById`, { id });
|
|
327
|
+
queueMicrotask(() => {
|
|
328
|
+
const playbackOptions = this.core.options.playback || {};
|
|
329
|
+
|
|
330
|
+
// TODO figure out what this does
|
|
331
|
+
playbackOptions.recycleVideo = Browser.isMobile;
|
|
332
|
+
this.currentCamera = this.findElementById(id) ?? null;
|
|
333
|
+
trace(`${T} changeById`, { id, currentCamera: this.currentCamera, multicamera: this.multicamera });
|
|
334
|
+
|
|
335
|
+
if (!this.currentCamera) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
this.currentTime = 0;
|
|
339
|
+
try {
|
|
340
|
+
this.currentTime = this.core.activePlayback.getCurrentTime();
|
|
341
|
+
this.highlightCurrentLevel();
|
|
342
|
+
this.core.activePlayback.destroy();
|
|
343
|
+
} catch (error) {
|
|
344
|
+
reportError(error);
|
|
345
|
+
}
|
|
346
|
+
const fullscreenDisable = !!(Browser.isiOS && this.currentCamera.projection);
|
|
347
|
+
|
|
348
|
+
// TODO remove?
|
|
349
|
+
// for html5 playback:
|
|
350
|
+
this.options.dvrEnabled = this.currentCamera.dvr;
|
|
351
|
+
|
|
352
|
+
trace(`${T} changeById`, { currentCamera: this.currentCamera });
|
|
353
|
+
// TODO
|
|
354
|
+
this.core.configure({
|
|
355
|
+
playback: playbackOptions,
|
|
356
|
+
source: this.currentCamera.source, // TODO ensure that the preferred transport is used
|
|
357
|
+
video360: { // TODO
|
|
358
|
+
projection: this.currentCamera.projection,
|
|
359
|
+
},
|
|
360
|
+
fullscreenDisable,
|
|
361
|
+
autoPlay: this.playing,
|
|
362
|
+
disableCanAutoPlay: true
|
|
363
|
+
});
|
|
364
|
+
this.core.activeContainer.mediaControlDisabled = false;
|
|
365
|
+
});
|
|
366
|
+
this.toggleContextMenu();
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
getCamerasList() {
|
|
370
|
+
return this.multicamera;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
getCurrentCamera() {
|
|
374
|
+
return this.currentCamera;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
private findElementById(id: number): GcoreStreamMediaSource | undefined {
|
|
378
|
+
return this.multicamera.find((element) => element.id === id);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
private findIndexById(id: number): number {
|
|
382
|
+
return this.multicamera.findIndex((element) => element.id === id);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
private onShowLevelSelectMenu() {
|
|
386
|
+
this.toggleContextMenu();
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
private hideSelectLevelMenu() {
|
|
390
|
+
(this.$('.multicamera ul') as ZeptoResult).hide();
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
private toggleContextMenu() {
|
|
394
|
+
(this.$('.multicamera ul') as ZeptoResult).toggle();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// private buttonElement(): ZeptoResult {
|
|
398
|
+
// return this.$('.multicamera button');
|
|
399
|
+
// }
|
|
400
|
+
|
|
401
|
+
// private buttonElementText(): ZeptoResult {
|
|
402
|
+
// return this.$('.multicamera button .quality-text');
|
|
403
|
+
// }
|
|
404
|
+
|
|
405
|
+
private levelElement(id?: number): ZeptoResult {
|
|
406
|
+
return this.$('.multicamera ul li > div' + (id !== undefined ? '[data-multicamera-selector-select="' + id + '"]' : ''));
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
private highlightCurrentLevel() {
|
|
410
|
+
this.levelElement().removeClass('current');
|
|
411
|
+
this.levelElement().removeClass('multicamera-active');
|
|
412
|
+
this.currentCamera && this.levelElement(this.currentCamera.id).addClass('multicamera-active');
|
|
413
|
+
}
|
|
414
|
+
}
|