@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,395 @@
|
|
|
1
|
+
// Clappr player is Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import { CorePlugin, Events, Playback, $ } from '@clappr/core';
|
|
4
|
+
import gaTrackingSnippet from './ga-tracking';
|
|
5
|
+
|
|
6
|
+
export class GaEvents extends CorePlugin {
|
|
7
|
+
get name() {
|
|
8
|
+
return 'ga_events';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
constructor(core) {
|
|
12
|
+
super(core);
|
|
13
|
+
this._volumeTimer = null;
|
|
14
|
+
this._doSendPlay = true;
|
|
15
|
+
this.readPluginConfig(this.options.gaEventsPlugin);
|
|
16
|
+
gaTrackingSnippet(this._gaCfg.name, this._gaCfg.debug, this._gaCfg.trace);
|
|
17
|
+
this._ga('create', this._trackingId, this._createFieldsObject);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
bindEvents() {
|
|
21
|
+
const eventsToAlwaysBind = [
|
|
22
|
+
{ event: Events.CONTAINER_TIMEUPDATE, handler: this.onTimeUpdate },
|
|
23
|
+
{ event: Events.CONTAINER_PLAY, handler: this.onPlay },
|
|
24
|
+
{ event: Events.CONTAINER_SEEK, handler: (event) => this.onSeek(event) },
|
|
25
|
+
{ event: Events.CONTAINER_PAUSE, handler: this.onPause },
|
|
26
|
+
{ event: Events.CONTAINER_STOP, handler: this.onStop },
|
|
27
|
+
{ event: Events.CONTAINER_ENDED, handler: this.onEnded },
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const conditionalEvents = [
|
|
31
|
+
{ condition: 'ready', event: Events.CONTAINER_READY, handler: this.onReady },
|
|
32
|
+
{ condition: 'buffering', event: Events.CONTAINER_STATE_BUFFERING, handler: this.onBuffering },
|
|
33
|
+
{ condition: 'bufferfull', event: Events.CONTAINER_STATE_BUFFERFULL, handler: this.onBufferFull },
|
|
34
|
+
{ condition: 'loadedmetadata', event: Events.CONTAINER_LOADEDMETADATA, handler: this.onLoadedMetadata },
|
|
35
|
+
{ condition: 'volume', event: Events.CONTAINER_VOLUME, handler: (event) => this.onVolumeChanged(event) },
|
|
36
|
+
{ condition: 'fullscreen', event: Events.CONTAINER_FULLSCREEN, handler: this.onFullscreen },
|
|
37
|
+
{ condition: 'playbackstate', event: Events.CONTAINER_PLAYBACKSTATE, handler: this.onPlaybackChanged },
|
|
38
|
+
{ condition: 'highdefinitionupdate', event: Events.CONTAINER_HIGHDEFINITIONUPDATE, handler: this.onHD },
|
|
39
|
+
{ condition: 'playbackdvrstatechanged', event: Events.CONTAINER_PLAYBACKDVRSTATECHANGED, handler: this.onDVR },
|
|
40
|
+
{ condition: 'error', event: Events.CONTAINER_ERROR, handler: this.onError },
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.containerChanged);
|
|
44
|
+
this._container = this.core.activeContainer;
|
|
45
|
+
if (this._container) {
|
|
46
|
+
// Set resolved source as eventLabel if not defined in plugin configuration
|
|
47
|
+
if (!this._label) {
|
|
48
|
+
this._label = this._container.options.src;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
eventsToAlwaysBind.forEach(({ event, handler }) => {
|
|
52
|
+
this.listenTo(this._container, event, handler);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
conditionalEvents.forEach(({ condition, event, handler }) => {
|
|
56
|
+
if (this._hasEvent(condition)) {
|
|
57
|
+
this.listenTo(this._container, event, handler);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
getExternalInterface() {
|
|
64
|
+
// Expose player method only if tracker name is available
|
|
65
|
+
if (this._trackerName) {
|
|
66
|
+
return {
|
|
67
|
+
gaEventsTracker: this.gaTracker
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
containerChanged() {
|
|
75
|
+
this.stopListening();
|
|
76
|
+
this.bindEvents();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get _ga() {
|
|
80
|
+
return window[window.GoogleAnalyticsObject];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
gaTracker() {
|
|
84
|
+
return this._ga.getByName && this._ga.getByName(this._trackerName);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
gaEvent(category, action, label, value) {
|
|
88
|
+
this._ga(this._send, 'event', category, action, label, value);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
gaException(desc, isFatal=false) {
|
|
92
|
+
this._ga(this._send, 'exception', {
|
|
93
|
+
'exDescription': desc,
|
|
94
|
+
'exFatal': isFatal
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
readPluginConfig(cfg) {
|
|
99
|
+
if (!cfg) {
|
|
100
|
+
throw new Error(this.name + ' plugin config is missing');
|
|
101
|
+
}
|
|
102
|
+
if (!cfg.trackingId) {
|
|
103
|
+
throw new Error(this.name + ' plugin "trackingId" required config parameter is missing');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
this._gaCfg = cfg.gaCfg || { name: 'ga', debug: false, trace: false };
|
|
107
|
+
this._trackingId = cfg.trackingId;
|
|
108
|
+
this._createFieldsObject = cfg.createFieldsObject;
|
|
109
|
+
this._trackerName = this._createFieldsObject && this._createFieldsObject.name;
|
|
110
|
+
this._send = this._trackerName ? this._trackerName + '.send' : 'send';
|
|
111
|
+
this._category = cfg.eventCategory || 'Video';
|
|
112
|
+
this._label = cfg.eventLabel; // Otherwise filled in bindEvents()
|
|
113
|
+
this._setValue = cfg.eventValueAuto === true;
|
|
114
|
+
this._events = $.isArray(cfg.eventToTrack) && cfg.eventToTrack || this._defaultEvents;
|
|
115
|
+
this._eventMap = $.isPlainObject(cfg.eventMapping) && cfg.eventMapping || this._defaultEventMap;
|
|
116
|
+
this._gaPlayOnce = cfg.sendPlayOnce === true;
|
|
117
|
+
this._gaEx = cfg.sendExceptions === true;
|
|
118
|
+
this._gaExDesc = cfg.sendExceptionsMsg === true;
|
|
119
|
+
|
|
120
|
+
// Add 'error' to tracked events if GA exceptions are enabled
|
|
121
|
+
if (this._gaEx && !this._hasEvent('error')) {
|
|
122
|
+
this._events.push('error');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this._gaPercent = $.isArray(cfg.progressPercent) && cfg.progressPercent || [];
|
|
126
|
+
this._gaPercentCat = cfg.progressPercentCategory || this._category;
|
|
127
|
+
this._gaPercentAct = $.isFunction(cfg.progressPercentAction) && cfg.progressPercentAction || function(i) {
|
|
128
|
+
return 'progress_' + i + 'p';
|
|
129
|
+
};
|
|
130
|
+
this._processGaPercent = this._gaPercent.length > 0;
|
|
131
|
+
this._gaSeconds = $.isArray(cfg.progressSeconds) && cfg.progressSeconds || [];
|
|
132
|
+
this._gaSecondsCat = cfg.progressSecondsCategory || this._category;
|
|
133
|
+
this._gaSecondsAct = $.isFunction(cfg.progressSecondsAction) && cfg.progressSecondsAction || function(i) {
|
|
134
|
+
return 'progress_' + i + 's';
|
|
135
|
+
};
|
|
136
|
+
this._gaSecondsTimerStarted = false;
|
|
137
|
+
this._processGaSeconds = this._gaSeconds.length > 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
get _defaultEventMap() {
|
|
141
|
+
return {
|
|
142
|
+
'ready': 'ready',
|
|
143
|
+
'buffering': 'buffering',
|
|
144
|
+
'bufferfull': 'bufferfull',
|
|
145
|
+
'loadedmetadata': 'loadedmetadata',
|
|
146
|
+
'play': 'play',
|
|
147
|
+
'seek': 'seek',
|
|
148
|
+
'pause': 'pause',
|
|
149
|
+
'stop': 'stop',
|
|
150
|
+
'ended': 'ended',
|
|
151
|
+
'volume': 'volume',
|
|
152
|
+
'fullscreen': 'fullscreen',
|
|
153
|
+
'error': 'error',
|
|
154
|
+
'playbackstate': 'playbackstate',
|
|
155
|
+
'highdefinitionupdate': 'highdefinitionupdate',
|
|
156
|
+
'playbackdvrstatechanged': 'playbackdvrstatechanged'
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
get _defaultEvents() {
|
|
161
|
+
return [
|
|
162
|
+
'play',
|
|
163
|
+
'seek',
|
|
164
|
+
'pause',
|
|
165
|
+
'stop',
|
|
166
|
+
'ended',
|
|
167
|
+
'volume'
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
_hasEvent(e) {
|
|
172
|
+
return this._events.indexOf(e) !== -1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
_action(e) {
|
|
176
|
+
return this._eventMap[e];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
_value(v) {
|
|
180
|
+
if (this._setValue) {
|
|
181
|
+
return v;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
get position() {
|
|
186
|
+
return this.isLive ? 0 : this._position;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
get duration() {
|
|
190
|
+
return this.isLive ? 0 : this._container && this._container.getDuration();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
get isLive() {
|
|
194
|
+
return this._container.getPlaybackType() === Playback.LIVE;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
get isPlaying() {
|
|
198
|
+
return this._container.isPlaying();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
trunc(v) {
|
|
202
|
+
return parseInt(v, 10);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
onTimeUpdate(o){
|
|
206
|
+
this._position = o.current && this.trunc(o.current) || 0;
|
|
207
|
+
|
|
208
|
+
if (this.isLive || !this.isPlaying) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Check for "seconds" progress event
|
|
213
|
+
this._processGaSeconds && this.processGaSeconds(this._position);
|
|
214
|
+
|
|
215
|
+
// Check for "percent" progress event
|
|
216
|
+
this._processGaPercent && this.processGaPercent(this._position);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
processGaSeconds(pos) {
|
|
220
|
+
if (this._gaSecondsPrev !== pos && this._gaSeconds.indexOf(pos) !== -1) {
|
|
221
|
+
this._gaSecondsPrev = pos;
|
|
222
|
+
this.gaEvent(this._gaSecondsCat, this._gaSecondsAct(pos), this._label);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
processGaPercent(pos) {
|
|
227
|
+
// FIXME: check if (duration > 0) ?
|
|
228
|
+
const percent = this.trunc((pos * 100) / this.duration);
|
|
229
|
+
|
|
230
|
+
$.each(this._gaPercent, (i, v) => {
|
|
231
|
+
// Percentage value may never match expected value. To fix that, we compare to previous and current.
|
|
232
|
+
// This introduce a small approximation, but this function is called multiples time per seconds.
|
|
233
|
+
if (this._gaPercentPrev < v && percent >= v) {
|
|
234
|
+
this.gaEvent(this._gaPercentCat, this._gaPercentAct(v), this._label);
|
|
235
|
+
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
this._gaPercentPrev = percent;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
onReady() {
|
|
243
|
+
this.gaEvent(this._category, this._action('ready'), this._label);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
onBuffering() {
|
|
247
|
+
this.gaEvent(this._category, this._action('buffering'), this._label);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
onBufferFull() {
|
|
251
|
+
this.gaEvent(this._category, this._action('bufferfull'), this._label);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
onLoadedMetadata() {
|
|
255
|
+
this.gaEvent(this._category, this._action('loadedmetadata'), this._label);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
onPlay() {
|
|
259
|
+
if (this._gaPlayOnce) {
|
|
260
|
+
if (!this._doSendPlay) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
this._doSendPlay = false;
|
|
264
|
+
}
|
|
265
|
+
this.gaEvent(this._category, this._action('play'), this._label, this._value(this.position));
|
|
266
|
+
|
|
267
|
+
// Start "seconds" progress event timer (if LIVE playback type)
|
|
268
|
+
this.isLive && this._processGaSeconds && this._startGaSecondsTimer();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
_startGaSecondsTimer() {
|
|
272
|
+
if (this._gaSecondsTimerStarted) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
this._gaSecondsTimerStarted = true;
|
|
277
|
+
this._gaSecondsElapsed = 0;
|
|
278
|
+
this.processGaSeconds(this._gaSecondsElapsed);
|
|
279
|
+
this._gaSecondsTimerId = setInterval(() => {
|
|
280
|
+
this._gaSecondsElapsed++;
|
|
281
|
+
this.processGaSeconds(this._gaSecondsElapsed);
|
|
282
|
+
}, 1000);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
_stopGaSecondsTimer() {
|
|
286
|
+
clearInterval(this._gaSecondsTimerId);
|
|
287
|
+
this._gaSecondsPrev = -1;
|
|
288
|
+
this._gaSecondsTimerStarted = false;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
onSeek(pos) {
|
|
292
|
+
if (this._hasEvent('seek')) {
|
|
293
|
+
this.gaEvent(this._category, this._action('seek'), this._label, this._value(this.trunc(pos)));
|
|
294
|
+
}
|
|
295
|
+
if (this._gaPlayOnce) {
|
|
296
|
+
this._doSendPlay = true;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Adjust previous "percent" event value
|
|
300
|
+
if (!this.isLive && this._processGaPercent) {
|
|
301
|
+
this._gaPercentPrev = this.trunc((this.trunc(pos) * 100) / this.duration) - 1;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Stop "seconds" progress event timer (if LIVE playback type)
|
|
305
|
+
this.isLive && this._processGaSeconds && this._stopGaSecondsTimer();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
onPause() {
|
|
309
|
+
if (this._hasEvent('pause')) {
|
|
310
|
+
this.gaEvent(this._category, this._action('pause'), this._label, this._value(this.position));
|
|
311
|
+
}
|
|
312
|
+
if (this._gaPlayOnce) {
|
|
313
|
+
this._doSendPlay = true;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Stop "seconds" progress event timer (if LIVE playback type)
|
|
317
|
+
this.isLive && this._processGaSeconds && this._stopGaSecondsTimer();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
onStop() {
|
|
321
|
+
if (this._hasEvent('stop')) {
|
|
322
|
+
this.gaEvent(this._category, this._action('stop'), this._label, this._value(this.position));
|
|
323
|
+
}
|
|
324
|
+
if (this._gaPlayOnce) {
|
|
325
|
+
this._doSendPlay = true;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Stop "seconds" progress event timer (if LIVE playback type)
|
|
329
|
+
this.isLive && this._processGaSeconds && this._stopGaSecondsTimer();
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
onEnded() {
|
|
333
|
+
if (this._hasEvent('ended')) {
|
|
334
|
+
this.gaEvent(this._category, this._action('ended'), this._label, this._value(this.position));
|
|
335
|
+
}
|
|
336
|
+
if (this._gaPlayOnce) {
|
|
337
|
+
this._doSendPlay = true;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Check for video ended progress events
|
|
341
|
+
this._processGaSeconds && this.processGaSeconds(this.duration);
|
|
342
|
+
this._processGaPercent && this.processGaPercent(this.duration);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
onVolumeChanged(e) {
|
|
346
|
+
// Rate limit to avoid HTTP hammering
|
|
347
|
+
clearTimeout(this._volumeTimer);
|
|
348
|
+
this._volumeTimer = setTimeout(() => {
|
|
349
|
+
this.gaEvent(this._category, this._action('volume'), this._label, this._value(this.trunc(e)));
|
|
350
|
+
}, 400);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
onFullscreen() {
|
|
354
|
+
this.gaEvent(this._category, this._action('fullscreen'), this._label);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
onPlaybackChanged() {
|
|
358
|
+
this.gaEvent(this._category, this._action('playbackstate'), this._label);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
onHD() {
|
|
362
|
+
this.gaEvent(this._category, this._action('highdefinitionupdate'), this._label);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
onDVR() {
|
|
366
|
+
this.gaEvent(this._category, this._action('playbackdvrstatechanged'), this._label);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
resolveErrMsg(o) {
|
|
370
|
+
if (!this._gaExDesc) {
|
|
371
|
+
return 'error';
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
let msg;
|
|
375
|
+
|
|
376
|
+
if (typeof o.error === 'string') {
|
|
377
|
+
msg = o.error;
|
|
378
|
+
} else if ($.isPlainObject(o.error) && o.error.message) {
|
|
379
|
+
msg = o.error.message;
|
|
380
|
+
} else {
|
|
381
|
+
// FIXME: find out a more elegant way
|
|
382
|
+
msg = 'Error: ' + o.error;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return msg;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
onError(errorObj) {
|
|
389
|
+
if (this._gaEx) {
|
|
390
|
+
this.gaException(this.resolveErrMsg(errorObj), true);
|
|
391
|
+
} else {
|
|
392
|
+
this.gaEvent(this._category, this._action('error'), this._label);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Based on Google Analytics JavaScript Tracking Snippet
|
|
2
|
+
// See original @ https://developers.google.com/analytics/devguides/collection/analyticsjs/tracking-snippet-reference
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a temporary global ga object and lazy loads analytics.js.
|
|
6
|
+
* @function
|
|
7
|
+
* @param {string} Global name of analytics object. Defaults to 'ga'.
|
|
8
|
+
* @param {boolean} Set to true to load the debug version of the analytics.js library.
|
|
9
|
+
* @param {boolean} Set to true to enable trace debugging.
|
|
10
|
+
*/
|
|
11
|
+
export default function(name='ga', debug, trace) {
|
|
12
|
+
// Preserve renaming support and minification
|
|
13
|
+
const win = window, doc = document, el = 'script';
|
|
14
|
+
|
|
15
|
+
// Ensure analytics.js is not already loaded
|
|
16
|
+
if (win[name]) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (trace) {
|
|
21
|
+
win['ga_debug'] = { trace: true };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Acts as a pointer to support renaming
|
|
25
|
+
win.GoogleAnalyticsObject = name;
|
|
26
|
+
|
|
27
|
+
// Creates an initial ga() function
|
|
28
|
+
// The queued commands will be executed once analytics.js loads
|
|
29
|
+
win[name] = function() {
|
|
30
|
+
win[name].q.push(arguments);
|
|
31
|
+
};
|
|
32
|
+
win[name].q = [];
|
|
33
|
+
|
|
34
|
+
// Sets the time (as an integer) this tag was executed
|
|
35
|
+
// Used for timing hits
|
|
36
|
+
win[name].l = 1 * new Date();
|
|
37
|
+
|
|
38
|
+
// Insert script element above the first script element in document
|
|
39
|
+
// (async + https)
|
|
40
|
+
const first = doc.getElementsByTagName(el)[0];
|
|
41
|
+
const script = doc.createElement(el);
|
|
42
|
+
|
|
43
|
+
script.src = 'https://www.google-analytics.com/analytics' + (debug ? '_debug.js' : '.js');
|
|
44
|
+
script.async = true;
|
|
45
|
+
first.parentNode.insertBefore(script, first);
|
|
46
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
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 { Container, ContainerPlugin, Events } from '@clappr/core';
|
|
6
|
+
|
|
7
|
+
import { CLAPPR_VERSION } from '../build.js';
|
|
8
|
+
|
|
9
|
+
declare const _gaq: {
|
|
10
|
+
push(args: string[]): void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export class GoogleAnalytics extends ContainerPlugin {
|
|
14
|
+
private account: string = '';
|
|
15
|
+
|
|
16
|
+
private trackerName: string = '';
|
|
17
|
+
|
|
18
|
+
private domainName: string = '';
|
|
19
|
+
|
|
20
|
+
private currentHDState: string | undefined
|
|
21
|
+
|
|
22
|
+
get name() {
|
|
23
|
+
return 'google_analytics';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get supportedVersion() {
|
|
27
|
+
return { min: CLAPPR_VERSION };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
constructor(container: Container) {
|
|
31
|
+
super(container);
|
|
32
|
+
if (this.container.options.gaAccount) {
|
|
33
|
+
this.account = this.container.options.gaAccount;
|
|
34
|
+
this.trackerName = (this.container.options.gaTrackerName) ? this.container.options.gaTrackerName + '.' : 'Player.';
|
|
35
|
+
this.domainName = this.container.options.gaDomainName;
|
|
36
|
+
this.embedScript();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
embedScript() {
|
|
41
|
+
if (!('_gat' in window)) { // TODO
|
|
42
|
+
const script = document.createElement('script');
|
|
43
|
+
|
|
44
|
+
script.setAttribute('type', 'text/javascript');
|
|
45
|
+
script.setAttribute('async', 'async');
|
|
46
|
+
script.setAttribute('src', '//www.google-analytics.com/ga.js');
|
|
47
|
+
script.onload = () => this.addEventListeners();
|
|
48
|
+
document.body.appendChild(script);
|
|
49
|
+
} else {
|
|
50
|
+
this.addEventListeners();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
addEventListeners() {
|
|
55
|
+
if (this.container) {
|
|
56
|
+
this.listenTo(this.container, Events.CONTAINER_READY, this.onReady);
|
|
57
|
+
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay);
|
|
58
|
+
this.listenTo(this.container, Events.CONTAINER_STOP, this.onStop);
|
|
59
|
+
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.onPause);
|
|
60
|
+
this.listenTo(this.container, Events.CONTAINER_ENDED, this.onEnded);
|
|
61
|
+
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering);
|
|
62
|
+
this.listenTo(this.container, Events.CONTAINER_STATE_BUFFERFULL, this.onBufferFull);
|
|
63
|
+
this.listenTo(this.container, Events.CONTAINER_ERROR, this.onError);
|
|
64
|
+
this.listenTo(this.container, Events.CONTAINER_PLAYBACKSTATE, this.onPlaybackChanged);
|
|
65
|
+
this.listenTo(this.container, Events.CONTAINER_VOLUME, this.onVolumeChanged);
|
|
66
|
+
this.listenTo(this.container, Events.CONTAINER_SEEK, this.onSeek);
|
|
67
|
+
this.listenTo(this.container, Events.CONTAINER_FULLSCREEN, this.onFullscreen);
|
|
68
|
+
this.listenTo(this.container, Events.CONTAINER_HIGHDEFINITIONUPDATE, this.onHD);
|
|
69
|
+
this.listenTo(this.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.onDVR);
|
|
70
|
+
}
|
|
71
|
+
_gaq.push([this.trackerName + '_setAccount', this.account]);
|
|
72
|
+
if (this.domainName) {
|
|
73
|
+
_gaq.push([this.trackerName + '_setDomainName', this.domainName]);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onReady() {
|
|
78
|
+
this.push(['Video', 'Playback', this.container.playback.name]);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
onPlay() {
|
|
82
|
+
this.push(['Video', 'Play', this.container.playback.src]);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
onStop() {
|
|
86
|
+
this.push(['Video', 'Stop', this.container.playback.src]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
onEnded() {
|
|
90
|
+
this.push(['Video', 'Ended', this.container.playback.src]);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
onBuffering() {
|
|
94
|
+
this.push(['Video', 'Buffering', this.container.playback.src]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
onBufferFull() {
|
|
98
|
+
this.push(['Video', 'Bufferfull', this.container.playback.src]);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
onError() {
|
|
102
|
+
this.push(['Video', 'Error', this.container.playback.src]);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
onHD(isHD: boolean) {
|
|
106
|
+
const status = isHD ? 'ON': 'OFF';
|
|
107
|
+
|
|
108
|
+
if (status !== this.currentHDState) {
|
|
109
|
+
this.currentHDState = status;
|
|
110
|
+
this.push(['Video', 'HD - ' + status, this.container.playback.src]);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private onPlaybackChanged(playbackState: { type: string | null }) {
|
|
115
|
+
if (playbackState.type !== null) {
|
|
116
|
+
this.push(['Video', 'Playback Type - ' + playbackState.type, this.container.playback.src]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
onDVR(dvrInUse: boolean) {
|
|
121
|
+
const status = dvrInUse? 'ON': 'OFF';
|
|
122
|
+
|
|
123
|
+
this.push(['Interaction', 'DVR - ' + status, this.container.playback.src]);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
onPause() {
|
|
127
|
+
this.push(['Video', 'Pause', this.container.playback.src]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
onSeek() {
|
|
131
|
+
this.push(['Video', 'Seek', this.container.playback.src]);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
onVolumeChanged() {
|
|
135
|
+
this.push(['Interaction', 'Volume', this.container.playback.src]);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
onFullscreen() {
|
|
139
|
+
this.push(['Interaction', 'Fullscreen', this.container.playback.src]);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
push(array: string[]) {
|
|
143
|
+
const res = [this.trackerName + '_trackEvent'].concat(array);
|
|
144
|
+
|
|
145
|
+
_gaq.push(res);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @beta
|
|
4
|
+
* A collection of plugins for the Gcore video player
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import '../assets/style/main.scss';
|
|
8
|
+
|
|
9
|
+
export * from "./audio-selector/AudioSelector.js";
|
|
10
|
+
export * from "./big-mute-button/BigMuteButton.js";
|
|
11
|
+
export * from "./bottom-gear/BottomGear.js";
|
|
12
|
+
export * from "./clappr-nerd-stats/ClapprNerdStats.js";
|
|
13
|
+
export * from "./clappr-stats/ClapprStats.js";
|
|
14
|
+
export * from "./click-to-pause/ClickToPause.js";
|
|
15
|
+
export * from "./clips/Clips.js";
|
|
16
|
+
export * from "./context-menu/ContextMenu.js";
|
|
17
|
+
export * from "./disable-controls/DisableControls.js";
|
|
18
|
+
export * from "./dvr-controls/DvrControls.js";
|
|
19
|
+
export * from "./error-screen/ErrorScreen.js";
|
|
20
|
+
export * from "./favicon/Favicon.js";
|
|
21
|
+
// _ ga-events
|
|
22
|
+
export * from "./google-analytics/GoogleAnalytics.js";
|
|
23
|
+
export * from "./kibo/index.js";
|
|
24
|
+
export * from "./level-selector/LevelSelector.js";
|
|
25
|
+
export * from "./logo/Logo.js";
|
|
26
|
+
export * from "./media-control/MediaControl.js";
|
|
27
|
+
export * from "./multi-camera/MultiCamera.js";
|
|
28
|
+
export * from "./picture-in-picture/PictureInPicture.js";
|
|
29
|
+
export * from "./playback-rate/PlaybackRate.js";
|
|
30
|
+
export * from "./poster/Poster.js";
|
|
31
|
+
export * from "./seek-time/SeekTime.js";
|
|
32
|
+
export * from "./share/Share.js";
|
|
33
|
+
export * from "./skip-time/SkipTime.js";
|
|
34
|
+
export * from "./spinner-three-bounce/SpinnerThreeBounce.js";
|
|
35
|
+
export * from "./statistics/Statistics.js";
|
|
36
|
+
export * from "./subtitles/Subtitles.js";
|
|
37
|
+
export * from "./thumbnails/Thumbnails.js";
|
|
38
|
+
export { setTracer} from "@gcorevideo/utils";
|
|
39
|
+
export * from "./source-controller/SourceController.js";
|
|
40
|
+
// _ vast-ads
|
|
41
|
+
// _ video360
|
|
42
|
+
export * from "./volume-fade/VolumeFade.js";
|