@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,370 @@
|
|
|
1
|
+
import { Events, UICorePlugin, template } from '@clappr/core';
|
|
2
|
+
import {
|
|
3
|
+
AudioTrackLoadedData,
|
|
4
|
+
AudioTrackSwitchedData,
|
|
5
|
+
AudioTracksUpdatedData,
|
|
6
|
+
Events as HlsEvents,
|
|
7
|
+
} from 'hls.js';
|
|
8
|
+
|
|
9
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
10
|
+
|
|
11
|
+
import pluginHtml from '../../../assets/audio-selector/track-selector.ejs';
|
|
12
|
+
import '../../../assets/audio-selector/style.scss';
|
|
13
|
+
import audioArrow from '../../../assets/icons/old/quality-arrow.svg';
|
|
14
|
+
import { ZeptoResult } from '../types';
|
|
15
|
+
|
|
16
|
+
const VERSION: string = '0.0.1';
|
|
17
|
+
|
|
18
|
+
// const T = 'plugins.audio_selector';
|
|
19
|
+
|
|
20
|
+
const AUTO = 0;
|
|
21
|
+
|
|
22
|
+
type AudioTrackW3C = {
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
id: string;
|
|
25
|
+
kind: string
|
|
26
|
+
label: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type AudioTrackItem = {
|
|
30
|
+
id: number;
|
|
31
|
+
label: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type AudioTrackList = {
|
|
35
|
+
length: number;
|
|
36
|
+
addEventListener(type: 'change' | 'addtrack' | 'removetrack', listener: EventListenerOrEventListenerObject): void;
|
|
37
|
+
getTrackById(id: string): AudioTrackW3C | null;
|
|
38
|
+
[Symbol.iterator](): IterableIterator<AudioTrackW3C>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class AudioSelector extends UICorePlugin {
|
|
42
|
+
private selectedTrackId: number | undefined;
|
|
43
|
+
|
|
44
|
+
private currentTrack: AudioTrackItem | null = null;
|
|
45
|
+
|
|
46
|
+
private tracks: AudioTrackItem[] = [];
|
|
47
|
+
|
|
48
|
+
get name() {
|
|
49
|
+
return 'audio_selector';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get supportedVersion() {
|
|
53
|
+
return { min: CLAPPR_VERSION };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static get version() {
|
|
57
|
+
return VERSION;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
get template() {
|
|
61
|
+
return template(pluginHtml);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
override get attributes() {
|
|
65
|
+
return {
|
|
66
|
+
'class': this.name,
|
|
67
|
+
'data-track-selector': ''
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
override get events() {
|
|
72
|
+
return {
|
|
73
|
+
'click [data-track-selector-select]': 'onTrackSelect',
|
|
74
|
+
'click [data-track-selector-button]': 'onShowLevelSelectMenu'
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
override bindEvents() {
|
|
79
|
+
this.listenTo(this.core, Events.CORE_READY, this.bindPlaybackEvents);
|
|
80
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
81
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.render);
|
|
82
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_HIDE, this.hideSelectTrackMenu);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
unBindEvents() {
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
this.stopListening(this.core, Events.CORE_READY);
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED);
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_RENDERED);
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_HIDE);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private bindPlaybackEvents() {
|
|
97
|
+
// this.currentTrack = {};
|
|
98
|
+
// this.removeAuto = false;
|
|
99
|
+
this.selectedTrackId = undefined;
|
|
100
|
+
const currentPlayback = this.core.activePlayback;
|
|
101
|
+
|
|
102
|
+
this.listenTo(currentPlayback, Events.PLAYBACK_STOP, this.onStop);
|
|
103
|
+
this.setupAudioTrackListeners();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private setupAudioTrackListeners() {
|
|
107
|
+
const currentPlayback = this.core.activePlayback;
|
|
108
|
+
|
|
109
|
+
// TODO no-crutch:currentPlayback._hls
|
|
110
|
+
if (currentPlayback._hls) {
|
|
111
|
+
// TODO AUDIO_TRACKS_UPDATED
|
|
112
|
+
// currentPlayback._hls.on('hlsAudioTracksUpdated', (e, data) => {
|
|
113
|
+
currentPlayback._hls.on(HlsEvents.AUDIO_TRACKS_UPDATED, (e: HlsEvents.AUDIO_TRACKS_UPDATED, data: AudioTracksUpdatedData) => {
|
|
114
|
+
// let id = -1;
|
|
115
|
+
// for (const audioTrack of data.audioTracks) {
|
|
116
|
+
// if (audioTrack.default) {
|
|
117
|
+
// id = audioTrack.id;
|
|
118
|
+
// this.currentTrack = audioTrack;
|
|
119
|
+
// }
|
|
120
|
+
// }
|
|
121
|
+
const defaultTrack = data.audioTracks.find((track) => track.default);
|
|
122
|
+
if (defaultTrack) {
|
|
123
|
+
this.currentTrack = {
|
|
124
|
+
id: defaultTrack.id,
|
|
125
|
+
label: defaultTrack.name
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
this.fillTracks(data.audioTracks.map(p => ({
|
|
129
|
+
id: p.id,
|
|
130
|
+
label: p.name
|
|
131
|
+
})), defaultTrack?.id);
|
|
132
|
+
});
|
|
133
|
+
currentPlayback._hls.on(HlsEvents.AUDIO_TRACK_SWITCHING, this.startTrackSwitch.bind(this));
|
|
134
|
+
currentPlayback._hls.on(HlsEvents.AUDIO_TRACK_SWITCHED, this.updateCurrentTrack.bind(this));
|
|
135
|
+
currentPlayback._hls.on(HlsEvents.AUDIO_TRACK_LOADED, this.updateCurrentTrack.bind(this));
|
|
136
|
+
} else {
|
|
137
|
+
this.listenToOnce(currentPlayback, Events.PLAYBACK_PLAY, () => {
|
|
138
|
+
const mediaElement = currentPlayback.$el.get(0);
|
|
139
|
+
// const { audioTracks } = currentPlayback.$el.get(0);
|
|
140
|
+
const audioTracks: AudioTrackList = mediaElement.audioTracks;
|
|
141
|
+
|
|
142
|
+
if (audioTracks && audioTracks.length) {
|
|
143
|
+
let index = 0;
|
|
144
|
+
const trackItems: AudioTrackItem[] = [];
|
|
145
|
+
for (const audioTrack of audioTracks) {
|
|
146
|
+
if (audioTrack.enabled) {
|
|
147
|
+
const t = {
|
|
148
|
+
id: index,
|
|
149
|
+
label: audioTrack.label,
|
|
150
|
+
};
|
|
151
|
+
this.currentTrack = t;
|
|
152
|
+
trackItems.push(t);
|
|
153
|
+
index++;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
audioTracks.addEventListener('change', () => this.updateCurrentTrackW3C());
|
|
158
|
+
|
|
159
|
+
this.fillTracks(trackItems, trackItems[0].id);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private onStop() { }
|
|
166
|
+
|
|
167
|
+
reload() {
|
|
168
|
+
this.unBindEvents();
|
|
169
|
+
this.bindEvents();
|
|
170
|
+
this.bindPlaybackEvents();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private shouldRender() {
|
|
174
|
+
if (!this.core.activeContainer) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const currentPlayback = this.core.activePlayback;
|
|
179
|
+
|
|
180
|
+
if (!currentPlayback) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const { audioTracks } = (currentPlayback.activePlayback._hls || currentPlayback.$el.get(0));
|
|
185
|
+
|
|
186
|
+
this.tracks = audioTracks;
|
|
187
|
+
|
|
188
|
+
// Only care if we have at least 2 to choose from
|
|
189
|
+
return this.tracks && this.tracks.length > 1;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
override render() {
|
|
193
|
+
if (this.shouldRender()) {
|
|
194
|
+
this.$el.html(this.template({ 'tracks': this.tracks, 'title': this.getTitle() }));
|
|
195
|
+
|
|
196
|
+
if (
|
|
197
|
+
Object.prototype.hasOwnProperty.call(this.core.mediaControl, '$audioTracksSelector') &&
|
|
198
|
+
this.core.mediaControl.$audioTracksSelector.length > 0
|
|
199
|
+
) {
|
|
200
|
+
this.core.mediaControl.$audioTracksSelector.append(this.el);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
this.highlightCurrentTrack();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (
|
|
207
|
+
Object.prototype.hasOwnProperty.call(this.core.mediaControl, '$audioTracksSelector') &&
|
|
208
|
+
this.core.mediaControl.$audioTracksSelector.find('span.audio-arrow').length > 0
|
|
209
|
+
) {
|
|
210
|
+
this.core.mediaControl.$audioTracksSelector.find('span.audio-arrow').append(audioArrow);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return this;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
private fillTracks(tracks: AudioTrackItem[], selected = AUTO) {
|
|
217
|
+
if (this.selectedTrackId === undefined) {
|
|
218
|
+
this.selectedTrackId = selected;
|
|
219
|
+
}
|
|
220
|
+
// this.tracks = levels.audioTracks;
|
|
221
|
+
// for (let i = 0; i < this.tracks.length; i++) {
|
|
222
|
+
// if (this.tracks[i].name && !this.tracks[i].label) {
|
|
223
|
+
// this.tracks[i].label = this.tracks[i].name;
|
|
224
|
+
// }
|
|
225
|
+
// }
|
|
226
|
+
this.tracks = tracks;
|
|
227
|
+
|
|
228
|
+
// Player.player.trigger('tracks', this.tracks);
|
|
229
|
+
// this.core.trigger('tracks', this.tracks);
|
|
230
|
+
this.render();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private findTrackBy(id: number) {
|
|
234
|
+
return this.tracks.find((track) => track.id === id);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private onTrackSelect(event: MouseEvent) {
|
|
238
|
+
// this.selectedTrackId = parseInt(event.target.dataset.levelSelectorSelect, 10)
|
|
239
|
+
const id = (event.target as HTMLElement)?.dataset?.trackSelectorSelect;
|
|
240
|
+
if (id) {
|
|
241
|
+
this.setIndexTrack(Number(id));
|
|
242
|
+
}
|
|
243
|
+
this.toggleContextMenu();
|
|
244
|
+
event.stopPropagation();
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
private setIndexTrack(index: number) {
|
|
249
|
+
this.selectedTrackId = index;
|
|
250
|
+
if (this.core.activePlayback._hls) {
|
|
251
|
+
if (this.core.activePlayback._hls.audioTrack.id === this.selectedTrackId) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
this.core.activePlayback._hls.audioTrack = this.selectedTrackId;
|
|
255
|
+
} else {
|
|
256
|
+
const { audioTracks } = this.core.activePlayback.$el.get(0);
|
|
257
|
+
|
|
258
|
+
for (const track of audioTracks) {
|
|
259
|
+
track.enabled = track.id === this.selectedTrackId;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
this.updateText(this.selectedTrackId);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
onShowLevelSelectMenu() {
|
|
266
|
+
this.toggleContextMenu();
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
hideSelectTrackMenu() {
|
|
270
|
+
(this.$('.audio_selector ul') as ZeptoResult).hide();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
toggleContextMenu() {
|
|
274
|
+
(this.$('.audio_selector ul') as ZeptoResult).toggle();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
private buttonElement(): ZeptoResult {
|
|
278
|
+
return this.$('.audio_selector button');
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
private buttonElementText(): ZeptoResult {
|
|
282
|
+
return this.$('.audio_selector button .audio-text');
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
private trackElement(id?: number): ZeptoResult {
|
|
286
|
+
return (this.$('.audio_selector ul a' + (id !== undefined ? '[data-track-selector-select="' + id + '"]' : '')) as ZeptoResult).parent();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
private getTitle(): string {
|
|
290
|
+
if (!this.tracks) {
|
|
291
|
+
return '';
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const selectedTrackId = this.selectedTrackId || 0;
|
|
295
|
+
|
|
296
|
+
const selectedTrack = this.tracks[selectedTrackId];
|
|
297
|
+
|
|
298
|
+
return selectedTrack?.label || '';
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
startTrackSwitch() {
|
|
302
|
+
this.buttonElement().addClass('changing');
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
private updateText(trackId: number | undefined) {
|
|
306
|
+
if (trackId === undefined) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const track = this.findTrackBy(trackId);
|
|
311
|
+
|
|
312
|
+
if (track) {
|
|
313
|
+
this.buttonElementText().text(track.label);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
updateCurrentTrack(e: HlsEvents.AUDIO_TRACK_SWITCHED, info: AudioTrackSwitchedData | AudioTrackLoadedData) {
|
|
318
|
+
// if (!info) {
|
|
319
|
+
// const { audioTracks } = this.core.activePlayback.$el.get(0);
|
|
320
|
+
|
|
321
|
+
// for (const track of audioTracks) {
|
|
322
|
+
// if (track.enabled) {
|
|
323
|
+
// info = track;
|
|
324
|
+
// }
|
|
325
|
+
// }
|
|
326
|
+
// }
|
|
327
|
+
// if (!info) {
|
|
328
|
+
// return;
|
|
329
|
+
// }
|
|
330
|
+
|
|
331
|
+
// const track = this.findTrackBy(info.id);
|
|
332
|
+
|
|
333
|
+
// this.currentTrack = track ? track : null;
|
|
334
|
+
// this.selectedTrackId = track?.id;
|
|
335
|
+
// this.highlightCurrentTrack();
|
|
336
|
+
// this.buttonElement().removeClass('changing');
|
|
337
|
+
this.setCurrentTrack(info.id);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
private updateCurrentTrackW3C() {
|
|
341
|
+
const { audioTracks } = this.core.activePlayback.$el.get(0);
|
|
342
|
+
const index = audioTracks.findIndex((track: AudioTrackW3C) => track.enabled);
|
|
343
|
+
if (index >= 0) {
|
|
344
|
+
this.setCurrentTrack(index)
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
private setCurrentTrack(index: number) {
|
|
349
|
+
const track = this.findTrackBy(index);
|
|
350
|
+
|
|
351
|
+
this.currentTrack = track ?? null;
|
|
352
|
+
this.selectedTrackId = index;
|
|
353
|
+
this.highlightCurrentTrack();
|
|
354
|
+
this.buttonElement().removeClass('changing');
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
highlightCurrentTrack() {
|
|
358
|
+
this.trackElement().removeClass('current');
|
|
359
|
+
this.trackElement().find('a').removeClass('gcore-skin-active');
|
|
360
|
+
|
|
361
|
+
if (this.currentTrack) {
|
|
362
|
+
const currentTrackElement = this.trackElement(this.currentTrack.id);
|
|
363
|
+
|
|
364
|
+
currentTrackElement.addClass('current');
|
|
365
|
+
currentTrackElement.find('a').addClass('gcore-skin-active');
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
this.updateText(this.selectedTrackId);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { Events, template, UICorePlugin, Utils } from '@clappr/core';
|
|
2
|
+
import { trace } from '@gcorevideo/utils';
|
|
3
|
+
|
|
4
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
5
|
+
import { ZeptoResult } from "../types.js";
|
|
6
|
+
|
|
7
|
+
import volumeMuteIcon from '../../../assets/icons/new/volume-off.svg';
|
|
8
|
+
import pluginHtml from '../../../assets/big-mute-button/big-mute-button.ejs';
|
|
9
|
+
import '../../../assets/big-mute-button/big-mute-button.scss';
|
|
10
|
+
|
|
11
|
+
const T = "plugins.big_mute_button";
|
|
12
|
+
|
|
13
|
+
export class BigMuteButton extends UICorePlugin {
|
|
14
|
+
private isBigMuteButtonHidden = false;
|
|
15
|
+
|
|
16
|
+
private _adIsPlaying = false;
|
|
17
|
+
|
|
18
|
+
private $bigMuteBtnContainer: ZeptoResult | null = null;
|
|
19
|
+
|
|
20
|
+
private $bigMuteButton: ZeptoResult | null = null;
|
|
21
|
+
|
|
22
|
+
get name() {
|
|
23
|
+
return 'big_mute_button';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get supportedVersion() {
|
|
27
|
+
return { min: CLAPPR_VERSION };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get template() {
|
|
31
|
+
return template(pluginHtml);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override get events() {
|
|
35
|
+
return {
|
|
36
|
+
'click .big-mute-icon': 'handleBigMuteBtnClick',
|
|
37
|
+
'click .big-mute-icon-wrapper': 'destroyBigMuteBtn',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override bindEvents() {
|
|
42
|
+
super.bindEvents();
|
|
43
|
+
this.listenTo(this.core, Events.CORE_READY, this.onCoreReady);
|
|
44
|
+
this.listenTo(this.core, 'core:advertisement:start', this.onStartAd);
|
|
45
|
+
this.listenTo(this.core, 'core:advertisement:finish', this.onFinishAd);
|
|
46
|
+
trace(`${T} bindEvents`, {
|
|
47
|
+
mediacontrol: !!this.core.mediaControl,
|
|
48
|
+
});
|
|
49
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.mediaControlRendered);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
unBindEvents() {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
this.stopListening(this.core, Events.CORE_READY);
|
|
55
|
+
this.stopListening(this.core, 'core:advertisement:start', this.onStartAd);
|
|
56
|
+
this.stopListening(this.core, 'core:advertisement:finish', this.onFinishAd);
|
|
57
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.mediaControlRendered);
|
|
58
|
+
|
|
59
|
+
const container = this.core.activeContainer;
|
|
60
|
+
|
|
61
|
+
if (container) {
|
|
62
|
+
this.stopListening(container.playback, Events.PLAYBACK_PLAY, this.render);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private onCoreReady() {
|
|
67
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_VOLUME, this.onContainerVolume);
|
|
68
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_READY, this.onContainerStart);
|
|
69
|
+
this.listenTo(this.core.activePlayback, Events.PLAYBACK_ENDED, this.onPlaybackEnded);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private onContainerVolume(value: number) {
|
|
73
|
+
if (value !== 0) {
|
|
74
|
+
this.destroyBigMuteBtn();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private onContainerStart() {
|
|
79
|
+
if (this.isBigMuteButtonHidden) {
|
|
80
|
+
this.showBigMuteBtn();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private onPlaybackEnded() {
|
|
85
|
+
this.hideBigMuteBtn();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private mediaControlRendered() {
|
|
89
|
+
const container = this.core.activeContainer;
|
|
90
|
+
|
|
91
|
+
trace(`${T} mediaControlRendered`, {
|
|
92
|
+
container: !!container,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
if (container) {
|
|
96
|
+
this.listenTo(container.playback, Events.PLAYBACK_PLAY, () => {
|
|
97
|
+
trace(`${T} PLAYBACK_PLAY`);
|
|
98
|
+
this.render();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private onStartAd() {
|
|
104
|
+
this._adIsPlaying = true;
|
|
105
|
+
if (this.$bigMuteBtnContainer) {
|
|
106
|
+
this.$bigMuteBtnContainer.addClass('hide');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private onFinishAd() {
|
|
111
|
+
this._adIsPlaying = false;
|
|
112
|
+
if (this.$bigMuteBtnContainer) {
|
|
113
|
+
this.$bigMuteBtnContainer.removeClass('hide');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private shouldRender() {
|
|
118
|
+
const container = this.core.activeContainer;
|
|
119
|
+
|
|
120
|
+
if (!container) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const { autoPlay, wasMuted } = this.options;
|
|
125
|
+
const volume = container.volume;
|
|
126
|
+
|
|
127
|
+
trace(`${T} shouldRender`, {
|
|
128
|
+
autoPlay,
|
|
129
|
+
wasMuted,
|
|
130
|
+
volume,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return autoPlay && !wasMuted && volume === 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
override render() {
|
|
137
|
+
if (this.shouldRender()) {
|
|
138
|
+
trace(`${T} render`, {
|
|
139
|
+
el: !!this.$el,
|
|
140
|
+
});
|
|
141
|
+
this.$el.html(this.template());
|
|
142
|
+
|
|
143
|
+
this.$bigMuteBtnContainer = this.$el.find('.big-mute-icon-wrapper[data-big-mute]');
|
|
144
|
+
this._adIsPlaying && this.$bigMuteBtnContainer.addClass('hide');
|
|
145
|
+
|
|
146
|
+
this.$bigMuteButton = this.$bigMuteBtnContainer.find('.big-mute-icon');
|
|
147
|
+
this.$bigMuteButton.append(volumeMuteIcon);
|
|
148
|
+
|
|
149
|
+
const container = this.core.activeContainer;
|
|
150
|
+
|
|
151
|
+
container.$el.append(this.$el.get(0));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
private hideBigMuteBtn() {
|
|
158
|
+
this.isBigMuteButtonHidden = true;
|
|
159
|
+
this.$bigMuteBtnContainer?.addClass('hide');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private showBigMuteBtn() {
|
|
163
|
+
this.isBigMuteButtonHidden = false;
|
|
164
|
+
if (this.$bigMuteBtnContainer) {
|
|
165
|
+
this.$bigMuteBtnContainer.removeClass('hide');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private destroyBigMuteBtn(e?: MouseEvent) {
|
|
170
|
+
this.hideBigMuteBtn();
|
|
171
|
+
|
|
172
|
+
if (e && e.stopPropagation) {
|
|
173
|
+
e.stopPropagation();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
this.destroy();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private handleBigMuteBtnClick(e: MouseEvent) {
|
|
180
|
+
const localVolume = Utils.Config.restore('volume');
|
|
181
|
+
const volume = !isNaN(localVolume) ? localVolume : 100;
|
|
182
|
+
|
|
183
|
+
this.core.mediaControl.setVolume(volume === 0 ? 100 : volume);
|
|
184
|
+
|
|
185
|
+
this.destroyBigMuteBtn(e);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { UICorePlugin, template, Events } from '@clappr/core';
|
|
2
|
+
import { trace } from '@gcorevideo/utils';
|
|
3
|
+
|
|
4
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
5
|
+
|
|
6
|
+
import pluginHtml from '../../../assets/bottom-gear/bottomgear.ejs';
|
|
7
|
+
import '../../../assets/bottom-gear/gear.scss';
|
|
8
|
+
import '../../../assets/bottom-gear/gear-sub-menu.scss';
|
|
9
|
+
import gearIcon from '../../../assets/icons/new/gear.svg';
|
|
10
|
+
import gearHdIcon from '../../../assets/icons/new/gear-hd.svg';
|
|
11
|
+
|
|
12
|
+
const VERSION = '0.0.1';
|
|
13
|
+
|
|
14
|
+
export class BottomGear extends UICorePlugin {
|
|
15
|
+
private isHd = false;
|
|
16
|
+
|
|
17
|
+
get name() {
|
|
18
|
+
return 'gear';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get supportedVersion() {
|
|
22
|
+
return { min: CLAPPR_VERSION };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static get version() {
|
|
26
|
+
return VERSION;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get template() {
|
|
30
|
+
return template(pluginHtml);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override get attributes() {
|
|
34
|
+
return {
|
|
35
|
+
'class': this.name,
|
|
36
|
+
'data-track-selector': ''
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override get events() {
|
|
41
|
+
return {
|
|
42
|
+
'click .button-gear': 'toggleGearMenu',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get container() {
|
|
47
|
+
return this.core && this.core.activeContainer;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override bindEvents() {
|
|
51
|
+
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
|
|
52
|
+
this.listenTo(this.core, 'gear:refresh', this.refresh);
|
|
53
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
54
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.render);
|
|
55
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_HIDE, this.hide);
|
|
56
|
+
this.bindContainerEvents();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
unBindEvents() {
|
|
60
|
+
this.stopListening(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged);
|
|
61
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
62
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.render);
|
|
63
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_HIDE, this.hide);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private onActiveContainerChanged() {
|
|
67
|
+
this.bindEvents();
|
|
68
|
+
this.bindContainerEvents();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private bindContainerEvents() {
|
|
72
|
+
if (!this.container) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.listenTo(this.container, Events.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
reload() {
|
|
79
|
+
this.unBindEvents();
|
|
80
|
+
this.bindEvents();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private highDefinitionUpdate(isHd: boolean) {
|
|
84
|
+
trace(`${this.name} highDefinitionUpdate`, { isHd });
|
|
85
|
+
this.isHd = isHd;
|
|
86
|
+
if (isHd) {
|
|
87
|
+
this.$el.find('.gear-icon').html(gearHdIcon);
|
|
88
|
+
} else {
|
|
89
|
+
this.$el.find('.gear-icon').html(gearIcon);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
override render() {
|
|
94
|
+
const items = [
|
|
95
|
+
'quality',
|
|
96
|
+
'rate',
|
|
97
|
+
'nerd',
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
const icon = this.isHd ? gearHdIcon : gearIcon;
|
|
101
|
+
|
|
102
|
+
this.$el.html(this.template({ icon, items }));
|
|
103
|
+
|
|
104
|
+
this.core.mediaControl.$bottomGear?.html(this.el);
|
|
105
|
+
this.core.trigger('gear:rendered');
|
|
106
|
+
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
refresh() {
|
|
111
|
+
this.render();
|
|
112
|
+
this.$el.find('.gear-wrapper').show();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
toggleGearMenu() {
|
|
116
|
+
this.$el.find('.gear-wrapper').toggle();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
hide() {
|
|
120
|
+
this.$el.find('.gear-wrapper').hide();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CLAPPR_VERSION: string = '0.11.3';
|