@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,269 @@
|
|
|
1
|
+
import { Events, UICorePlugin, Playback, template } from '@clappr/core';
|
|
2
|
+
|
|
3
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
4
|
+
import type { ZeptoResult } from '../types';
|
|
5
|
+
|
|
6
|
+
import pluginHtml from '../../../assets/playback-rate/playback-rate-selector.ejs';
|
|
7
|
+
import buttonHtml from '../../../assets/playback-rate/button.ejs';
|
|
8
|
+
import listHtml from '../../../assets/playback-rate/list.ejs';
|
|
9
|
+
import speedIcon from '../../../assets/icons/new/speed.svg';
|
|
10
|
+
import arrowRightIcon from '../../../assets/icons/new/arrow-right.svg';
|
|
11
|
+
import arrowLeftIcon from '../../../assets/icons/new/arrow-left.svg';
|
|
12
|
+
import checkIcon from '../../../assets/icons/new/check.svg';
|
|
13
|
+
|
|
14
|
+
type PlaybackRateOption = {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const DEFAULT_PLAYBACK_RATES = [
|
|
20
|
+
{ value: '0.5', label: '0.5x' },
|
|
21
|
+
{ value: '0.75', label: '0.75x' },
|
|
22
|
+
{ value: '1.0', label: '1x' },
|
|
23
|
+
{ value: '1.25', label: '1.25x' },
|
|
24
|
+
{ value: '1.5', label: '1.5x' },
|
|
25
|
+
{ value: '1.75', label: '1.75x' },
|
|
26
|
+
{ value: '2.0', label: '2x' }
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const DEFAULT_PLAYBACK_RATE = '1.0';
|
|
30
|
+
|
|
31
|
+
const MEDIACONTROL_PLAYBACKRATE = 'playbackRate';
|
|
32
|
+
|
|
33
|
+
export class PlaybackRate extends UICorePlugin {
|
|
34
|
+
private currentPlayback: Playback | null = null;
|
|
35
|
+
|
|
36
|
+
private playbackRates: PlaybackRateOption[] = DEFAULT_PLAYBACK_RATES;
|
|
37
|
+
|
|
38
|
+
private prevSelectedRate: string | undefined;
|
|
39
|
+
|
|
40
|
+
private selectedRate: string = DEFAULT_PLAYBACK_RATE;
|
|
41
|
+
|
|
42
|
+
get name() {
|
|
43
|
+
return 'playback_rate';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get supportedVersion() {
|
|
47
|
+
return { min: CLAPPR_VERSION };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get template() {
|
|
51
|
+
return template(pluginHtml);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override get attributes() {
|
|
55
|
+
return {
|
|
56
|
+
'class': this.name,
|
|
57
|
+
'data-playback-rate-select': ''
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override get events() {
|
|
62
|
+
return {
|
|
63
|
+
'click .gear-sub-menu_btn': 'onRateSelect',
|
|
64
|
+
'click .gear-option': 'onShowMenu',
|
|
65
|
+
'click .go-back': 'goBack',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
override bindEvents() {
|
|
70
|
+
this.listenTo(this.core, 'gear:rendered', this.render);
|
|
71
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
72
|
+
this.listenTo(this.core.mediaControl, MEDIACONTROL_PLAYBACKRATE, this.updatePlaybackRate);
|
|
73
|
+
|
|
74
|
+
this.listenTo(this.core, 'core:advertisement:start', this.onStartAd);
|
|
75
|
+
this.listenTo(this.core, 'core:advertisement:finish', this.onFinishAd);
|
|
76
|
+
if (this.core.activeContainer) {
|
|
77
|
+
this.listenTo(this.core.activePlayback, Events.PLAYBACK_BUFFERFULL, this.updateLiveStatus);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (this.currentPlayback) {
|
|
81
|
+
this.listenTo(this.currentPlayback, Events.PLAYBACK_STOP, this.onStop);
|
|
82
|
+
this.listenTo(this.currentPlayback, Events.PLAYBACK_PLAY, this.onPlay);
|
|
83
|
+
|
|
84
|
+
// TODO import dash playback events
|
|
85
|
+
this.listenTo(this.currentPlayback, 'dash:playback-rate-changed', this.onDashRateChange);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
unBindEvents() {
|
|
90
|
+
this.stopListening(this.core, 'gear:rendered', this.render);
|
|
91
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
92
|
+
this.stopListening(this.core, 'core:advertisement:start', this.onStartAd);
|
|
93
|
+
this.stopListening(this.core, 'core:advertisement:finish', this.onFinishAd);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private allRateElements(): ZeptoResult {
|
|
97
|
+
return this.$('ul.gear-sub-menu li');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private rateElement(rate = "1"): ZeptoResult {
|
|
101
|
+
return (this.$(`ul.gear-sub-menu a[data-rate="${rate}"]`) as ZeptoResult).parent();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private onDashRateChange() {
|
|
105
|
+
// TODO consider removing
|
|
106
|
+
((this.currentPlayback as any)._dash as any)?.setPlaybackRate(this.selectedRate);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private updateLiveStatus() {
|
|
110
|
+
if (this.core.getPlaybackType() === Playback.LIVE) {
|
|
111
|
+
if (this.core.mediaControl.currentSeekBarPercentage <= 98.9) {
|
|
112
|
+
this.core.mediaControl.$playbackRate.removeClass('playbackrate-enable');
|
|
113
|
+
this.core.mediaControl.$el.addClass('dvr');
|
|
114
|
+
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.updatePlaybackRate(DEFAULT_PLAYBACK_RATE);
|
|
118
|
+
this.core.mediaControl.$playbackRate.addClass('playbackrate-enable');
|
|
119
|
+
this.core.mediaControl.$el.removeClass('dvr');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
reload() {
|
|
124
|
+
this.unBindEvents();
|
|
125
|
+
this.bindEvents();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private shouldRender() {
|
|
129
|
+
if (!this.core.activeContainer) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
this.currentPlayback = this.core.activePlayback;
|
|
134
|
+
|
|
135
|
+
return !(this.currentPlayback?.tagName !== 'video' && this.currentPlayback?.tagName !== 'audio');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
override render() {
|
|
139
|
+
const container = this.core.activeContainer;
|
|
140
|
+
|
|
141
|
+
if (this.core.getPlaybackType() === Playback.LIVE && !container.isDvrEnabled()) {
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
const cfg = this.core.options.playbackRateConfig || {};
|
|
145
|
+
|
|
146
|
+
if (!this.playbackRates) {
|
|
147
|
+
this.playbackRates = cfg.options || DEFAULT_PLAYBACK_RATES;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (!this.selectedRate) {
|
|
151
|
+
this.selectedRate = cfg.defaultValue || DEFAULT_PLAYBACK_RATE;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (this.shouldRender()) {
|
|
155
|
+
const t = template(buttonHtml);
|
|
156
|
+
// const html = t({ playbackRates: this.playbackRates, title: this.getTitle() });
|
|
157
|
+
const button = t({
|
|
158
|
+
title: this.getTitle(),
|
|
159
|
+
speedIcon,
|
|
160
|
+
arrowRightIcon,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
this.$el.html(button);
|
|
164
|
+
|
|
165
|
+
// if (this.core.getPlaybackType() === Playback.LIVE) {
|
|
166
|
+
// this.core.mediaControl.$playbackRate.addClass('playbackrate-enable');
|
|
167
|
+
// }
|
|
168
|
+
|
|
169
|
+
// this.core.mediaControl.$playbackRate.append(this.el);
|
|
170
|
+
|
|
171
|
+
this.core.mediaControl.$el?.find('.gear-options-list [data-rate]').html(this.el);
|
|
172
|
+
|
|
173
|
+
// this.updateText();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
onStartAd() {
|
|
180
|
+
this.prevSelectedRate = this.selectedRate;
|
|
181
|
+
this.setSelectedRate('1.0');
|
|
182
|
+
this.listenToOnce(this.currentPlayback, Events.PLAYBACK_PLAY, this.onFinishAd);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
onFinishAd() {
|
|
186
|
+
if (this.prevSelectedRate) {
|
|
187
|
+
this.setSelectedRate(this.prevSelectedRate);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
onPlay() {
|
|
192
|
+
if (!this.core.mediaControl.$el.hasClass('dvr')) {
|
|
193
|
+
if (this.core.getPlaybackType() === Playback.LIVE) {
|
|
194
|
+
this.updatePlaybackRate(DEFAULT_PLAYBACK_RATE);
|
|
195
|
+
this.core.mediaControl.$playbackRate.addClass('playbackrate-enable');
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
this.setSelectedRate(this.selectedRate);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
onStop() {
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
onRateSelect(event: MouseEvent) {
|
|
207
|
+
event.stopPropagation();
|
|
208
|
+
const rate = (event.currentTarget as HTMLElement).dataset.rate;
|
|
209
|
+
if (rate) {
|
|
210
|
+
this.setSelectedRate(rate);
|
|
211
|
+
this.highlightCurrentRate();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
onShowMenu() {
|
|
218
|
+
const t = template(listHtml);
|
|
219
|
+
|
|
220
|
+
this.$el.html(t({
|
|
221
|
+
playbackRates: this.playbackRates,
|
|
222
|
+
arrowLeftIcon,
|
|
223
|
+
checkIcon,
|
|
224
|
+
}));
|
|
225
|
+
|
|
226
|
+
this.core.mediaControl.$el?.find('.gear-wrapper').html(this.el);
|
|
227
|
+
this.highlightCurrentRate();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
goBack() {
|
|
231
|
+
this.core.trigger('gear:refresh');
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
updatePlaybackRate(rate: string) {
|
|
235
|
+
this.setSelectedRate(rate);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
setSelectedRate(rate: string) {
|
|
239
|
+
// Set <video playbackRate="..."
|
|
240
|
+
this.core.$el.find('video,audio').get(0).playbackRate = rate;
|
|
241
|
+
this.selectedRate = rate;
|
|
242
|
+
// TODO
|
|
243
|
+
// Player.player.trigger('playbackRateChanged', rate);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
getTitle() {
|
|
247
|
+
let title = this.selectedRate;
|
|
248
|
+
|
|
249
|
+
this.playbackRates.forEach((r) => {
|
|
250
|
+
if (r.value === this.selectedRate) {
|
|
251
|
+
title = r.label;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
return title;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
highlightCurrentRate() {
|
|
259
|
+
this.allRateElements().removeClass('current');
|
|
260
|
+
this.allRateElements().find('a').removeClass('gcore-skin-active');
|
|
261
|
+
|
|
262
|
+
const currentLevelElement = this.rateElement(this.selectedRate);
|
|
263
|
+
|
|
264
|
+
currentLevelElement.addClass('current');
|
|
265
|
+
currentLevelElement.find('a').addClass('gcore-skin-active');
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// PlaybackRate.MEDIACONTROL_PLAYBACKRATE = 'playbackRate';
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
//Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Events,
|
|
7
|
+
Playback,
|
|
8
|
+
PlayerError,
|
|
9
|
+
UIContainerPlugin,
|
|
10
|
+
template,
|
|
11
|
+
$,
|
|
12
|
+
Container,
|
|
13
|
+
} from '@clappr/core'
|
|
14
|
+
import { trace } from '@gcorevideo/utils'
|
|
15
|
+
|
|
16
|
+
import { CLAPPR_VERSION } from '../build.js'
|
|
17
|
+
import type { ZeptoResult } from '../types.js'
|
|
18
|
+
|
|
19
|
+
import '../../../assets/poster/poster.scss'
|
|
20
|
+
import posterHTML from '../../../assets/poster/poster.ejs'
|
|
21
|
+
import playIcon from '../../../assets/icons/new/play.svg'
|
|
22
|
+
import { PlaybackError } from '../..//playback.types'
|
|
23
|
+
|
|
24
|
+
const T = 'plugins.poster_custom'
|
|
25
|
+
|
|
26
|
+
export class Poster extends UIContainerPlugin {
|
|
27
|
+
private hasFatalError = false
|
|
28
|
+
|
|
29
|
+
private hasStartedPlaying = false
|
|
30
|
+
|
|
31
|
+
private playRequested = false
|
|
32
|
+
|
|
33
|
+
private $playButton: ZeptoResult | null = null
|
|
34
|
+
|
|
35
|
+
private $playWrapper: ZeptoResult | null = null
|
|
36
|
+
|
|
37
|
+
get name() {
|
|
38
|
+
return 'poster_custom'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get supportedVersion() {
|
|
42
|
+
return { min: CLAPPR_VERSION }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get template() {
|
|
46
|
+
return template(posterHTML)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get shouldRender() {
|
|
50
|
+
if (!this.enabled) {
|
|
51
|
+
return false
|
|
52
|
+
}
|
|
53
|
+
// const showOnError = this.options.poster?.showOnError !== false
|
|
54
|
+
trace(`${T} shouldRender`, {
|
|
55
|
+
hasFatalError: this.hasFatalError,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const showForNoOp = !!this.options.poster?.showForNoOp
|
|
59
|
+
return (
|
|
60
|
+
this.container.playback.name !== 'html_img' &&
|
|
61
|
+
(this.container.playback.getPlaybackType() !== Playback.NO_OP ||
|
|
62
|
+
showForNoOp)
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
override get attributes() {
|
|
67
|
+
return {
|
|
68
|
+
class: 'player-poster',
|
|
69
|
+
'data-poster': '',
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
override get events() {
|
|
74
|
+
return {
|
|
75
|
+
click: 'clicked',
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get showOnVideoEnd() {
|
|
80
|
+
return this.options.poster?.showOnVideoEnd !== false
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
override bindEvents() {
|
|
84
|
+
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop)
|
|
85
|
+
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay)
|
|
86
|
+
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.update)
|
|
87
|
+
this.listenTo(
|
|
88
|
+
this.container,
|
|
89
|
+
Events.CONTAINER_STATE_BUFFERFULL,
|
|
90
|
+
this.update,
|
|
91
|
+
)
|
|
92
|
+
this.listenTo(this.container, Events.CONTAINER_OPTIONS_CHANGE, this.render)
|
|
93
|
+
this.listenTo(this.container, Events.CONTAINER_ERROR, this.onError)
|
|
94
|
+
this.showOnVideoEnd &&
|
|
95
|
+
this.listenTo(this.container, Events.CONTAINER_ENDED, this.onStop)
|
|
96
|
+
this.listenTo(this.container, Events.CONTAINER_READY, this.render)
|
|
97
|
+
this.listenTo(this.container, Events.PLAYBACK_PLAY_INTENT, this.onPlayIntent)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
override enable() {
|
|
101
|
+
super.enable()
|
|
102
|
+
this.hasStartedPlaying = this.container.playback.isPlaying()
|
|
103
|
+
this.update()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
override disable() {
|
|
107
|
+
trace(`${T} disable`)
|
|
108
|
+
this.hasStartedPlaying = false
|
|
109
|
+
this.playRequested = false
|
|
110
|
+
super.disable()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private onError(error: PlaybackError) {
|
|
114
|
+
trace(`${T} onError`, {
|
|
115
|
+
error,
|
|
116
|
+
enabled: this.enabled,
|
|
117
|
+
})
|
|
118
|
+
this.hasFatalError = error.level === PlayerError.Levels.FATAL
|
|
119
|
+
|
|
120
|
+
if (this.hasFatalError) {
|
|
121
|
+
this.hasStartedPlaying = false
|
|
122
|
+
if (!this.playRequested) {
|
|
123
|
+
this.showPlayButton()
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private onPlay() {
|
|
129
|
+
trace(`${T} onPlay`)
|
|
130
|
+
this.hasStartedPlaying = true
|
|
131
|
+
this.playRequested = false
|
|
132
|
+
this.update()
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
private onPlayIntent() {
|
|
136
|
+
trace(`${T} onPlayIntent`)
|
|
137
|
+
this.playRequested = true
|
|
138
|
+
this.update()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private onStop() {
|
|
142
|
+
trace(`${T} onStop`, {
|
|
143
|
+
enabled: this.enabled,
|
|
144
|
+
})
|
|
145
|
+
this.hasStartedPlaying = false
|
|
146
|
+
this.playRequested = false
|
|
147
|
+
this.update()
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private updatePlayButton(show: boolean) {
|
|
151
|
+
trace(`${T} updatePlayButton`, {
|
|
152
|
+
show,
|
|
153
|
+
chromeless: this.options.chromeless,
|
|
154
|
+
allowUserInteraction: this.options.allowUserInteraction,
|
|
155
|
+
})
|
|
156
|
+
if (
|
|
157
|
+
show &&
|
|
158
|
+
(!this.options.chromeless || this.options.allowUserInteraction)
|
|
159
|
+
) {
|
|
160
|
+
this.showPlayButton()
|
|
161
|
+
} else {
|
|
162
|
+
this.hidePlayButton()
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private showPlayButton() {
|
|
167
|
+
if (this.options.disableMediaControl) {
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
if (this.hasFatalError && !this.options.disableErrorScreen) {
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
this.$playButton?.show()
|
|
175
|
+
this.$el.addClass('clickable')
|
|
176
|
+
this.container.$el.addClass('container-with-poster-clickable')
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private hidePlayButton() {
|
|
180
|
+
this.$playButton.hide()
|
|
181
|
+
this.$el.removeClass('clickable')
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
private clicked() {
|
|
185
|
+
trace(`${T} clicked`, {
|
|
186
|
+
hasStartedPlaying: this.hasStartedPlaying,
|
|
187
|
+
chromeless: this.options.chromeless,
|
|
188
|
+
allowUserInteraction: this.options.allowUserInteraction,
|
|
189
|
+
})
|
|
190
|
+
// Let "click_to_pause" plugin handle click event if media has started playing
|
|
191
|
+
if (!this.hasStartedPlaying) {
|
|
192
|
+
if (!this.options.chromeless || this.options.allowUserInteraction) {
|
|
193
|
+
this.playRequested = true
|
|
194
|
+
this.update()
|
|
195
|
+
this.container.playback.consent()
|
|
196
|
+
this.container.playback.play()
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
this.container.trigger('container:start')
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return false
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
private shouldHideOnPlay() {
|
|
206
|
+
// Audio broadcasts should keep the poster up; video should hide poster while playing.
|
|
207
|
+
return !this.container.playback.isAudioOnly
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private update() {
|
|
211
|
+
trace(`${T} update`, {
|
|
212
|
+
shouldRender: this.shouldRender,
|
|
213
|
+
})
|
|
214
|
+
if (!this.shouldRender) {
|
|
215
|
+
return
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const showPlayButton =
|
|
219
|
+
!this.playRequested &&
|
|
220
|
+
!this.hasStartedPlaying &&
|
|
221
|
+
!this.container.buffering
|
|
222
|
+
|
|
223
|
+
this.updatePlayButton(showPlayButton)
|
|
224
|
+
this.updatePoster()
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
private updatePoster() {
|
|
228
|
+
trace(`${T} updatePoster`, {
|
|
229
|
+
hasStartedPlaying: this.hasStartedPlaying,
|
|
230
|
+
})
|
|
231
|
+
if (!this.hasStartedPlaying) {
|
|
232
|
+
this.showPoster()
|
|
233
|
+
} else {
|
|
234
|
+
this.hidePoster()
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
private showPoster() {
|
|
239
|
+
this.container.disableMediaControl()
|
|
240
|
+
this.$el.show()
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private hidePoster() {
|
|
244
|
+
trace(`${T} hidePoster`, {
|
|
245
|
+
shouldHideOnPlay: this.shouldHideOnPlay(),
|
|
246
|
+
})
|
|
247
|
+
if (!this.options.disableMediaControl) {
|
|
248
|
+
this.container.enableMediaControl()
|
|
249
|
+
}
|
|
250
|
+
if (this.shouldHideOnPlay()) {
|
|
251
|
+
this.$el.hide()
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
override render() {
|
|
256
|
+
if (!this.shouldRender) {
|
|
257
|
+
return this
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
this.$el.html(this.template())
|
|
261
|
+
|
|
262
|
+
const isRegularPoster =
|
|
263
|
+
this.options.poster && this.options.poster.custom === undefined
|
|
264
|
+
|
|
265
|
+
if (isRegularPoster) {
|
|
266
|
+
const posterUrl = this.options.poster.url || this.options.poster
|
|
267
|
+
|
|
268
|
+
this.$el.css({ 'background-image': 'url(' + posterUrl + ')' })
|
|
269
|
+
} else if (this.options.poster) {
|
|
270
|
+
this.$el.css({ background: this.options.poster.custom })
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
this.container.$el.removeClass('container-with-poster-clickable')
|
|
274
|
+
this.container.$el.append(this.el)
|
|
275
|
+
this.$playWrapper = this.$el.find('.play-wrapper')
|
|
276
|
+
this.$playWrapper.addClass('control-need-disable')
|
|
277
|
+
this.$playButton = $(
|
|
278
|
+
"<div class='circle-poster gcore-skin-button-color gcore-skin-border-color'></div>",
|
|
279
|
+
)
|
|
280
|
+
this.$playWrapper.append(this.$playButton)
|
|
281
|
+
this.$playButton.append(playIcon)
|
|
282
|
+
|
|
283
|
+
if (this.options.autoPlay) {
|
|
284
|
+
this.$playButton.hide()
|
|
285
|
+
}
|
|
286
|
+
this.$playButton.addClass('poster-icon')
|
|
287
|
+
this.$playButton.attr('data-poster', '')
|
|
288
|
+
|
|
289
|
+
this.update()
|
|
290
|
+
|
|
291
|
+
return this
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
override destroy() {
|
|
295
|
+
this.container.$el.removeClass('container-with-poster-clickable')
|
|
296
|
+
return this
|
|
297
|
+
}
|
|
298
|
+
}
|