@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,205 @@
|
|
|
1
|
+
import { Events, UICorePlugin, Playback, template } from '@clappr/core';
|
|
2
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
3
|
+
import pluginHtml from '../../../assets/playback-rate/playback-rate-selector.ejs';
|
|
4
|
+
import buttonHtml from '../../../assets/playback-rate/button.ejs';
|
|
5
|
+
import listHtml from '../../../assets/playback-rate/list.ejs';
|
|
6
|
+
import speedIcon from '../../../assets/icons/new/speed.svg';
|
|
7
|
+
import arrowRightIcon from '../../../assets/icons/new/arrow-right.svg';
|
|
8
|
+
import arrowLeftIcon from '../../../assets/icons/new/arrow-left.svg';
|
|
9
|
+
import checkIcon from '../../../assets/icons/new/check.svg';
|
|
10
|
+
const DEFAULT_PLAYBACK_RATES = [
|
|
11
|
+
{ value: '0.5', label: '0.5x' },
|
|
12
|
+
{ value: '0.75', label: '0.75x' },
|
|
13
|
+
{ value: '1.0', label: '1x' },
|
|
14
|
+
{ value: '1.25', label: '1.25x' },
|
|
15
|
+
{ value: '1.5', label: '1.5x' },
|
|
16
|
+
{ value: '1.75', label: '1.75x' },
|
|
17
|
+
{ value: '2.0', label: '2x' }
|
|
18
|
+
];
|
|
19
|
+
const DEFAULT_PLAYBACK_RATE = '1.0';
|
|
20
|
+
const MEDIACONTROL_PLAYBACKRATE = 'playbackRate';
|
|
21
|
+
export class PlaybackRate extends UICorePlugin {
|
|
22
|
+
currentPlayback = null;
|
|
23
|
+
playbackRates = DEFAULT_PLAYBACK_RATES;
|
|
24
|
+
prevSelectedRate;
|
|
25
|
+
selectedRate = DEFAULT_PLAYBACK_RATE;
|
|
26
|
+
get name() {
|
|
27
|
+
return 'playback_rate';
|
|
28
|
+
}
|
|
29
|
+
get supportedVersion() {
|
|
30
|
+
return { min: CLAPPR_VERSION };
|
|
31
|
+
}
|
|
32
|
+
get template() {
|
|
33
|
+
return template(pluginHtml);
|
|
34
|
+
}
|
|
35
|
+
get attributes() {
|
|
36
|
+
return {
|
|
37
|
+
'class': this.name,
|
|
38
|
+
'data-playback-rate-select': ''
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
get events() {
|
|
42
|
+
return {
|
|
43
|
+
'click .gear-sub-menu_btn': 'onRateSelect',
|
|
44
|
+
'click .gear-option': 'onShowMenu',
|
|
45
|
+
'click .go-back': 'goBack',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
bindEvents() {
|
|
49
|
+
this.listenTo(this.core, 'gear:rendered', this.render);
|
|
50
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
51
|
+
this.listenTo(this.core.mediaControl, MEDIACONTROL_PLAYBACKRATE, this.updatePlaybackRate);
|
|
52
|
+
this.listenTo(this.core, 'core:advertisement:start', this.onStartAd);
|
|
53
|
+
this.listenTo(this.core, 'core:advertisement:finish', this.onFinishAd);
|
|
54
|
+
if (this.core.activeContainer) {
|
|
55
|
+
this.listenTo(this.core.activePlayback, Events.PLAYBACK_BUFFERFULL, this.updateLiveStatus);
|
|
56
|
+
}
|
|
57
|
+
if (this.currentPlayback) {
|
|
58
|
+
this.listenTo(this.currentPlayback, Events.PLAYBACK_STOP, this.onStop);
|
|
59
|
+
this.listenTo(this.currentPlayback, Events.PLAYBACK_PLAY, this.onPlay);
|
|
60
|
+
// TODO import dash playback events
|
|
61
|
+
this.listenTo(this.currentPlayback, 'dash:playback-rate-changed', this.onDashRateChange);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
unBindEvents() {
|
|
65
|
+
this.stopListening(this.core, 'gear:rendered', this.render);
|
|
66
|
+
this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);
|
|
67
|
+
this.stopListening(this.core, 'core:advertisement:start', this.onStartAd);
|
|
68
|
+
this.stopListening(this.core, 'core:advertisement:finish', this.onFinishAd);
|
|
69
|
+
}
|
|
70
|
+
allRateElements() {
|
|
71
|
+
return this.$('ul.gear-sub-menu li');
|
|
72
|
+
}
|
|
73
|
+
rateElement(rate = "1") {
|
|
74
|
+
return this.$(`ul.gear-sub-menu a[data-rate="${rate}"]`).parent();
|
|
75
|
+
}
|
|
76
|
+
onDashRateChange() {
|
|
77
|
+
// TODO consider removing
|
|
78
|
+
this.currentPlayback._dash?.setPlaybackRate(this.selectedRate);
|
|
79
|
+
}
|
|
80
|
+
updateLiveStatus() {
|
|
81
|
+
if (this.core.getPlaybackType() === Playback.LIVE) {
|
|
82
|
+
if (this.core.mediaControl.currentSeekBarPercentage <= 98.9) {
|
|
83
|
+
this.core.mediaControl.$playbackRate.removeClass('playbackrate-enable');
|
|
84
|
+
this.core.mediaControl.$el.addClass('dvr');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.updatePlaybackRate(DEFAULT_PLAYBACK_RATE);
|
|
88
|
+
this.core.mediaControl.$playbackRate.addClass('playbackrate-enable');
|
|
89
|
+
this.core.mediaControl.$el.removeClass('dvr');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
reload() {
|
|
93
|
+
this.unBindEvents();
|
|
94
|
+
this.bindEvents();
|
|
95
|
+
}
|
|
96
|
+
shouldRender() {
|
|
97
|
+
if (!this.core.activeContainer) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
this.currentPlayback = this.core.activePlayback;
|
|
101
|
+
return !(this.currentPlayback?.tagName !== 'video' && this.currentPlayback?.tagName !== 'audio');
|
|
102
|
+
}
|
|
103
|
+
render() {
|
|
104
|
+
const container = this.core.activeContainer;
|
|
105
|
+
if (this.core.getPlaybackType() === Playback.LIVE && !container.isDvrEnabled()) {
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
const cfg = this.core.options.playbackRateConfig || {};
|
|
109
|
+
if (!this.playbackRates) {
|
|
110
|
+
this.playbackRates = cfg.options || DEFAULT_PLAYBACK_RATES;
|
|
111
|
+
}
|
|
112
|
+
if (!this.selectedRate) {
|
|
113
|
+
this.selectedRate = cfg.defaultValue || DEFAULT_PLAYBACK_RATE;
|
|
114
|
+
}
|
|
115
|
+
if (this.shouldRender()) {
|
|
116
|
+
const t = template(buttonHtml);
|
|
117
|
+
// const html = t({ playbackRates: this.playbackRates, title: this.getTitle() });
|
|
118
|
+
const button = t({
|
|
119
|
+
title: this.getTitle(),
|
|
120
|
+
speedIcon,
|
|
121
|
+
arrowRightIcon,
|
|
122
|
+
});
|
|
123
|
+
this.$el.html(button);
|
|
124
|
+
// if (this.core.getPlaybackType() === Playback.LIVE) {
|
|
125
|
+
// this.core.mediaControl.$playbackRate.addClass('playbackrate-enable');
|
|
126
|
+
// }
|
|
127
|
+
// this.core.mediaControl.$playbackRate.append(this.el);
|
|
128
|
+
this.core.mediaControl.$el?.find('.gear-options-list [data-rate]').html(this.el);
|
|
129
|
+
// this.updateText();
|
|
130
|
+
}
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
onStartAd() {
|
|
134
|
+
this.prevSelectedRate = this.selectedRate;
|
|
135
|
+
this.setSelectedRate('1.0');
|
|
136
|
+
this.listenToOnce(this.currentPlayback, Events.PLAYBACK_PLAY, this.onFinishAd);
|
|
137
|
+
}
|
|
138
|
+
onFinishAd() {
|
|
139
|
+
if (this.prevSelectedRate) {
|
|
140
|
+
this.setSelectedRate(this.prevSelectedRate);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
onPlay() {
|
|
144
|
+
if (!this.core.mediaControl.$el.hasClass('dvr')) {
|
|
145
|
+
if (this.core.getPlaybackType() === Playback.LIVE) {
|
|
146
|
+
this.updatePlaybackRate(DEFAULT_PLAYBACK_RATE);
|
|
147
|
+
this.core.mediaControl.$playbackRate.addClass('playbackrate-enable');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.setSelectedRate(this.selectedRate);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
onStop() {
|
|
155
|
+
}
|
|
156
|
+
onRateSelect(event) {
|
|
157
|
+
event.stopPropagation();
|
|
158
|
+
const rate = event.currentTarget.dataset.rate;
|
|
159
|
+
if (rate) {
|
|
160
|
+
this.setSelectedRate(rate);
|
|
161
|
+
this.highlightCurrentRate();
|
|
162
|
+
}
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
onShowMenu() {
|
|
166
|
+
const t = template(listHtml);
|
|
167
|
+
this.$el.html(t({
|
|
168
|
+
playbackRates: this.playbackRates,
|
|
169
|
+
arrowLeftIcon,
|
|
170
|
+
checkIcon,
|
|
171
|
+
}));
|
|
172
|
+
this.core.mediaControl.$el?.find('.gear-wrapper').html(this.el);
|
|
173
|
+
this.highlightCurrentRate();
|
|
174
|
+
}
|
|
175
|
+
goBack() {
|
|
176
|
+
this.core.trigger('gear:refresh');
|
|
177
|
+
}
|
|
178
|
+
updatePlaybackRate(rate) {
|
|
179
|
+
this.setSelectedRate(rate);
|
|
180
|
+
}
|
|
181
|
+
setSelectedRate(rate) {
|
|
182
|
+
// Set <video playbackRate="..."
|
|
183
|
+
this.core.$el.find('video,audio').get(0).playbackRate = rate;
|
|
184
|
+
this.selectedRate = rate;
|
|
185
|
+
// TODO
|
|
186
|
+
// Player.player.trigger('playbackRateChanged', rate);
|
|
187
|
+
}
|
|
188
|
+
getTitle() {
|
|
189
|
+
let title = this.selectedRate;
|
|
190
|
+
this.playbackRates.forEach((r) => {
|
|
191
|
+
if (r.value === this.selectedRate) {
|
|
192
|
+
title = r.label;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return title;
|
|
196
|
+
}
|
|
197
|
+
highlightCurrentRate() {
|
|
198
|
+
this.allRateElements().removeClass('current');
|
|
199
|
+
this.allRateElements().find('a').removeClass('gcore-skin-active');
|
|
200
|
+
const currentLevelElement = this.rateElement(this.selectedRate);
|
|
201
|
+
currentLevelElement.addClass('current');
|
|
202
|
+
currentLevelElement.find('a').addClass('gcore-skin-active');
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// PlaybackRate.MEDIACONTROL_PLAYBACKRATE = 'playbackRate';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UIContainerPlugin
|
|
2
|
-
import '../../../assets/
|
|
3
|
-
export
|
|
1
|
+
import { UIContainerPlugin } from '@clappr/core';
|
|
2
|
+
import '../../../assets/poster/poster.scss';
|
|
3
|
+
export declare class Poster extends UIContainerPlugin {
|
|
4
4
|
private hasFatalError;
|
|
5
5
|
private hasStartedPlaying;
|
|
6
6
|
private playRequested;
|
|
@@ -19,23 +19,24 @@ export default class Poster extends UIContainerPlugin {
|
|
|
19
19
|
get events(): {
|
|
20
20
|
click: string;
|
|
21
21
|
};
|
|
22
|
-
get showOnVideoEnd():
|
|
23
|
-
constructor(container: Container);
|
|
22
|
+
get showOnVideoEnd(): boolean;
|
|
24
23
|
bindEvents(): void;
|
|
24
|
+
enable(): void;
|
|
25
|
+
disable(): void;
|
|
25
26
|
private onError;
|
|
26
|
-
onPlay
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
private onPlay;
|
|
28
|
+
private onPlayIntent;
|
|
29
|
+
private onStop;
|
|
30
|
+
private updatePlayButton;
|
|
31
|
+
private showPlayButton;
|
|
32
|
+
private hidePlayButton;
|
|
33
|
+
private clicked;
|
|
34
|
+
private shouldHideOnPlay;
|
|
35
|
+
private update;
|
|
36
|
+
private updatePoster;
|
|
37
|
+
private showPoster;
|
|
38
|
+
private hidePoster;
|
|
37
39
|
render(): this;
|
|
38
|
-
removeVideoElementPoster(): void;
|
|
39
40
|
destroy(): this;
|
|
40
41
|
}
|
|
41
42
|
//# sourceMappingURL=Poster.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Poster.d.ts","sourceRoot":"","sources":["../../../src/plugins/poster/Poster.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"Poster.d.ts","sourceRoot":"","sources":["../../../src/plugins/poster/Poster.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,iBAAiB,EAIlB,MAAM,cAAc,CAAA;AAMrB,OAAO,oCAAoC,CAAA;AAO3C,qBAAa,MAAO,SAAQ,iBAAiB;IAC3C,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,iBAAiB,CAAQ;IAEjC,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,WAAW,CAA2B;IAE9C,OAAO,CAAC,YAAY,CAA2B;IAE/C,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,IAAI,QAAQ,QAEX;IAED,IAAI,YAAY,YAef;IAED,IAAa,UAAU;;;MAKtB;IAED,IAAa,MAAM;;MAIlB;IAED,IAAI,cAAc,YAEjB;IAEQ,UAAU;IAiBV,MAAM;IAMN,OAAO;IAOhB,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,OAAO;IAqBf,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,MAAM;IAiBd,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,UAAU;IAYT,MAAM;IAuCN,OAAO;CAIjB"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
//Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
2
2
|
// Use of this source code is governed by a BSD-style
|
|
3
3
|
// license that can be found in the LICENSE file.
|
|
4
|
-
import { Events, Playback, PlayerError, UIContainerPlugin, template,
|
|
5
|
-
import '
|
|
6
|
-
import
|
|
4
|
+
import { Events, Playback, PlayerError, UIContainerPlugin, template, $, } from '@clappr/core';
|
|
5
|
+
import { trace } from '@gcorevideo/utils';
|
|
6
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
7
|
+
import '../../../assets/poster/poster.scss';
|
|
8
|
+
import posterHTML from '../../../assets/poster/poster.ejs';
|
|
7
9
|
import playIcon from '../../../assets/icons/new/play.svg';
|
|
8
|
-
import assert from 'assert';
|
|
9
10
|
const T = 'plugins.poster_custom';
|
|
10
|
-
|
|
11
|
-
const CLAPPR_VERSION = process.env.CLAPPR_VERSION;
|
|
12
|
-
export default class Poster extends UIContainerPlugin {
|
|
11
|
+
export class Poster extends UIContainerPlugin {
|
|
13
12
|
hasFatalError = false;
|
|
14
13
|
hasStartedPlaying = false;
|
|
15
14
|
playRequested = false;
|
|
@@ -25,27 +24,31 @@ export default class Poster extends UIContainerPlugin {
|
|
|
25
24
|
return template(posterHTML);
|
|
26
25
|
}
|
|
27
26
|
get shouldRender() {
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
if (!this.enabled) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
// const showOnError = this.options.poster?.showOnError !== false
|
|
31
|
+
trace(`${T} shouldRender`, {
|
|
32
|
+
hasFatalError: this.hasFatalError,
|
|
33
|
+
});
|
|
34
|
+
const showForNoOp = !!this.options.poster?.showForNoOp;
|
|
35
|
+
return (this.container.playback.name !== 'html_img' &&
|
|
36
|
+
(this.container.playback.getPlaybackType() !== Playback.NO_OP ||
|
|
37
|
+
showForNoOp));
|
|
30
38
|
}
|
|
31
39
|
get attributes() {
|
|
32
40
|
return {
|
|
33
|
-
|
|
34
|
-
'data-poster': ''
|
|
41
|
+
class: 'player-poster',
|
|
42
|
+
'data-poster': '',
|
|
35
43
|
};
|
|
36
44
|
}
|
|
37
45
|
get events() {
|
|
38
46
|
return {
|
|
39
|
-
|
|
47
|
+
click: 'clicked',
|
|
40
48
|
};
|
|
41
49
|
}
|
|
42
50
|
get showOnVideoEnd() {
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
constructor(container) {
|
|
46
|
-
super(container);
|
|
47
|
-
this.render();
|
|
48
|
-
setTimeout(() => this.update(), 0);
|
|
51
|
+
return this.options.poster?.showOnVideoEnd !== false;
|
|
49
52
|
}
|
|
50
53
|
bindEvents() {
|
|
51
54
|
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
|
|
@@ -54,29 +57,62 @@ export default class Poster extends UIContainerPlugin {
|
|
|
54
57
|
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.update);
|
|
55
58
|
this.listenTo(this.container, Events.CONTAINER_OPTIONS_CHANGE, this.render);
|
|
56
59
|
this.listenTo(this.container, Events.CONTAINER_ERROR, this.onError);
|
|
57
|
-
this.showOnVideoEnd &&
|
|
60
|
+
this.showOnVideoEnd &&
|
|
61
|
+
this.listenTo(this.container, Events.CONTAINER_ENDED, this.onStop);
|
|
58
62
|
this.listenTo(this.container, Events.CONTAINER_READY, this.render);
|
|
63
|
+
this.listenTo(this.container, Events.PLAYBACK_PLAY_INTENT, this.onPlayIntent);
|
|
64
|
+
}
|
|
65
|
+
enable() {
|
|
66
|
+
super.enable();
|
|
67
|
+
this.hasStartedPlaying = this.container.playback.isPlaying();
|
|
68
|
+
this.update();
|
|
69
|
+
}
|
|
70
|
+
disable() {
|
|
71
|
+
trace(`${T} disable`);
|
|
72
|
+
this.hasStartedPlaying = false;
|
|
73
|
+
this.playRequested = false;
|
|
74
|
+
super.disable();
|
|
59
75
|
}
|
|
60
76
|
onError(error) {
|
|
61
|
-
|
|
77
|
+
trace(`${T} onError`, {
|
|
78
|
+
error,
|
|
79
|
+
enabled: this.enabled,
|
|
80
|
+
});
|
|
62
81
|
this.hasFatalError = error.level === PlayerError.Levels.FATAL;
|
|
63
82
|
if (this.hasFatalError) {
|
|
64
83
|
this.hasStartedPlaying = false;
|
|
65
|
-
this.playRequested
|
|
66
|
-
|
|
84
|
+
if (!this.playRequested) {
|
|
85
|
+
this.showPlayButton();
|
|
86
|
+
}
|
|
67
87
|
}
|
|
68
88
|
}
|
|
69
89
|
onPlay() {
|
|
90
|
+
trace(`${T} onPlay`);
|
|
70
91
|
this.hasStartedPlaying = true;
|
|
92
|
+
this.playRequested = false;
|
|
93
|
+
this.update();
|
|
94
|
+
}
|
|
95
|
+
onPlayIntent() {
|
|
96
|
+
trace(`${T} onPlayIntent`);
|
|
97
|
+
this.playRequested = true;
|
|
71
98
|
this.update();
|
|
72
99
|
}
|
|
73
100
|
onStop() {
|
|
101
|
+
trace(`${T} onStop`, {
|
|
102
|
+
enabled: this.enabled,
|
|
103
|
+
});
|
|
74
104
|
this.hasStartedPlaying = false;
|
|
75
105
|
this.playRequested = false;
|
|
76
106
|
this.update();
|
|
77
107
|
}
|
|
78
108
|
updatePlayButton(show) {
|
|
79
|
-
|
|
109
|
+
trace(`${T} updatePlayButton`, {
|
|
110
|
+
show,
|
|
111
|
+
chromeless: this.options.chromeless,
|
|
112
|
+
allowUserInteraction: this.options.allowUserInteraction,
|
|
113
|
+
});
|
|
114
|
+
if (show &&
|
|
115
|
+
(!this.options.chromeless || this.options.allowUserInteraction)) {
|
|
80
116
|
this.showPlayButton();
|
|
81
117
|
}
|
|
82
118
|
else {
|
|
@@ -99,17 +135,23 @@ export default class Poster extends UIContainerPlugin {
|
|
|
99
135
|
this.$el.removeClass('clickable');
|
|
100
136
|
}
|
|
101
137
|
clicked() {
|
|
138
|
+
trace(`${T} clicked`, {
|
|
139
|
+
hasStartedPlaying: this.hasStartedPlaying,
|
|
140
|
+
chromeless: this.options.chromeless,
|
|
141
|
+
allowUserInteraction: this.options.allowUserInteraction,
|
|
142
|
+
});
|
|
102
143
|
// Let "click_to_pause" plugin handle click event if media has started playing
|
|
103
144
|
if (!this.hasStartedPlaying) {
|
|
104
145
|
if (!this.options.chromeless || this.options.allowUserInteraction) {
|
|
105
146
|
this.playRequested = true;
|
|
106
147
|
this.update();
|
|
107
|
-
this.container.playback
|
|
108
|
-
this.container.play();
|
|
148
|
+
this.container.playback.consent();
|
|
149
|
+
this.container.playback.play();
|
|
109
150
|
}
|
|
110
|
-
return false;
|
|
111
151
|
}
|
|
112
|
-
|
|
152
|
+
else {
|
|
153
|
+
this.container.trigger('container:start');
|
|
154
|
+
}
|
|
113
155
|
return false;
|
|
114
156
|
}
|
|
115
157
|
shouldHideOnPlay() {
|
|
@@ -117,14 +159,22 @@ export default class Poster extends UIContainerPlugin {
|
|
|
117
159
|
return !this.container.playback.isAudioOnly;
|
|
118
160
|
}
|
|
119
161
|
update() {
|
|
162
|
+
trace(`${T} update`, {
|
|
163
|
+
shouldRender: this.shouldRender,
|
|
164
|
+
});
|
|
120
165
|
if (!this.shouldRender) {
|
|
121
166
|
return;
|
|
122
167
|
}
|
|
123
|
-
const showPlayButton = !this.playRequested &&
|
|
168
|
+
const showPlayButton = !this.playRequested &&
|
|
169
|
+
!this.hasStartedPlaying &&
|
|
170
|
+
!this.container.buffering;
|
|
124
171
|
this.updatePlayButton(showPlayButton);
|
|
125
172
|
this.updatePoster();
|
|
126
173
|
}
|
|
127
174
|
updatePoster() {
|
|
175
|
+
trace(`${T} updatePoster`, {
|
|
176
|
+
hasStartedPlaying: this.hasStartedPlaying,
|
|
177
|
+
});
|
|
128
178
|
if (!this.hasStartedPlaying) {
|
|
129
179
|
this.showPoster();
|
|
130
180
|
}
|
|
@@ -137,6 +187,9 @@ export default class Poster extends UIContainerPlugin {
|
|
|
137
187
|
this.$el.show();
|
|
138
188
|
}
|
|
139
189
|
hidePoster() {
|
|
190
|
+
trace(`${T} hidePoster`, {
|
|
191
|
+
shouldHideOnPlay: this.shouldHideOnPlay(),
|
|
192
|
+
});
|
|
140
193
|
if (!this.options.disableMediaControl) {
|
|
141
194
|
this.container.enableMediaControl();
|
|
142
195
|
}
|
|
@@ -155,13 +208,13 @@ export default class Poster extends UIContainerPlugin {
|
|
|
155
208
|
this.$el.css({ 'background-image': 'url(' + posterUrl + ')' });
|
|
156
209
|
}
|
|
157
210
|
else if (this.options.poster) {
|
|
158
|
-
this.$el.css({
|
|
211
|
+
this.$el.css({ background: this.options.poster.custom });
|
|
159
212
|
}
|
|
160
213
|
this.container.$el.removeClass('container-with-poster-clickable');
|
|
161
214
|
this.container.$el.append(this.el);
|
|
162
215
|
this.$playWrapper = this.$el.find('.play-wrapper');
|
|
163
216
|
this.$playWrapper.addClass('control-need-disable');
|
|
164
|
-
this.$playButton = $(
|
|
217
|
+
this.$playButton = $("<div class='circle-poster gcore-skin-button-color gcore-skin-border-color'></div>");
|
|
165
218
|
this.$playWrapper.append(this.$playButton);
|
|
166
219
|
this.$playButton.append(playIcon);
|
|
167
220
|
if (this.options.autoPlay) {
|
|
@@ -172,13 +225,6 @@ export default class Poster extends UIContainerPlugin {
|
|
|
172
225
|
this.update();
|
|
173
226
|
return this;
|
|
174
227
|
}
|
|
175
|
-
removeVideoElementPoster() {
|
|
176
|
-
this.container.playback &&
|
|
177
|
-
this.container.playback.$el &&
|
|
178
|
-
this.container.playback.$el[0] &&
|
|
179
|
-
this.container.playback.$el[0].removeAttribute &&
|
|
180
|
-
this.container.playback.$el[0].removeAttribute('poster');
|
|
181
|
-
}
|
|
182
228
|
destroy() {
|
|
183
229
|
this.container.$el.removeClass('container-with-poster-clickable');
|
|
184
230
|
return this;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { UICorePlugin } from '@clappr/core';
|
|
2
|
+
import '../../../assets/seek-time/seek-time.scss';
|
|
3
|
+
export declare class SeekTime extends UICorePlugin {
|
|
4
|
+
get name(): string;
|
|
5
|
+
get supportedVersion(): {
|
|
6
|
+
min: string;
|
|
7
|
+
};
|
|
8
|
+
get template(): any;
|
|
9
|
+
get attributes(): {
|
|
10
|
+
class: string;
|
|
11
|
+
'data-seek-time': string;
|
|
12
|
+
};
|
|
13
|
+
get mediaControl(): any;
|
|
14
|
+
get mediaControlContainer(): any;
|
|
15
|
+
get isLiveStreamWithDvr(): any;
|
|
16
|
+
get durationShown(): boolean;
|
|
17
|
+
private hoveringOverSeekBar;
|
|
18
|
+
private hoverPosition;
|
|
19
|
+
private displayedDuration;
|
|
20
|
+
private displayedSeekTime;
|
|
21
|
+
private duration;
|
|
22
|
+
private rendered;
|
|
23
|
+
private $durationEl;
|
|
24
|
+
private $seekTimeEl;
|
|
25
|
+
bindEvents(): void;
|
|
26
|
+
private onContainerChanged;
|
|
27
|
+
private updateDuration;
|
|
28
|
+
private showTime;
|
|
29
|
+
private hideTime;
|
|
30
|
+
private calculateHoverPosition;
|
|
31
|
+
getSeekTime(): {
|
|
32
|
+
seekTime: number;
|
|
33
|
+
};
|
|
34
|
+
update(): void;
|
|
35
|
+
shouldBeVisible(): any;
|
|
36
|
+
render(): this;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=SeekTime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeekTime.d.ts","sourceRoot":"","sources":["../../../src/plugins/seek-time/SeekTime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,YAAY,EAAmB,MAAM,cAAc,CAAC;AAM/E,OAAO,0CAA0C,CAAC;AAKlD,qBAAa,QAAS,SAAQ,YAAY;IACxC,IAAI,IAAI,WAEP;IAED,IAAI,gBAAgB;;MAEnB;IAED,IAAI,QAAQ,QAEX;IAED,IAAa,UAAU;;;MAKtB;IAED,IAAI,YAAY,QAEf;IAED,IAAI,qBAAqB,QAExB;IAED,IAAI,mBAAmB,QAItB;IAED,IAAI,aAAa,YAEhB;IAED,OAAO,CAAC,mBAAmB,CAAS;IAEpC,OAAO,CAAC,aAAa,CAAK;IAE1B,OAAO,CAAC,iBAAiB,CAAuB;IAEhD,OAAO,CAAC,iBAAiB,CAAsB;IAE/C,OAAO,CAAC,QAAQ,CAAK;IAGrB,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,WAAW,CAA4B;IAE/C,OAAO,CAAC,WAAW,CAA4B;IAEtC,UAAU;IAWnB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,sBAAsB;IAO9B,WAAW;;;IAYX,MAAM;IA8CN,eAAe;IAQN,MAAM;CAahB"}
|
|
@@ -0,0 +1,153 @@
|
|
|
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
|
+
import { Events, Playback, UICorePlugin, Utils, template } from '@clappr/core';
|
|
5
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
6
|
+
import seekTimeHTML from '../../../assets/seek-time/seek-time.html';
|
|
7
|
+
import '../../../assets/seek-time/seek-time.scss';
|
|
8
|
+
const { formatTime } = Utils;
|
|
9
|
+
export class SeekTime extends UICorePlugin {
|
|
10
|
+
get name() {
|
|
11
|
+
return 'seek_time';
|
|
12
|
+
}
|
|
13
|
+
get supportedVersion() {
|
|
14
|
+
return { min: CLAPPR_VERSION };
|
|
15
|
+
}
|
|
16
|
+
get template() {
|
|
17
|
+
return template(seekTimeHTML);
|
|
18
|
+
}
|
|
19
|
+
get attributes() {
|
|
20
|
+
return {
|
|
21
|
+
'class': 'seek-time',
|
|
22
|
+
'data-seek-time': ''
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
get mediaControl() {
|
|
26
|
+
return this.core.mediaControl;
|
|
27
|
+
}
|
|
28
|
+
get mediaControlContainer() {
|
|
29
|
+
return this.mediaControl.container;
|
|
30
|
+
}
|
|
31
|
+
get isLiveStreamWithDvr() {
|
|
32
|
+
return this.mediaControlContainer &&
|
|
33
|
+
this.mediaControlContainer.getPlaybackType() === Playback.LIVE &&
|
|
34
|
+
this.mediaControlContainer.isDvrEnabled();
|
|
35
|
+
}
|
|
36
|
+
get durationShown() {
|
|
37
|
+
return !this.isLiveStreamWithDvr;
|
|
38
|
+
}
|
|
39
|
+
hoveringOverSeekBar = false;
|
|
40
|
+
hoverPosition = 0;
|
|
41
|
+
displayedDuration = null;
|
|
42
|
+
displayedSeekTime = null;
|
|
43
|
+
duration = 0;
|
|
44
|
+
// private firstFragDateTime = 0;
|
|
45
|
+
rendered = false;
|
|
46
|
+
$durationEl = null;
|
|
47
|
+
$seekTimeEl = null;
|
|
48
|
+
bindEvents() {
|
|
49
|
+
this.listenTo(this.mediaControl, Events.MEDIACONTROL_RENDERED, this.render);
|
|
50
|
+
this.listenTo(this.mediaControl, Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR, this.showTime);
|
|
51
|
+
this.listenTo(this.mediaControl, Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR, this.hideTime);
|
|
52
|
+
this.listenTo(this.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.onContainerChanged);
|
|
53
|
+
if (this.mediaControlContainer) {
|
|
54
|
+
this.listenTo(this.mediaControlContainer, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.update);
|
|
55
|
+
this.listenTo(this.mediaControlContainer, Events.CONTAINER_TIMEUPDATE, this.updateDuration);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
onContainerChanged() {
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
this.stopListening();
|
|
61
|
+
this.bindEvents();
|
|
62
|
+
}
|
|
63
|
+
updateDuration(timeProgress) {
|
|
64
|
+
this.duration = timeProgress.total;
|
|
65
|
+
// this.firstFragDateTime = timeProgress.firstFragDateTime;
|
|
66
|
+
this.update();
|
|
67
|
+
}
|
|
68
|
+
showTime(event) {
|
|
69
|
+
this.hoveringOverSeekBar = true;
|
|
70
|
+
this.calculateHoverPosition(event);
|
|
71
|
+
this.update();
|
|
72
|
+
}
|
|
73
|
+
hideTime() {
|
|
74
|
+
this.hoveringOverSeekBar = false;
|
|
75
|
+
this.update();
|
|
76
|
+
}
|
|
77
|
+
calculateHoverPosition(event) {
|
|
78
|
+
const offset = event.pageX - this.mediaControl.$seekBarContainer.offset().left;
|
|
79
|
+
// proportion into the seek bar that the mouse is hovered over 0-1
|
|
80
|
+
this.hoverPosition = Math.min(1, Math.max(offset / this.mediaControl.$seekBarContainer.width(), 0));
|
|
81
|
+
}
|
|
82
|
+
getSeekTime() {
|
|
83
|
+
let seekTime;
|
|
84
|
+
if (this.isLiveStreamWithDvr) {
|
|
85
|
+
seekTime = this.duration - this.hoverPosition * this.duration;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
seekTime = this.hoverPosition * this.duration;
|
|
89
|
+
}
|
|
90
|
+
return { seekTime };
|
|
91
|
+
}
|
|
92
|
+
update() {
|
|
93
|
+
if (!this.rendered) {
|
|
94
|
+
// update() is always called after a render
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (!this.shouldBeVisible()) {
|
|
98
|
+
this.$el.hide();
|
|
99
|
+
this.$el.css('left', '-100%');
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const seekTime = this.getSeekTime();
|
|
103
|
+
let currentSeekTime = formatTime(seekTime.seekTime, false);
|
|
104
|
+
if (this.isLiveStreamWithDvr) {
|
|
105
|
+
currentSeekTime = `-${currentSeekTime}`;
|
|
106
|
+
}
|
|
107
|
+
// only update dom if necessary, ie time actually changed
|
|
108
|
+
if (currentSeekTime !== this.displayedSeekTime) {
|
|
109
|
+
this.$seekTimeEl.text(currentSeekTime);
|
|
110
|
+
this.displayedSeekTime = currentSeekTime;
|
|
111
|
+
}
|
|
112
|
+
if (this.durationShown) {
|
|
113
|
+
this.$durationEl.show();
|
|
114
|
+
const currentDuration = formatTime(this.duration, false);
|
|
115
|
+
if (currentDuration !== this.displayedDuration) {
|
|
116
|
+
this.$durationEl.text(currentDuration);
|
|
117
|
+
this.displayedDuration = currentDuration;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.$durationEl.hide();
|
|
122
|
+
}
|
|
123
|
+
// the element must be unhidden before its width is requested, otherwise it's width will be reported as 0
|
|
124
|
+
this.$el.show();
|
|
125
|
+
const containerWidth = this.mediaControl.$seekBarContainer.width();
|
|
126
|
+
const elWidth = this.$el.width();
|
|
127
|
+
let elLeftPos = this.hoverPosition * containerWidth;
|
|
128
|
+
elLeftPos -= elWidth / 2;
|
|
129
|
+
elLeftPos = Math.max(0, Math.min(elLeftPos, containerWidth - elWidth));
|
|
130
|
+
this.$el.css('left', elLeftPos);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
shouldBeVisible() {
|
|
134
|
+
return this.mediaControlContainer &&
|
|
135
|
+
this.mediaControlContainer.settings.seekEnabled &&
|
|
136
|
+
this.hoveringOverSeekBar &&
|
|
137
|
+
this.hoverPosition !== null &&
|
|
138
|
+
this.duration !== null;
|
|
139
|
+
}
|
|
140
|
+
render() {
|
|
141
|
+
this.rendered = true;
|
|
142
|
+
this.displayedDuration = null;
|
|
143
|
+
this.displayedSeekTime = null;
|
|
144
|
+
this.$el.html(this.template());
|
|
145
|
+
this.$el.hide();
|
|
146
|
+
this.mediaControl.$el.append(this.el);
|
|
147
|
+
this.$seekTimeEl = this.$el.find('[data-seek-time]');
|
|
148
|
+
this.$durationEl = this.$el.find('[data-duration]');
|
|
149
|
+
this.$durationEl.hide();
|
|
150
|
+
this.update();
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
}
|