@internetstiftelsen/styleguide 2.24.30-beta.0.1 → 2.24.30-beta.0.2
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/dist/organisms/video-guide/VideoGuidePlayback.js +250 -0
- package/dist/organisms/video-guide/VideoGuideSubtitles.js +67 -0
- package/dist/organisms/video-guide/VideoGuideTimeline.js +100 -0
- package/dist/organisms/video-guide/getCurrentCueIndex.js +13 -0
- package/dist/organisms/video-guide/video-guide.js +73 -239
- package/package.json +1 -1
- package/src/assets/video/guidad-tur-nar-internet-kom-chapters.vtt +22 -0
- package/src/assets/video/guidad-tur-nar-internet-kom-metadata.vtt +89 -0
- package/src/assets/video/guidad-tur-nar-internet-kom-till-svenska-hem-undertexter.vtt +474 -0
- package/src/organisms/timeline/_timeline.scss +1 -0
- package/src/organisms/video-guide/VideoGuidePlayback.js +213 -0
- package/src/organisms/video-guide/VideoGuideSubtitles.js +43 -0
- package/src/organisms/video-guide/VideoGuideTimeline.js +76 -0
- package/src/organisms/video-guide/_video-guide.scss +13 -3
- package/src/organisms/video-guide/getCurrentCueIndex.js +6 -0
- package/src/organisms/video-guide/video-guide.config.js +3 -3
- package/src/organisms/video-guide/video-guide.js +48 -244
- package/src/assets/video/chapters.vtt +0 -25
- package/src/assets/video/metadata.vtt +0 -28
- package/src/assets/video/movie-webm.webm +0 -0
- package/src/assets/video/videoplayer.vtt +0 -25
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
+
|
|
9
|
+
var _getCurrentCueIndex = require('./getCurrentCueIndex');
|
|
10
|
+
|
|
11
|
+
var _getCurrentCueIndex2 = _interopRequireDefault(_getCurrentCueIndex);
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
+
|
|
17
|
+
var VideoGuidePlayback = function () {
|
|
18
|
+
function VideoGuidePlayback(element, video) {
|
|
19
|
+
var _this = this;
|
|
20
|
+
|
|
21
|
+
_classCallCheck(this, VideoGuidePlayback);
|
|
22
|
+
|
|
23
|
+
this.saveState = function () {
|
|
24
|
+
if (_this.video.currentTime > 0) {
|
|
25
|
+
var _sessionKeys = _this.sessionKeys,
|
|
26
|
+
currentTime = _sessionKeys.currentTime,
|
|
27
|
+
duration = _sessionKeys.duration,
|
|
28
|
+
currentGuideURL = _sessionKeys.currentGuideURL,
|
|
29
|
+
currentGuideImage = _sessionKeys.currentGuideImage;
|
|
30
|
+
|
|
31
|
+
var guideURL = window.location.href;
|
|
32
|
+
var guideImage = _this.video.dataset.featuredImage;
|
|
33
|
+
|
|
34
|
+
sessionStorage.setItem(currentTime, _this.video.currentTime);
|
|
35
|
+
sessionStorage.setItem(duration, _this.video.duration);
|
|
36
|
+
sessionStorage.setItem(currentGuideURL, guideURL);
|
|
37
|
+
sessionStorage.setItem(currentGuideImage, guideImage);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
this.clearState = function () {
|
|
42
|
+
Object.values(_this.sessionKeys).forEach(function (key) {
|
|
43
|
+
sessionStorage.removeItem(key);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
this.onPlay = function () {
|
|
48
|
+
_this.setPlayActive();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
this.onPause = function () {
|
|
52
|
+
_this.setPauseActive();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
this.onEnded = function () {
|
|
56
|
+
_this.setPlayActive();
|
|
57
|
+
_this.clearState();
|
|
58
|
+
_this.setBackwardState(false);
|
|
59
|
+
_this.setForwardState(false);
|
|
60
|
+
|
|
61
|
+
_this.video.currentTime = 0;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
this.onAbort = function () {
|
|
65
|
+
_this.video.pause();
|
|
66
|
+
_this.onEnded();
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
this.onTimeUpdate = function () {
|
|
70
|
+
var timeLeft = Math.floor(_this.duration - _this.video.currentTime);
|
|
71
|
+
|
|
72
|
+
// Time update fires every 250ms, so we only want to update the DOM when the time left changes
|
|
73
|
+
if (timeLeft === _this.timeLeft) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_this.timeLeft = timeLeft;
|
|
78
|
+
|
|
79
|
+
var minutes = Math.floor(timeLeft / 60);
|
|
80
|
+
var seconds = Math.floor(timeLeft % 60);
|
|
81
|
+
var formattedTimeLeft = minutes + ':' + (seconds < 10 ? '0' : '') + seconds;
|
|
82
|
+
|
|
83
|
+
_this.countDownElement.innerText = formattedTimeLeft;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
this.onCueChange = function () {
|
|
87
|
+
_this.updateChapterState();
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
this.togglePlay = function () {
|
|
91
|
+
if (_this.video.paused) {
|
|
92
|
+
_this.video.play();
|
|
93
|
+
} else {
|
|
94
|
+
_this.video.pause();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
this.nextChapter = function () {
|
|
99
|
+
var cues = _this.chapters.cues;
|
|
100
|
+
|
|
101
|
+
var activeCueIndex = (0, _getCurrentCueIndex2.default)(_this.chapters);
|
|
102
|
+
|
|
103
|
+
if (activeCueIndex < cues.length - 1) {
|
|
104
|
+
_this.video.currentTime = cues[activeCueIndex + 1].startTime + 0.01;
|
|
105
|
+
_this.updateChapterState();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
this.previousChapter = function () {
|
|
110
|
+
var cues = _this.chapters.cues;
|
|
111
|
+
|
|
112
|
+
var activeCueIndex = (0, _getCurrentCueIndex2.default)(_this.chapters);
|
|
113
|
+
|
|
114
|
+
if (activeCueIndex > 0) {
|
|
115
|
+
_this.video.currentTime = Math.max(0, cues[activeCueIndex - 1].startTime + 0.01);
|
|
116
|
+
_this.updateChapterState();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
this.video = video;
|
|
121
|
+
this.playBtn = element.querySelector('.js-play-btn');
|
|
122
|
+
this.playIcon = element.querySelector('.js-play-icon');
|
|
123
|
+
this.pauseIcon = element.querySelector('.js-pause-icon');
|
|
124
|
+
this.forwardsButton = element.querySelector('.js-next-chapter');
|
|
125
|
+
this.backwardsButton = element.querySelector('.js-previous-chapter');
|
|
126
|
+
this.totaltimeElement = element.querySelector('.js-totaltime');
|
|
127
|
+
this.countDownElement = element.querySelector('.js-countdown');
|
|
128
|
+
this.chapterElements = Array.from(element.querySelectorAll('.js-chapters li'));
|
|
129
|
+
this.sessionKeys = {
|
|
130
|
+
currentTime: 'InmsCurrentTime',
|
|
131
|
+
duration: 'InmsDuration',
|
|
132
|
+
currentGuideURL: 'InmsCurrentGuideURL',
|
|
133
|
+
currentGuideImage: 'InmsCurrentGuideImage'
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
this.duration = null;
|
|
137
|
+
this.timeLeft = null;
|
|
138
|
+
|
|
139
|
+
this.init();
|
|
140
|
+
this.attach();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
_createClass(VideoGuidePlayback, [{
|
|
144
|
+
key: 'init',
|
|
145
|
+
value: function init() {
|
|
146
|
+
var _this2 = this;
|
|
147
|
+
|
|
148
|
+
this.duration = this.video.duration;
|
|
149
|
+
this.chapters = this.video.textTracks.getTrackById('video-chapters');
|
|
150
|
+
|
|
151
|
+
if (this.chapters) {
|
|
152
|
+
this.chapters.addEventListener('cuechange', this.onCueChange);
|
|
153
|
+
this.setForwardState(true);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Run on next tick to ensure that the video has loaded and event listeners are attached
|
|
157
|
+
setTimeout(function () {
|
|
158
|
+
_this2.sync();
|
|
159
|
+
}, 0);
|
|
160
|
+
|
|
161
|
+
// Format duration to minutes and seconds
|
|
162
|
+
var minutes = Math.floor(this.duration / 60);
|
|
163
|
+
var seconds = Math.floor(this.duration % 60);
|
|
164
|
+
var formattedDuration = minutes + ':' + (seconds < 10 ? '0' : '') + seconds;
|
|
165
|
+
|
|
166
|
+
this.totaltimeElement.innerText = formattedDuration + ' \u2013 ';
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
key: 'sync',
|
|
170
|
+
value: function sync() {
|
|
171
|
+
var key = this.sessionKeys.currentTime;
|
|
172
|
+
var guideURL = window.location.href;
|
|
173
|
+
|
|
174
|
+
// If the current guide URL is not the same as the one in session storage, do not sync
|
|
175
|
+
if (sessionStorage.getItem(this.sessionKeys.currentGuideURL) !== guideURL) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (sessionStorage.getItem(key)) {
|
|
180
|
+
var videoCurrentTime = sessionStorage.getItem(key);
|
|
181
|
+
|
|
182
|
+
if (videoCurrentTime > 0) {
|
|
183
|
+
this.video.currentTime = videoCurrentTime;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}, {
|
|
188
|
+
key: 'attach',
|
|
189
|
+
value: function attach() {
|
|
190
|
+
this.playBtn.addEventListener('click', this.togglePlay);
|
|
191
|
+
this.forwardsButton.addEventListener('click', this.nextChapter);
|
|
192
|
+
this.backwardsButton.addEventListener('click', this.previousChapter);
|
|
193
|
+
|
|
194
|
+
window.addEventListener('visibilitychange', this.saveState);
|
|
195
|
+
window.addEventListener('beforeunload', this.saveState);
|
|
196
|
+
}
|
|
197
|
+
}, {
|
|
198
|
+
key: 'setPlayActive',
|
|
199
|
+
value: function setPlayActive() {
|
|
200
|
+
this.pauseIcon.classList.remove('is-hidden');
|
|
201
|
+
this.playIcon.classList.add('is-hidden');
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
key: 'setPauseActive',
|
|
205
|
+
value: function setPauseActive() {
|
|
206
|
+
this.pauseIcon.classList.add('is-hidden');
|
|
207
|
+
this.playIcon.classList.remove('is-hidden');
|
|
208
|
+
}
|
|
209
|
+
}, {
|
|
210
|
+
key: 'setForwardState',
|
|
211
|
+
value: function setForwardState(active) {
|
|
212
|
+
if (active) {
|
|
213
|
+
this.forwardsButton.disabled = false;
|
|
214
|
+
} else {
|
|
215
|
+
this.forwardsButton.disabled = true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
219
|
+
key: 'setBackwardState',
|
|
220
|
+
value: function setBackwardState(active) {
|
|
221
|
+
if (active) {
|
|
222
|
+
this.backwardsButton.disabled = false;
|
|
223
|
+
} else {
|
|
224
|
+
this.backwardsButton.disabled = true;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}, {
|
|
228
|
+
key: 'updateChapterState',
|
|
229
|
+
value: function updateChapterState() {
|
|
230
|
+
var cues = this.chapters.cues;
|
|
231
|
+
|
|
232
|
+
var activeCueIndex = (0, _getCurrentCueIndex2.default)(this.chapters);
|
|
233
|
+
|
|
234
|
+
this.setBackwardState(activeCueIndex > 0);
|
|
235
|
+
this.setForwardState(activeCueIndex < cues.length - 1);
|
|
236
|
+
|
|
237
|
+
this.chapterElements.forEach(function (chapter, i) {
|
|
238
|
+
if (i === activeCueIndex) {
|
|
239
|
+
chapter.classList.add('is-current-item');
|
|
240
|
+
} else {
|
|
241
|
+
chapter.classList.remove('is-current-item');
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}]);
|
|
246
|
+
|
|
247
|
+
return VideoGuidePlayback;
|
|
248
|
+
}();
|
|
249
|
+
|
|
250
|
+
exports.default = VideoGuidePlayback;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
+
|
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
+
|
|
11
|
+
var VideoGuideSubtitles = function () {
|
|
12
|
+
function VideoGuideSubtitles(element, video) {
|
|
13
|
+
var _this = this;
|
|
14
|
+
|
|
15
|
+
_classCallCheck(this, VideoGuideSubtitles);
|
|
16
|
+
|
|
17
|
+
this.onEnded = function () {
|
|
18
|
+
_this.clearSubtitles();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
this.onCueChange = function () {
|
|
22
|
+
var activeCues = _this.subtitles.activeCues;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if (activeCues.length > 0) {
|
|
26
|
+
_this.subtitlesContainer.innerHTML = '<span>' + activeCues[0].text + '</span>';
|
|
27
|
+
} else {
|
|
28
|
+
_this.clearSubtitles();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
this.toggleSubtitles = function () {
|
|
33
|
+
_this.subtitlesBtn.classList.toggle('is-active');
|
|
34
|
+
_this.subtitlesContainer.classList.toggle('is-visible');
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
this.element = element;
|
|
38
|
+
this.video = video;
|
|
39
|
+
this.subtitlesBtn = element.querySelector('.js-subtitles-btn');
|
|
40
|
+
this.subtitlesContainer = element.querySelector('.js-subtitles-container');
|
|
41
|
+
|
|
42
|
+
this.init();
|
|
43
|
+
this.attach();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
_createClass(VideoGuideSubtitles, [{
|
|
47
|
+
key: 'init',
|
|
48
|
+
value: function init() {
|
|
49
|
+
this.subtitles = this.video.textTracks.getTrackById('video-subtitles');
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: 'attach',
|
|
53
|
+
value: function attach() {
|
|
54
|
+
this.subtitlesBtn.addEventListener('click', this.toggleSubtitles);
|
|
55
|
+
this.subtitles.addEventListener('cuechange', this.onCueChange);
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: 'clearSubtitles',
|
|
59
|
+
value: function clearSubtitles() {
|
|
60
|
+
this.subtitlesContainer.innerHTML = '';
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
63
|
+
|
|
64
|
+
return VideoGuideSubtitles;
|
|
65
|
+
}();
|
|
66
|
+
|
|
67
|
+
exports.default = VideoGuideSubtitles;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
+
|
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
+
|
|
11
|
+
var VideoGuideTimeline = function () {
|
|
12
|
+
function VideoGuideTimeline(element, video) {
|
|
13
|
+
var _this = this;
|
|
14
|
+
|
|
15
|
+
_classCallCheck(this, VideoGuideTimeline);
|
|
16
|
+
|
|
17
|
+
this.togglePosts = function () {
|
|
18
|
+
_this.toggleBtn.classList.toggle('is-toggeled');
|
|
19
|
+
_this.container.classList.toggle('is-visible');
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
this.onCueChange = function () {
|
|
23
|
+
var activeCues = _this.meta.activeCues;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
if (activeCues.length > 0) {
|
|
27
|
+
var activeCue = activeCues[0];
|
|
28
|
+
|
|
29
|
+
_this.posts.forEach(function (post) {
|
|
30
|
+
if (post.dataset.id === activeCue.text) {
|
|
31
|
+
post.classList.add('is-current');
|
|
32
|
+
|
|
33
|
+
if (post.classList.contains('js-timeline-image') && activeCue.id) {
|
|
34
|
+
_this.createImageHeadline(activeCue, post);
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
post.classList.remove('is-current');
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
this.element = element;
|
|
44
|
+
this.video = video;
|
|
45
|
+
this.container = element.querySelector('.js-timeline-posts');
|
|
46
|
+
this.posts = Array.from(element.querySelectorAll('.js-timeline-post'));
|
|
47
|
+
this.toggleBtn = element.querySelector('.js-show-timelineposts');
|
|
48
|
+
this.headlineTpl = element.querySelector('[data-video-headline-tpl]');
|
|
49
|
+
this.headlineCache = {};
|
|
50
|
+
|
|
51
|
+
this.init();
|
|
52
|
+
this.attach();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_createClass(VideoGuideTimeline, [{
|
|
56
|
+
key: 'init',
|
|
57
|
+
value: function init() {
|
|
58
|
+
this.meta = this.video.textTracks.getTrackById('video-metadata');
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: 'attach',
|
|
62
|
+
value: function attach() {
|
|
63
|
+
this.meta.addEventListener('cuechange', this.onCueChange);
|
|
64
|
+
|
|
65
|
+
if (this.toggleBtn) {
|
|
66
|
+
this.toggleBtn.addEventListener('click', this.togglePosts);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
key: 'createImageHeadline',
|
|
71
|
+
value: function createImageHeadline(activeCue, post) {
|
|
72
|
+
if (activeCue.text in this.headlineCache) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
var element = post.querySelector('[data-video-headline-tpl]');
|
|
77
|
+
|
|
78
|
+
if (post.querySelector('[data-video-headline-tpl]')) {
|
|
79
|
+
this.headlineCache[activeCue.text] = element;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
element = this.headlineTpl.cloneNode(true);
|
|
84
|
+
var prevHeadline = element.querySelector('h1');
|
|
85
|
+
var headline = document.createElement('h2');
|
|
86
|
+
|
|
87
|
+
headline.className = prevHeadline.className;
|
|
88
|
+
headline.innerHTML = activeCue.id;
|
|
89
|
+
|
|
90
|
+
prevHeadline.parentNode.replaceChild(headline, prevHeadline);
|
|
91
|
+
post.appendChild(element);
|
|
92
|
+
|
|
93
|
+
this.headlineCache[activeCue.text] = element;
|
|
94
|
+
}
|
|
95
|
+
}]);
|
|
96
|
+
|
|
97
|
+
return VideoGuideTimeline;
|
|
98
|
+
}();
|
|
99
|
+
|
|
100
|
+
exports.default = VideoGuideTimeline;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getCurrentCueIndex;
|
|
7
|
+
function getCurrentCueIndex(target) {
|
|
8
|
+
var activeCue = target.activeCues[0];
|
|
9
|
+
var cues = target.cues;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
return Math.max(Array.prototype.indexOf.call(cues, activeCue), 0);
|
|
13
|
+
}
|