shaka-player 4.11.11 → 4.11.13
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/AUTHORS +1 -0
- package/CONTRIBUTORS +1 -0
- package/dist/deps.js +1 -1
- package/dist/locales.js +37 -37
- package/dist/shaka-player.compiled.d.ts +1 -1
- package/dist/shaka-player.compiled.debug.d.ts +1 -1
- package/dist/shaka-player.compiled.debug.externs.js +1 -1
- package/dist/shaka-player.compiled.debug.js +243 -242
- package/dist/shaka-player.compiled.debug.map +3 -3
- package/dist/shaka-player.compiled.externs.js +1 -1
- package/dist/shaka-player.compiled.js +915 -913
- package/dist/shaka-player.compiled.map +3 -3
- package/dist/shaka-player.ui.d.ts +1 -1
- package/dist/shaka-player.ui.debug.d.ts +1 -1
- package/dist/shaka-player.ui.debug.externs.js +1 -1
- package/dist/shaka-player.ui.debug.js +353 -351
- package/dist/shaka-player.ui.debug.map +3 -3
- package/dist/shaka-player.ui.externs.js +1 -1
- package/dist/shaka-player.ui.js +1232 -1229
- package/dist/shaka-player.ui.map +3 -3
- package/lib/ads/interstitial_ad_manager.js +83 -29
- package/lib/dash/segment_template.js +6 -2
- package/lib/media/adaptation_set_criteria.js +22 -47
- package/lib/media/media_source_engine.js +9 -8
- package/lib/media/preload_manager.js +2 -1
- package/lib/media/streaming_engine.js +1 -2
- package/lib/net/networking_engine.js +3 -3
- package/lib/player.js +57 -20
- package/lib/polyfill/media_capabilities.js +2 -1
- package/lib/polyfill/mediasource.js +12 -0
- package/lib/text/cue.js +1 -0
- package/lib/text/ui_text_displayer.js +8 -0
- package/lib/util/error.js +1 -1
- package/lib/util/mp4_generator.js +1 -1
- package/lib/util/platform.js +3 -3
- package/package.json +1 -1
- package/ui/controls.js +17 -7
- package/ui/language_utils.js +3 -1
- package/ui/playback_rate_selection.js +6 -2
- package/ui/remote_button.js +42 -17
- package/ui/seek_bar.js +3 -0
package/package.json
CHANGED
package/ui/controls.js
CHANGED
|
@@ -1265,7 +1265,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
|
|
|
1265
1265
|
callback(details);
|
|
1266
1266
|
});
|
|
1267
1267
|
} catch (error) {
|
|
1268
|
-
shaka.log.
|
|
1268
|
+
shaka.log.debug(
|
|
1269
1269
|
`The "${type}" media session action is not supported.`);
|
|
1270
1270
|
}
|
|
1271
1271
|
};
|
|
@@ -1290,7 +1290,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
|
|
|
1290
1290
|
});
|
|
1291
1291
|
}
|
|
1292
1292
|
} catch (error) {
|
|
1293
|
-
shaka.log.
|
|
1293
|
+
shaka.log.v2(
|
|
1294
1294
|
'setPositionState in media session is not supported.');
|
|
1295
1295
|
}
|
|
1296
1296
|
};
|
|
@@ -1360,9 +1360,15 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
|
|
|
1360
1360
|
if (payload['key'] == 'APIC' && payload['mimeType'] == '-->') {
|
|
1361
1361
|
imageUrl = payload['data'];
|
|
1362
1362
|
}
|
|
1363
|
-
if (
|
|
1364
|
-
|
|
1365
|
-
|
|
1363
|
+
if (title) {
|
|
1364
|
+
let metadata = {
|
|
1365
|
+
title: title,
|
|
1366
|
+
artwork: [],
|
|
1367
|
+
};
|
|
1368
|
+
if (navigator.mediaSession.metadata) {
|
|
1369
|
+
metadata = navigator.mediaSession.metadata;
|
|
1370
|
+
metadata.title = title;
|
|
1371
|
+
}
|
|
1366
1372
|
navigator.mediaSession.metadata = new MediaMetadata(metadata);
|
|
1367
1373
|
}
|
|
1368
1374
|
if (imageUrl) {
|
|
@@ -1370,11 +1376,15 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
|
|
|
1370
1376
|
if (imageUrl != video.poster) {
|
|
1371
1377
|
video.poster = imageUrl;
|
|
1372
1378
|
}
|
|
1379
|
+
let metadata = {
|
|
1380
|
+
title: '',
|
|
1381
|
+
artwork: [{src: imageUrl}],
|
|
1382
|
+
};
|
|
1373
1383
|
if (navigator.mediaSession.metadata) {
|
|
1374
|
-
|
|
1384
|
+
metadata = navigator.mediaSession.metadata;
|
|
1375
1385
|
metadata.artwork = [{src: imageUrl}];
|
|
1376
|
-
navigator.mediaSession.metadata = new MediaMetadata(metadata);
|
|
1377
1386
|
}
|
|
1387
|
+
navigator.mediaSession.metadata = new MediaMetadata(metadata);
|
|
1378
1388
|
}
|
|
1379
1389
|
});
|
|
1380
1390
|
}
|
package/ui/language_utils.js
CHANGED
|
@@ -105,8 +105,10 @@ shaka.ui.LanguageUtils = class {
|
|
|
105
105
|
audioCodec = audioCodec.toLowerCase();
|
|
106
106
|
if (audioCodec.startsWith('mp4a')) {
|
|
107
107
|
name = 'AAC';
|
|
108
|
-
} else if (audioCodec === '
|
|
108
|
+
} else if (audioCodec === 'ac-3') {
|
|
109
109
|
name = 'Dolby';
|
|
110
|
+
} else if (audioCodec === 'ec-3') {
|
|
111
|
+
name = 'DD+';
|
|
110
112
|
} else if (audioCodec === 'opus') {
|
|
111
113
|
name = 'Opus';
|
|
112
114
|
} else if (audioCodec === 'flac') {
|
|
@@ -120,8 +120,12 @@ shaka.ui.PlaybackRateSelection = class extends shaka.ui.SettingsMenu {
|
|
|
120
120
|
button.appendChild(span);
|
|
121
121
|
|
|
122
122
|
this.eventManager.listen(button, 'click', () => {
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
const rate = this.playbackRates_.get(rateStr);
|
|
124
|
+
if (rate == 1) {
|
|
125
|
+
this.player.cancelTrickPlay();
|
|
126
|
+
} else {
|
|
127
|
+
this.player.trickPlay(rate, /* useTrickPlayTrack= */ false);
|
|
128
|
+
}
|
|
125
129
|
});
|
|
126
130
|
|
|
127
131
|
this.menu.appendChild(button);
|
package/ui/remote_button.js
CHANGED
|
@@ -33,6 +33,9 @@ shaka.ui.RemoteButton = class extends shaka.ui.Element {
|
|
|
33
33
|
constructor(parent, controls) {
|
|
34
34
|
super(parent, controls);
|
|
35
35
|
|
|
36
|
+
/** @private {boolean} */
|
|
37
|
+
this.isAirPlay_ = shaka.util.Platform.isSafari();
|
|
38
|
+
|
|
36
39
|
/** @private {!HTMLButtonElement} */
|
|
37
40
|
this.remoteButton_ = shaka.util.Dom.createButton();
|
|
38
41
|
this.remoteButton_.classList.add('shaka-remote-button');
|
|
@@ -42,12 +45,9 @@ shaka.ui.RemoteButton = class extends shaka.ui.Element {
|
|
|
42
45
|
/** @private {!HTMLElement} */
|
|
43
46
|
this.remoteIcon_ = shaka.util.Dom.createHTMLElement('i');
|
|
44
47
|
this.remoteIcon_.classList.add('material-icons-round');
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
icon = shaka.ui.Enums.MaterialDesignIcons.AIRPLAY;
|
|
49
|
-
}
|
|
50
|
-
this.remoteIcon_.textContent = icon;
|
|
48
|
+
this.remoteIcon_.textContent = this.isAirPlay_ ?
|
|
49
|
+
shaka.ui.Enums.MaterialDesignIcons.AIRPLAY :
|
|
50
|
+
shaka.ui.Enums.MaterialDesignIcons.CAST;
|
|
51
51
|
this.remoteButton_.appendChild(this.remoteIcon_);
|
|
52
52
|
|
|
53
53
|
const label = shaka.util.Dom.createHTMLElement('label');
|
|
@@ -95,21 +95,25 @@ shaka.ui.RemoteButton = class extends shaka.ui.Element {
|
|
|
95
95
|
|
|
96
96
|
this.eventManager.listen(this.video.remote, 'connect', () => {
|
|
97
97
|
this.updateRemoteState_();
|
|
98
|
+
this.updateIcon_();
|
|
98
99
|
});
|
|
99
100
|
|
|
100
101
|
this.eventManager.listen(this.video.remote, 'connecting', () => {
|
|
101
102
|
this.updateRemoteState_();
|
|
103
|
+
this.updateIcon_();
|
|
102
104
|
});
|
|
103
105
|
|
|
104
106
|
this.eventManager.listen(this.video.remote, 'disconnect', () => {
|
|
105
107
|
this.updateRemoteState_();
|
|
108
|
+
this.updateIcon_();
|
|
106
109
|
});
|
|
107
110
|
|
|
108
111
|
this.eventManager.listen(this.player, 'loaded', () => {
|
|
109
112
|
this.updateRemoteState_();
|
|
110
113
|
});
|
|
111
114
|
|
|
112
|
-
this.updateRemoteState_();
|
|
115
|
+
this.updateRemoteState_(/* force= */ true);
|
|
116
|
+
this.updateIcon_();
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
|
|
@@ -125,9 +129,10 @@ shaka.ui.RemoteButton = class extends shaka.ui.Element {
|
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
/**
|
|
132
|
+
* @param {boolean=} force
|
|
128
133
|
* @private
|
|
129
134
|
*/
|
|
130
|
-
async updateRemoteState_() {
|
|
135
|
+
async updateRemoteState_(force = false) {
|
|
131
136
|
if (this.controls.getCastProxy().canCast() &&
|
|
132
137
|
this.controls.isCastAllowed()) {
|
|
133
138
|
shaka.ui.Utils.setDisplay(this.remoteButton_, false);
|
|
@@ -135,14 +140,20 @@ shaka.ui.RemoteButton = class extends shaka.ui.Element {
|
|
|
135
140
|
this.video.remote.cancelWatchAvailability(this.callbackId_);
|
|
136
141
|
this.callbackId_ = -1;
|
|
137
142
|
}
|
|
138
|
-
} else if (this.video.remote.state == 'disconnected') {
|
|
143
|
+
} else if (this.video.remote.state == 'disconnected' || force) {
|
|
139
144
|
const handleAvailabilityChange = (availability) => {
|
|
140
145
|
if (this.player) {
|
|
141
146
|
const disableRemote = this.video.disableRemotePlayback;
|
|
142
|
-
|
|
143
|
-
|
|
147
|
+
let canCast = true;
|
|
148
|
+
if (shaka.util.Platform.isSafari()) {
|
|
149
|
+
const loadMode = this.player.getLoadMode();
|
|
150
|
+
const mseMode = loadMode == shaka.Player.LoadMode.MEDIA_SOURCE;
|
|
151
|
+
if (mseMode && this.player.getManifestType() != 'HLS') {
|
|
152
|
+
canCast = false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
144
155
|
shaka.ui.Utils.setDisplay(
|
|
145
|
-
this.remoteButton_,
|
|
156
|
+
this.remoteButton_, canCast && availability && !disableRemote);
|
|
146
157
|
} else {
|
|
147
158
|
shaka.ui.Utils.setDisplay(this.remoteButton_, false);
|
|
148
159
|
}
|
|
@@ -175,14 +186,28 @@ shaka.ui.RemoteButton = class extends shaka.ui.Element {
|
|
|
175
186
|
*/
|
|
176
187
|
updateLocalizedStrings_() {
|
|
177
188
|
const LocIds = shaka.ui.Locales.Ids;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
text = this.localization.resolve(LocIds.AIRPLAY);
|
|
182
|
-
}
|
|
189
|
+
const text = this.isAirPlay_ ?
|
|
190
|
+
this.localization.resolve(LocIds.AIRPLAY) :
|
|
191
|
+
this.localization.resolve(LocIds.CAST);
|
|
183
192
|
this.remoteButton_.ariaLabel = text;
|
|
184
193
|
this.remoteNameSpan_.textContent = text;
|
|
185
194
|
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
199
|
+
updateIcon_() {
|
|
200
|
+
if (this.isAirPlay_) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (this.video.remote.state == 'disconnected') {
|
|
204
|
+
this.remoteIcon_.textContent =
|
|
205
|
+
shaka.ui.Enums.MaterialDesignIcons.CAST;
|
|
206
|
+
} else {
|
|
207
|
+
this.remoteIcon_.textContent =
|
|
208
|
+
shaka.ui.Enums.MaterialDesignIcons.EXIT_CAST;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
186
211
|
};
|
|
187
212
|
|
|
188
213
|
|
package/ui/seek_bar.js
CHANGED
|
@@ -513,6 +513,7 @@ shaka.ui.SeekBar = class extends shaka.ui.RangeElement {
|
|
|
513
513
|
const leftPosition = Math.min(this.bar.offsetWidth - width,
|
|
514
514
|
Math.max(0, pixelPosition - (width / 2)));
|
|
515
515
|
this.timeContainer_.style.left = leftPosition + 'px';
|
|
516
|
+
this.timeContainer_.style.right = '';
|
|
516
517
|
this.timeContainer_.style.visibility = 'visible';
|
|
517
518
|
const seekRange = this.player.seekRange();
|
|
518
519
|
if (this.player.isLive()) {
|
|
@@ -520,6 +521,8 @@ shaka.ui.SeekBar = class extends shaka.ui.RangeElement {
|
|
|
520
521
|
if (totalSeconds < 1) {
|
|
521
522
|
this.timeContainer_.textContent =
|
|
522
523
|
this.localization.resolve(shaka.ui.Locales.Ids.LIVE);
|
|
524
|
+
this.timeContainer_.style.left = '';
|
|
525
|
+
this.timeContainer_.style.right = '0px';
|
|
523
526
|
} else {
|
|
524
527
|
this.timeContainer_.textContent =
|
|
525
528
|
'-' + this.timeFormatter_(totalSeconds);
|