hr-design-system-handlebars 0.50.8 → 0.51.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/.storybook/main.js +2 -2
- package/CHANGELOG.md +12 -0
- package/build/scripts/build.js +1 -0
- package/dist/assets/js/views/components/audio/audioElementDs.subfeature.js +127 -0
- package/dist/assets/js/views/components/externalService/trackingCookieDs.subfeature.js +37 -0
- package/dist/assets/js/views/components/mediaplayer/mediaplayerLoaderDs.feature.js +98 -0
- package/dist/assets/js/views/components/video/livestream/videoLivestreamDs.subfeature.js +263 -0
- package/dist/assets/js/views/components/video/videoOnDemandPlayerDs.subfeature.js +369 -0
- package/dist/views/base/tracking/{atiHelperDs.js → atiHelper.subfeature.js} +0 -1
- package/{src/stories/views/base/tracking/atiMediaHelperDs.js → dist/views/base/tracking/atiMediaHelper.subfeature.js} +1 -1
- package/dist/views/components/audio/audioElementDs.subfeature.js +6 -6
- package/dist/views/components/externalService/trackingCookieDs.subfeature.js +1 -1
- package/dist/views/components/foo.feature.js +1 -1
- package/dist/views/components/generic/{hrQueryDs.js → hrQuery.subfeature.js} +0 -0
- package/dist/views/components/mediaplayer/mediaplayerLoaderDs.feature.js +36 -38
- package/dist/views/components/video/livestream/videoLivestreamDs.subfeature.js +4 -4
- package/dist/views/components/video/videoOnDemandPlayerDs.subfeature.js +7 -9
- package/package.json +1 -1
- package/src/stories/views/base/tracking/{atiHelperDs.js → atiHelper.subfeature.js} +0 -1
- package/{dist/views/base/tracking/atiMediaHelperDs.js → src/stories/views/base/tracking/atiMediaHelper.subfeature.js} +1 -1
- package/src/stories/views/components/audio/audioElementDs.subfeature.js +6 -6
- package/src/stories/views/components/externalService/trackingCookieDs.subfeature.js +1 -1
- package/src/stories/views/components/foo.feature.js +1 -1
- package/src/stories/views/components/generic/{hrQueryDs.js → hrQuery.subfeature.js} +0 -0
- package/src/stories/views/components/mediaplayer/mediaplayerLoaderDs.feature.js +36 -38
- package/src/stories/views/components/video/livestream/videoLivestreamDs.subfeature.js +4 -4
- package/src/stories/views/components/video/videoOnDemandPlayerDs.subfeature.js +7 -9
package/.storybook/main.js
CHANGED
|
@@ -36,9 +36,9 @@ module.exports = {
|
|
|
36
36
|
components: path.resolve(__dirname, '../src/stories/views/components'),
|
|
37
37
|
base: path.resolve(__dirname, '../src/stories/views/base'),
|
|
38
38
|
tailwind$: path.resolve(__dirname, '../src/assets/tailwind.css'),
|
|
39
|
-
|
|
39
|
+
hrQuery$: path.resolve(
|
|
40
40
|
__dirname,
|
|
41
|
-
'../src/stories/views/components/generic/
|
|
41
|
+
'../src/stories/views/components/generic/hrQuery.subfeature.js'
|
|
42
42
|
),
|
|
43
43
|
initializer$: path.resolve(
|
|
44
44
|
__dirname,
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v0.51.0 (Wed Jul 27 2022)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- Feature/dpe 1567 [#286](https://github.com/mumprod/hr-design-system-handlebars/pull/286) ([@szuelch](https://github.com/szuelch))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- [@szuelch](https://github.com/szuelch)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v0.50.8 (Wed Jul 27 2022)
|
|
2
14
|
|
|
3
15
|
#### 🐛 Bug Fix
|
package/build/scripts/build.js
CHANGED
|
@@ -7,4 +7,5 @@ const run = (cmd) => execSync(cmd, { stdio: 'inherit', cwd: root })
|
|
|
7
7
|
// Copy hbs files into the dist folder
|
|
8
8
|
run(`npx copyfiles \"./src/index.js\" dist --up=1`)
|
|
9
9
|
run(`npx copyfiles \"./src/stories/views/**/*.{js,hbs}\" dist --up=2`)
|
|
10
|
+
run(`npx copyfiles \"./src/stories/views/**/*Ds.{feature,subfeature}.js\" dist/assets/js --up=2`)
|
|
10
11
|
run(`npx copyfiles \"./src/assets/**/*.{woff,svg}\" dist --up=1`)
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { fireEvent, hr$, listen } from 'hrQuery'
|
|
2
|
+
import { uxAction } from 'base/tracking/atiHelper.subfeature'
|
|
3
|
+
import ATIMediaHelper from 'base/tracking/atiMediaHelper.subfeature'
|
|
4
|
+
|
|
5
|
+
const AudioElement = function (options, rootElement) {
|
|
6
|
+
'use strict'
|
|
7
|
+
|
|
8
|
+
const audio = hr$('audio', rootElement)[0],
|
|
9
|
+
downloadInfo = hr$('.audioElement__downloadInfo', rootElement)[0],
|
|
10
|
+
downloadText = hr$('.audioElement__downloadText', rootElement)[0],
|
|
11
|
+
mediaTracking = new ATIMediaHelper(
|
|
12
|
+
'audio',
|
|
13
|
+
options.mediaMetadata.ati.pageName,
|
|
14
|
+
options.mediaMetadata.ati.secondLevelId,
|
|
15
|
+
options.mediaMetadata.agf.length,
|
|
16
|
+
options.mediaMetadata.ati.documentName,
|
|
17
|
+
options.mediaMetadata.ati.documentType,
|
|
18
|
+
options.mediaMetadata.ati.documentDate,
|
|
19
|
+
options.mediaMetadata.ati.chapter
|
|
20
|
+
)
|
|
21
|
+
let autoplay = options.autoplay || false,
|
|
22
|
+
isPlaying = false
|
|
23
|
+
|
|
24
|
+
const errorHandling = function (e) {
|
|
25
|
+
console.dir(audio)
|
|
26
|
+
|
|
27
|
+
if (audio.canPlayType && audio.canPlayType('audio/mpeg').length <= 0) {
|
|
28
|
+
showPlaybackNotSupported()
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
switch (audio.networkState) {
|
|
33
|
+
//file not found - 404
|
|
34
|
+
case HTMLMediaElement.NETWORK_NO_SOURCE:
|
|
35
|
+
showFileNotFound()
|
|
36
|
+
return
|
|
37
|
+
|
|
38
|
+
default:
|
|
39
|
+
break
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//falls es mit einem event aufgerufen wurde
|
|
43
|
+
//und bis hierhin kam gibt es einen generellen fehler
|
|
44
|
+
if (e) {
|
|
45
|
+
showGeneralError()
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
const showGeneralError = function () {
|
|
52
|
+
console.log('Audio: Error')
|
|
53
|
+
downloadText.innerHTML = options.playbackError
|
|
54
|
+
rootElement.insertBefore(downloadInfo, rootElement.firstChild)
|
|
55
|
+
downloadInfo.style.display = 'inline-block'
|
|
56
|
+
|
|
57
|
+
uxAction('audioPlayer', 'generalError')
|
|
58
|
+
}
|
|
59
|
+
const showFileNotFound = function () {
|
|
60
|
+
console.log('Audio: File Not Found')
|
|
61
|
+
downloadInfo.innerHTML = options.playbackFileNotFound
|
|
62
|
+
rootElement.insertBefore(downloadInfo, rootElement.firstChild)
|
|
63
|
+
downloadInfo.style.display = 'inline-block'
|
|
64
|
+
|
|
65
|
+
uxAction('audioPlayer', 'fileNotFound')
|
|
66
|
+
}
|
|
67
|
+
const showPlaybackNotSupported = function () {
|
|
68
|
+
console.log('Audio: Playback unsupported')
|
|
69
|
+
downloadText.innerHTML = options.playbackUnsupported
|
|
70
|
+
rootElement.insertBefore(downloadInfo, rootElement.firstChild)
|
|
71
|
+
downloadInfo.style.display = 'inline-block'
|
|
72
|
+
|
|
73
|
+
uxAction('audioPlayer', 'playbackNotSupported')
|
|
74
|
+
}
|
|
75
|
+
const shouldIStopPlaying = function (event) {
|
|
76
|
+
console.log(event.detail)
|
|
77
|
+
if (event.detail != audio && isPlaying) {
|
|
78
|
+
audio.pause()
|
|
79
|
+
pauseAudio(event)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const startAudio = function (e) {
|
|
83
|
+
console.log('start')
|
|
84
|
+
uxAction('audioPlayer', 'audioPlay')
|
|
85
|
+
mediaTracking.trackInitialMediaPlay()
|
|
86
|
+
fireEvent('hr:global:stopOtherAVs', audio, true)
|
|
87
|
+
isPlaying = true
|
|
88
|
+
const geotag = hr$('.js-geotag', rootElement)[0]
|
|
89
|
+
if (typeof geotag != 'undefined') {
|
|
90
|
+
geotag.classList.add('hide')
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const pauseAudio = function (e) {
|
|
94
|
+
console.log('pause')
|
|
95
|
+
const ended = e.target.ended
|
|
96
|
+
isPlaying = false
|
|
97
|
+
if (!ended) {
|
|
98
|
+
uxAction('audioPlayer', 'pause')
|
|
99
|
+
} else {
|
|
100
|
+
uxAction('audioPlayer', 'ended')
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//falls ein fehler auftrat bevor das js, geladen wurde
|
|
105
|
+
errorHandling()
|
|
106
|
+
|
|
107
|
+
listen('error', errorHandling, rootElement)
|
|
108
|
+
listen('play', startAudio, audio)
|
|
109
|
+
listen('pause', pauseAudio, audio)
|
|
110
|
+
|
|
111
|
+
if (autoplay) {
|
|
112
|
+
audio.play()
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
listen('hr:global:stopOtherAVs', shouldIStopPlaying)
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
play: function () {
|
|
119
|
+
audio.play()
|
|
120
|
+
},
|
|
121
|
+
pause: function () {
|
|
122
|
+
audio.pause()
|
|
123
|
+
},
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export default AudioElement
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getJSONCookie, setJSONCookie } from 'hrQuery'
|
|
2
|
+
|
|
3
|
+
const TrackingCookie = function () {
|
|
4
|
+
let cookie = {}
|
|
5
|
+
const trackingCookieLifetime = 1000 * 60 * 60 * 24 * 365 * 10 /* 10 years */
|
|
6
|
+
|
|
7
|
+
const setCookieForTracking = function (trackingService, state) {
|
|
8
|
+
if (state == null) {
|
|
9
|
+
state = true
|
|
10
|
+
}
|
|
11
|
+
console.log('Schreibe Cookie: ' + trackingService + ': ' + state)
|
|
12
|
+
readTrackingCookie()
|
|
13
|
+
cookie[trackingService] = state
|
|
14
|
+
writeTrackingCookie()
|
|
15
|
+
}
|
|
16
|
+
const isTrackingAccepted = function (trackingService) {
|
|
17
|
+
readTrackingCookie()
|
|
18
|
+
return cookie[trackingService] === true
|
|
19
|
+
}
|
|
20
|
+
const writeTrackingCookie = function () {
|
|
21
|
+
setJSONCookie('tracking', cookie, trackingCookieLifetime)
|
|
22
|
+
}
|
|
23
|
+
const readTrackingCookie = function () {
|
|
24
|
+
cookie = getJSONCookie('tracking') || {}
|
|
25
|
+
}
|
|
26
|
+
const isTrackingCookieExistent = function (trackingService) {
|
|
27
|
+
readTrackingCookie()
|
|
28
|
+
return cookie.hasOwnProperty(trackingService)
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
setCookieForTracking: setCookieForTracking,
|
|
32
|
+
isTrackingAccepted: isTrackingAccepted,
|
|
33
|
+
isTrackingCookieExistent: isTrackingCookieExistent,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default TrackingCookie
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { hr$, listenOnce, fireEvent, listen } from 'hrQuery'
|
|
2
|
+
import { uxAction } from 'base/tracking/atiHelper.subfeature'
|
|
3
|
+
import VideoOnDemandPlayer from 'components/video/videoOnDemandPlayerDs.subfeature'
|
|
4
|
+
import AudioElement from 'components/audio/audioElementDs.subfeature'
|
|
5
|
+
import VideoLivestream from 'components/video/livestream/videoLivestreamDs.subfeature'
|
|
6
|
+
|
|
7
|
+
const MediaplayerLoader = function (context) {
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
const { options } = context,
|
|
11
|
+
{ element: rootElement } = context,
|
|
12
|
+
type = options.type,
|
|
13
|
+
position = options.position,
|
|
14
|
+
teaserSize = options.teaserSize,
|
|
15
|
+
config = options.config,
|
|
16
|
+
audioContent = hr$('.js-audioElement__audio', rootElement)[0],
|
|
17
|
+
rootParent = rootElement.parentNode,
|
|
18
|
+
mediaplayerButton = hr$('.js-mediaplayer__button', rootParent)[0]
|
|
19
|
+
|
|
20
|
+
let avObject = false
|
|
21
|
+
console.log('MediaplayerLoader', options)
|
|
22
|
+
|
|
23
|
+
const unloadPlayer = function () {
|
|
24
|
+
console.log('video.pause()')
|
|
25
|
+
avObject.pause()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const loadLivestream = function () {
|
|
29
|
+
if (!avObject) {
|
|
30
|
+
console.log('load Livestream')
|
|
31
|
+
avObject = new VideoLivestream(options)
|
|
32
|
+
uxAction('mediabuttonclick::' + teaserSize + '::playButtonClick')
|
|
33
|
+
listenOnce('player_colosed', unloadPlayer)
|
|
34
|
+
} else {
|
|
35
|
+
console.log('video.play()')
|
|
36
|
+
listenOnce('player_colosed', unloadPlayer)
|
|
37
|
+
avObject.play()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const loadOnDemand = function () {
|
|
42
|
+
if (!avObject) {
|
|
43
|
+
console.log('load OnDemand')
|
|
44
|
+
avObject = new VideoOnDemandPlayer(options)
|
|
45
|
+
uxAction('mediabuttonclick::' + teaserSize + '::playButtonClick')
|
|
46
|
+
listenOnce('player_colosed', unloadPlayer)
|
|
47
|
+
} else {
|
|
48
|
+
console.log('video.play()')
|
|
49
|
+
listenOnce('player_colosed', unloadPlayer)
|
|
50
|
+
avObject.play()
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const loadAudio = function () {
|
|
55
|
+
if (!avObject) {
|
|
56
|
+
console.log('load Audio')
|
|
57
|
+
avObject = new AudioElement(options, rootElement)
|
|
58
|
+
uxAction('mediabuttonclick::' + teaserSize + '::playButtonClick')
|
|
59
|
+
listenOnce('player_colosed', unloadPlayer)
|
|
60
|
+
} else {
|
|
61
|
+
console.log('Audio.play()')
|
|
62
|
+
listenOnce('player_colosed', unloadPlayer)
|
|
63
|
+
avObject.play()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
switch (type) {
|
|
68
|
+
case 'live':
|
|
69
|
+
console.log('live')
|
|
70
|
+
if (position === 'teaser') {
|
|
71
|
+
listen('click', loadLivestream, mediaplayerButton)
|
|
72
|
+
} else {
|
|
73
|
+
loadLivestream()
|
|
74
|
+
}
|
|
75
|
+
break
|
|
76
|
+
|
|
77
|
+
case 'ondemand':
|
|
78
|
+
console.log('ondemand')
|
|
79
|
+
if (position === 'teaser') {
|
|
80
|
+
// listenOnce('click', loadOnDemand, mediaplayerButton)
|
|
81
|
+
listen('click', loadOnDemand, mediaplayerButton)
|
|
82
|
+
} else {
|
|
83
|
+
loadOnDemand()
|
|
84
|
+
}
|
|
85
|
+
break
|
|
86
|
+
|
|
87
|
+
case 'audio':
|
|
88
|
+
console.log('audio')
|
|
89
|
+
if (position === 'teaser') {
|
|
90
|
+
listen('click', loadAudio, mediaplayerButton)
|
|
91
|
+
} else {
|
|
92
|
+
audioContent.classList.remove('hide')
|
|
93
|
+
new AudioElement(options, rootElement)
|
|
94
|
+
}
|
|
95
|
+
break
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export default MediaplayerLoader
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { fireEvent, hr$, listen, loadScript } from 'hrQuery'
|
|
2
|
+
import TrackingCookie from 'components/externalService/trackingCookieDs.subfeature'
|
|
3
|
+
|
|
4
|
+
const VideoLivestream = function (options, rootElement) {
|
|
5
|
+
'use strict'
|
|
6
|
+
|
|
7
|
+
const config = options.config,
|
|
8
|
+
isTeaser = options.position && options.position === 'teaser',
|
|
9
|
+
skinPath = config.skinPath,
|
|
10
|
+
streamUrl = config.streamUrl,
|
|
11
|
+
agfMetadata = config.mediaMetadata.agf,
|
|
12
|
+
agfAppId = config.agfAppId,
|
|
13
|
+
atiMetadata = config.mediaMetadata.ati,
|
|
14
|
+
ardplayerUrl = config.ardplayerUrl,
|
|
15
|
+
smarttagUrl = config.smarttagUrl,
|
|
16
|
+
basePlayerUrl = config.baseUrl,
|
|
17
|
+
previewImageUrl = config.previewImageUrl,
|
|
18
|
+
playerId = config.containerId,
|
|
19
|
+
hasOverlay = config.overlay == 'true',
|
|
20
|
+
overlay = hasOverlay == true ? hr$('.overlay-' + config.overlayId)[0] : '',
|
|
21
|
+
trackingCookie = new TrackingCookie(),
|
|
22
|
+
autoplay = config.autoplay || false
|
|
23
|
+
let sourceNode, player, mediaCollection, playerConfig
|
|
24
|
+
const fetchPlayerStyle = function (url, id) {
|
|
25
|
+
return new Promise(function (resolve, reject) {
|
|
26
|
+
if (document.getElementById(id)) {
|
|
27
|
+
resolve()
|
|
28
|
+
console.log('style was already loaded before')
|
|
29
|
+
} else {
|
|
30
|
+
var link = document.createElement('link')
|
|
31
|
+
link.type = 'text/css'
|
|
32
|
+
link.rel = 'stylesheet'
|
|
33
|
+
link.id = id
|
|
34
|
+
link.onload = function () {
|
|
35
|
+
resolve()
|
|
36
|
+
console.log('style has loaded')
|
|
37
|
+
}
|
|
38
|
+
link.href = url
|
|
39
|
+
|
|
40
|
+
var headScript = document.querySelector('script')
|
|
41
|
+
headScript.parentNode.insertBefore(link, headScript)
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
const initPlayer = function (mediaStreams) {
|
|
46
|
+
loadArdPlayerScript()
|
|
47
|
+
|
|
48
|
+
loadScriptsForAddons()
|
|
49
|
+
|
|
50
|
+
createMediaCollection()
|
|
51
|
+
|
|
52
|
+
createPlayerConfig()
|
|
53
|
+
|
|
54
|
+
whenAvailable('ardplayer', function () {
|
|
55
|
+
player = new ardplayer.Player(playerId, playerConfig, mediaCollection)
|
|
56
|
+
bindPlayerEvents()
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
const whenAvailable = function (name, callback) {
|
|
60
|
+
const interval = 100 // ms
|
|
61
|
+
const intervalId = window.setInterval(function () {
|
|
62
|
+
if (window[name]) {
|
|
63
|
+
window.clearInterval(intervalId)
|
|
64
|
+
callback(window[name])
|
|
65
|
+
}
|
|
66
|
+
}, interval)
|
|
67
|
+
}
|
|
68
|
+
const loadArdPlayerScript = function () {
|
|
69
|
+
loadScript('js-ardplayerHr', ardplayerUrl)
|
|
70
|
+
}
|
|
71
|
+
const loadScriptsForAddons = function () {
|
|
72
|
+
if (trackingCookie.isTrackingAccepted('ati')) {
|
|
73
|
+
loadScript('js-smarttagProd', smarttagUrl)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const createMediaCollection = function () {
|
|
77
|
+
mediaCollection = {
|
|
78
|
+
_type: 'video',
|
|
79
|
+
_isLive: true,
|
|
80
|
+
_dvrEnabled: true,
|
|
81
|
+
_defaultQuality: 'auto',
|
|
82
|
+
_previewImage: previewImageUrl,
|
|
83
|
+
_mediaArray: [
|
|
84
|
+
{
|
|
85
|
+
_plugin: 1,
|
|
86
|
+
|
|
87
|
+
_mediaStreamArray: [
|
|
88
|
+
{
|
|
89
|
+
_quality: 'auto',
|
|
90
|
+
_server: '',
|
|
91
|
+
_stream: streamUrl,
|
|
92
|
+
_cdn: '',
|
|
93
|
+
_label: 'live',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const createPlayerConfig = function () {
|
|
101
|
+
playerConfig = {
|
|
102
|
+
_representationArray: [
|
|
103
|
+
{
|
|
104
|
+
_representationClass: 'm',
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
_streamed_webvtt_enabled: true,
|
|
108
|
+
_autoplay: autoplay,
|
|
109
|
+
_showOptions: true,
|
|
110
|
+
_showOptions_Plugins: true,
|
|
111
|
+
_showOptions_Quality: true,
|
|
112
|
+
_startTime: 0,
|
|
113
|
+
_endTime: null,
|
|
114
|
+
_autosave: true,
|
|
115
|
+
_baseUrl: basePlayerUrl,
|
|
116
|
+
_rememberCurrentTime: true,
|
|
117
|
+
_showSubtitelAtStart: false,
|
|
118
|
+
_forceControlBarVisible: false,
|
|
119
|
+
_initialVolume: 1,
|
|
120
|
+
_pixelConfig: createPixelConfig(),
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const createPixelConfig = function () {
|
|
124
|
+
const atiConfig = {
|
|
125
|
+
tracker: 'ATIdebug',
|
|
126
|
+
tagConfig: {
|
|
127
|
+
site: atiMetadata.atiSiteId,
|
|
128
|
+
collectDomainSSL: atiMetadata.atiTrackingHost
|
|
129
|
+
? atiMetadata.atiTrackingHost.substring(
|
|
130
|
+
atiMetadata.atiTrackingHost.lastIndexOf('/') + 1
|
|
131
|
+
) + '.xiti.com'
|
|
132
|
+
: '',
|
|
133
|
+
cookieSecure: 'https:' === document.location.protocol,
|
|
134
|
+
secure: 'true',
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
clipData: {
|
|
138
|
+
mediaType: 'video',
|
|
139
|
+
playerId: playerId,
|
|
140
|
+
mediaLevel2: atiMetadata.secondLevelId,
|
|
141
|
+
mediaTheme1: 'Live',
|
|
142
|
+
mediaLabel: atiMetadata.mediaLabel,
|
|
143
|
+
duration: '',
|
|
144
|
+
broadcastMode: 'live',
|
|
145
|
+
debug: 'true',
|
|
146
|
+
},
|
|
147
|
+
playclickData: {
|
|
148
|
+
name: atiMetadata.mediaLabel + ':video:videoPlay',
|
|
149
|
+
chapter1: 'Video-Start',
|
|
150
|
+
chapter2: 'Live',
|
|
151
|
+
customVars: {
|
|
152
|
+
site: {
|
|
153
|
+
1: atiMetadata.documentName,
|
|
154
|
+
2: atiMetadata.documentType,
|
|
155
|
+
5: atiMetadata.documentDate,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
playclick: true,
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const agfConfig = {
|
|
164
|
+
tracker: 'AGF',
|
|
165
|
+
|
|
166
|
+
// Offizielle Customer ID, für Prod vorne P,
|
|
167
|
+
appId: agfAppId,
|
|
168
|
+
|
|
169
|
+
// required for multiple players on one page
|
|
170
|
+
playerID: playerId,
|
|
171
|
+
clipData: {
|
|
172
|
+
type: agfMetadata.type, //static?
|
|
173
|
+
|
|
174
|
+
assetid: agfMetadata.assetid,
|
|
175
|
+
program: agfMetadata.program,
|
|
176
|
+
title: agfMetadata.title, // valid chars filtern
|
|
177
|
+
length: agfMetadata.length,
|
|
178
|
+
|
|
179
|
+
// Mandatory Custom Properties
|
|
180
|
+
// nol_c0: 'p0,0', // entry_index || "0"
|
|
181
|
+
nol_c2: agfMetadata.nol_c2, // flag webonly
|
|
182
|
+
nol_c5: agfMetadata.nol_c5, // Domain
|
|
183
|
+
nol_c7: agfMetadata.nol_c7, // Clip CRID
|
|
184
|
+
nol_c8: agfMetadata.nol_c8, // 28:54 -> sek
|
|
185
|
+
// Sendereihe, Cliptitel, PubDate yyyy.mm.dd hh:mm
|
|
186
|
+
nol_c9: agfMetadata.nol_c9,
|
|
187
|
+
nol_c10: agfMetadata.nol_c10, // Kanal
|
|
188
|
+
nol_c12: agfMetadata.nol_c12,
|
|
189
|
+
|
|
190
|
+
nol_c15: agfMetadata.nol_c15 || '', // entry_agffmt
|
|
191
|
+
nol_c16: agfMetadata.nol_c16 || '',
|
|
192
|
+
|
|
193
|
+
nol_c18: agfMetadata.nol_c18,
|
|
194
|
+
nol_c20: agfMetadata.nol_c20,
|
|
195
|
+
},
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
let pixelConfig = []
|
|
199
|
+
if (trackingCookie.isTrackingAccepted('agf')) {
|
|
200
|
+
pixelConfig.push(agfConfig)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (trackingCookie.isTrackingAccepted('ati')) {
|
|
204
|
+
pixelConfig.push(atiConfig)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return pixelConfig
|
|
208
|
+
}
|
|
209
|
+
const bindPlayerEvents = function () {
|
|
210
|
+
player.$.on(ardplayer.Player.EVENT_PLAY_STREAM, function (event) {
|
|
211
|
+
switchOverlay()
|
|
212
|
+
fireEvent('hr:global:stopOtherAVs', 'ardplayer', true)
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
player.$.on(ardplayer.Player.SETUP_VIEW_COMPLETE, function (event) {
|
|
216
|
+
if (isTeaser) {
|
|
217
|
+
player.play()
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
player.$.on(ardplayer.Player.EVENT_PAUSE_STREAM, function (event) {
|
|
222
|
+
switchOverlay()
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
player.$.on(ardplayer.Player.EVENT_STOP_STREAM, function (event) {
|
|
226
|
+
switchOverlay()
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
listen('hr:global:stopOtherAVs', function (event) {
|
|
230
|
+
if (event.detail != 'ardplayer') {
|
|
231
|
+
player.pause()
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
const switchOverlay = function () {
|
|
236
|
+
if (hasOverlay && typeof overlay !== 'undefined') {
|
|
237
|
+
if (overlay.classList.contains('hideOverlay')) {
|
|
238
|
+
overlay.classList.remove('hideOverlay')
|
|
239
|
+
} else {
|
|
240
|
+
overlay.classList.add('hideOverlay')
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (window.gfkConnector && trackingCookie.isTrackingAccepted('agf') && agfMetadata) {
|
|
245
|
+
gfkConnector.init(function (gfkLinkID) {
|
|
246
|
+
agfMetadata.nol_c20 = 'p20,' + gfkLinkID
|
|
247
|
+
fetchPlayerStyle(skinPath).then(initPlayer())
|
|
248
|
+
})
|
|
249
|
+
} else {
|
|
250
|
+
fetchPlayerStyle(skinPath).then(initPlayer())
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return {
|
|
254
|
+
play: function () {
|
|
255
|
+
player.play()
|
|
256
|
+
},
|
|
257
|
+
pause: function () {
|
|
258
|
+
player.pause()
|
|
259
|
+
},
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export default VideoLivestream
|