@srgssr/pillarbox-web 1.31.0 → 1.32.1
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/README.md +13 -0
- package/dist/pillarbox-core.cjs +146 -1
- package/dist/pillarbox-core.cjs.map +1 -1
- package/dist/pillarbox-core.es.js +146 -1
- package/dist/pillarbox-core.es.js.map +1 -1
- package/dist/pillarbox.cjs +154 -7
- package/dist/pillarbox.cjs.map +1 -1
- package/dist/pillarbox.es.js +154 -7
- package/dist/pillarbox.es.js.map +1 -1
- package/dist/pillarbox.min.css +1 -1
- package/dist/pillarbox.min.css.map +1 -1
- package/dist/pillarbox.umd.js +172 -25
- package/dist/pillarbox.umd.js.map +1 -1
- package/dist/pillarbox.umd.min.js +7 -7
- package/dist/pillarbox.umd.min.js.map +1 -1
- package/dist/types/src/components/audio-track-menu-item.d.ts +2 -0
- package/dist/types/src/components/audio-track-menu-item.d.ts.map +1 -0
- package/dist/types/src/middleware/srgssr.d.ts.map +1 -1
- package/dist/types/src/middleware/typedef.d.ts +6 -0
- package/dist/types/src/middleware/typedef.d.ts.map +1 -1
- package/dist/types/src/pillarbox.d.ts.map +1 -1
- package/dist/types/src/trackers/SRGAnalytics.d.ts +5 -5
- package/dist/types/src/utils/Image.d.ts +1 -1
- package/package.json +1 -1
- package/scss/components/_audio.scss +8 -0
- package/scss/pillarbox.scss +1 -0
package/dist/pillarbox.es.js
CHANGED
|
@@ -90,7 +90,7 @@ function _toPropertyKey(t) {
|
|
|
90
90
|
return "symbol" == typeof i ? i : i + "";
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
const version = "1.
|
|
93
|
+
const version = "1.32.0";
|
|
94
94
|
|
|
95
95
|
/** @import VJSPlayer from 'video.js/dist/types/player' */
|
|
96
96
|
/** @import AudioTrack from 'video.js/dist/types/tracks/audio-track' */
|
|
@@ -306,6 +306,151 @@ class Player extends vjsPlayer {
|
|
|
306
306
|
}
|
|
307
307
|
videojs.registerComponent('player', Player);
|
|
308
308
|
|
|
309
|
+
/** @import MenuItem from 'video.js/dist/types/menu/menu-item' */
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @ignore
|
|
313
|
+
*/
|
|
314
|
+
const VJSAudioTrackButton = videojs.getComponent('AudioTrackButton');
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @ignore
|
|
318
|
+
* @type {typeof MenuItem}
|
|
319
|
+
*/
|
|
320
|
+
const MenuItem = videojs.getComponent('MenuItem');
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* An {@link AudioTrack} {@link MenuItem}
|
|
324
|
+
*
|
|
325
|
+
* This is a temporary workaround.
|
|
326
|
+
*
|
|
327
|
+
* @extends MenuItem
|
|
328
|
+
*/
|
|
329
|
+
class AudioTrackMenuItem extends MenuItem {
|
|
330
|
+
/**
|
|
331
|
+
* Creates an instance of this class.
|
|
332
|
+
*
|
|
333
|
+
* @param {Player} player
|
|
334
|
+
* The `Player` that this class should be attached to.
|
|
335
|
+
*
|
|
336
|
+
* @param {Object} [options]
|
|
337
|
+
* The key/value store of player options.
|
|
338
|
+
*/
|
|
339
|
+
constructor(player, options) {
|
|
340
|
+
const track = options.track;
|
|
341
|
+
const tracks = player.audioTracks();
|
|
342
|
+
|
|
343
|
+
// Modify options for parent MenuItem class's init.
|
|
344
|
+
options.label = track.label || track.language || 'Unknown';
|
|
345
|
+
options.selected = track.enabled;
|
|
346
|
+
super(player, options);
|
|
347
|
+
this.track = track;
|
|
348
|
+
this.addClass(`vjs-${track.kind}-menu-item`);
|
|
349
|
+
const changeHandler = (...args) => {
|
|
350
|
+
this.handleTracksChange.apply(this, args);
|
|
351
|
+
};
|
|
352
|
+
tracks.addEventListener('change', changeHandler);
|
|
353
|
+
this.on('dispose', () => {
|
|
354
|
+
tracks.removeEventListener('change', changeHandler);
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
createEl(type, props, attrs) {
|
|
358
|
+
const el = super.createEl(type, props, attrs);
|
|
359
|
+
const parentSpan = el.querySelector('.vjs-menu-item-text');
|
|
360
|
+
if (['main-desc', 'descriptions', 'description'].indexOf(this.options_.track.kind) >= 0) {
|
|
361
|
+
parentSpan.appendChild(videojs.dom.createEl('span', {
|
|
362
|
+
className: 'vjs-icon-placeholder'
|
|
363
|
+
}, {
|
|
364
|
+
'aria-hidden': true
|
|
365
|
+
}));
|
|
366
|
+
parentSpan.appendChild(videojs.dom.createEl('span', {
|
|
367
|
+
className: 'vjs-control-text',
|
|
368
|
+
textContent: ' ' + this.localize('Descriptions')
|
|
369
|
+
}));
|
|
370
|
+
}
|
|
371
|
+
return el;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* This gets called when an `AudioTrackMenuItem is "clicked". See {@link ClickableComponent}
|
|
376
|
+
* for more detailed information on what a click can be.
|
|
377
|
+
*
|
|
378
|
+
* @param {Event} [event]
|
|
379
|
+
* The `keydown`, `tap`, or `click` event that caused this function to be
|
|
380
|
+
* called.
|
|
381
|
+
*
|
|
382
|
+
* @listens tap
|
|
383
|
+
* @listens click
|
|
384
|
+
*/
|
|
385
|
+
handleClick(event) {
|
|
386
|
+
super.handleClick(event);
|
|
387
|
+
|
|
388
|
+
// the audio track list will automatically toggle other tracks
|
|
389
|
+
// off for us.
|
|
390
|
+
this.track.enabled = true;
|
|
391
|
+
if (!this.player_.tech_.featuresNativeAudioTracks) return;
|
|
392
|
+
|
|
393
|
+
// when native audio tracks are used, we want to make sure that other tracks are turned off
|
|
394
|
+
const tracks = this.player_.audioTracks();
|
|
395
|
+
for (let i = 0; i < tracks.length; i++) {
|
|
396
|
+
const track = tracks[i];
|
|
397
|
+
|
|
398
|
+
// skip the current track since we enabled it above
|
|
399
|
+
if (track === this.track) {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
track.enabled = track === this.track;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Handle any {@link AudioTrack} change.
|
|
408
|
+
*
|
|
409
|
+
* @param {Event} [event]
|
|
410
|
+
* The {@link AudioTrackList#change} event that caused this to run.
|
|
411
|
+
*
|
|
412
|
+
* @listens AudioTrackList#change
|
|
413
|
+
*/
|
|
414
|
+
handleTracksChange() {
|
|
415
|
+
this.selected(this.track.enabled);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* The base class for buttons that toggle specific {@link AudioTrack} types.
|
|
421
|
+
*
|
|
422
|
+
* @extends VJSAudioTrackButton
|
|
423
|
+
*/
|
|
424
|
+
class AudioTrackButton extends VJSAudioTrackButton {
|
|
425
|
+
/**
|
|
426
|
+
* Create a menu item for each audio track
|
|
427
|
+
*
|
|
428
|
+
* @param {AudioTrackMenuItem[]} [items=[]]
|
|
429
|
+
* An array of existing menu items to use.
|
|
430
|
+
*
|
|
431
|
+
* @return {AudioTrackMenuItem[]}
|
|
432
|
+
* An array of menu items
|
|
433
|
+
*/
|
|
434
|
+
createItems(items = []) {
|
|
435
|
+
// if there's only one audio track, there no point in showing it
|
|
436
|
+
this.hideThreshold_ = 1;
|
|
437
|
+
const tracks = this.player_.audioTracks();
|
|
438
|
+
for (let i = 0; i < tracks.length; i++) {
|
|
439
|
+
const track = tracks[i];
|
|
440
|
+
items.push(new AudioTrackMenuItem(this.player_, {
|
|
441
|
+
track,
|
|
442
|
+
// MenuItem is selectable
|
|
443
|
+
selectable: true,
|
|
444
|
+
// MenuItem is NOT multiSelectable (i.e. only one can be marked "selected" at a time)
|
|
445
|
+
multiSelectable: false
|
|
446
|
+
}));
|
|
447
|
+
}
|
|
448
|
+
return items;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
videojs.registerComponent('AudioTrackMenuItem', AudioTrackMenuItem);
|
|
452
|
+
videojs.registerComponent('AudioTrackButton', AudioTrackButton);
|
|
453
|
+
|
|
309
454
|
/**
|
|
310
455
|
* Pillarbox is an alias for the video.js namespace with additional options.
|
|
311
456
|
*
|
|
@@ -489,7 +634,7 @@ class Image {
|
|
|
489
634
|
* @property {String} [image.format=jpg] is the format of the image, default value jpg.
|
|
490
635
|
* @property {String} [imageServiceUrl] Url of the image service that needs to comply with the specification defined by the IL.
|
|
491
636
|
*
|
|
492
|
-
* @see https://
|
|
637
|
+
* @see https://srgssr-ch.atlassian.net/wiki/spaces/SRGPLAY/pages/799082429/Project+-+Image+Service
|
|
493
638
|
*
|
|
494
639
|
* @returns {String|undefined} the image scaling URL.
|
|
495
640
|
*/
|
|
@@ -1234,7 +1379,7 @@ class SRGAnalytics {
|
|
|
1234
1379
|
* - pos should be sent when the media player is in "play mode".
|
|
1235
1380
|
* - once the video is paused or stopped, the timer for sending these actions must be stopped.
|
|
1236
1381
|
*
|
|
1237
|
-
* @see https://
|
|
1382
|
+
* @see https://srgssr-ch.atlassian.net/wiki/spaces/INTFORSCHUNG/pages/795904171/standard+streaming+events+sequence+of+events+for+media+player+actions#mandatory-player-events
|
|
1238
1383
|
*/
|
|
1239
1384
|
heartBeat() {
|
|
1240
1385
|
this.heartBeatIntervalId = setInterval(() => {
|
|
@@ -1525,7 +1670,7 @@ class SRGAnalytics {
|
|
|
1525
1670
|
* Sent to ComScore when the playback rate changes.
|
|
1526
1671
|
*
|
|
1527
1672
|
* @see https://github.com/SRGSSR/srgletterbox-web/issues/761
|
|
1528
|
-
* @see https://
|
|
1673
|
+
* @see https://srgssr-ch.atlassian.net/browse/ADI-256
|
|
1529
1674
|
*/
|
|
1530
1675
|
rateChange() {
|
|
1531
1676
|
this.notify('change_playback_rate');
|
|
@@ -1619,11 +1764,11 @@ class SRGAnalytics {
|
|
|
1619
1764
|
* It's expected notifyBufferStart() to be called when the player starts buffering
|
|
1620
1765
|
* and a call to notifyBufferStop() when content resumes after buffering.
|
|
1621
1766
|
*
|
|
1622
|
-
* @see Item 2: https://
|
|
1767
|
+
* @see Item 2: https://srgssr-ch.atlassian.net/browse/PLAY-2628
|
|
1623
1768
|
*
|
|
1624
1769
|
* After the issue PLAYRTS-321
|
|
1625
|
-
* @see Fix: https://
|
|
1626
|
-
* @see Fix: https://
|
|
1770
|
+
* @see Fix: https://srgssr-ch.atlassian.net/browse/PLAYRTS-321?focusedCommentId=201023&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-201023
|
|
1771
|
+
* @see Fix: https://srgssr-ch.atlassian.net/browse/PLAYRTS-3065
|
|
1627
1772
|
*/
|
|
1628
1773
|
waiting() {
|
|
1629
1774
|
if (!this.initialized || this.isWaiting) {
|
|
@@ -4224,6 +4369,7 @@ class SrgSsr {
|
|
|
4224
4369
|
if (!player.options().trackers.srgAnalytics) {
|
|
4225
4370
|
const srgAnalytics = new SRGAnalytics(player, {
|
|
4226
4371
|
debug: player.debug(),
|
|
4372
|
+
environment: player.options().srgOptions.analyticsEnvironment,
|
|
4227
4373
|
playerVersion: pillarbox.VERSION.pillarbox,
|
|
4228
4374
|
tagCommanderScriptURL: player.options().srgOptions.tagCommanderScriptURL
|
|
4229
4375
|
});
|
|
@@ -4317,6 +4463,7 @@ pillarbox.options.srgOptions = {
|
|
|
4317
4463
|
dataProvider: undefined,
|
|
4318
4464
|
dataProviderHost: undefined,
|
|
4319
4465
|
dataProviderUrlHandler: undefined,
|
|
4466
|
+
analyticsEnvironment: undefined,
|
|
4320
4467
|
tagCommanderScriptURL: undefined
|
|
4321
4468
|
};
|
|
4322
4469
|
|