shaka-player 4.13.1 → 4.13.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/CONTRIBUTORS +1 -0
- package/dist/deps.js +1 -1
- package/dist/locales.js +34 -34
- package/dist/shaka-player.compiled.debug.js +353 -345
- package/dist/shaka-player.compiled.debug.map +3 -3
- package/dist/shaka-player.compiled.js +1413 -1408
- package/dist/shaka-player.compiled.map +3 -3
- package/dist/shaka-player.ui.debug.js +350 -342
- package/dist/shaka-player.ui.debug.map +3 -3
- package/dist/shaka-player.ui.js +1630 -1624
- package/dist/shaka-player.ui.map +3 -3
- package/eslint.config.mjs +14 -1
- package/lib/cast/cast_proxy.js +48 -10
- package/lib/debug/log.js +16 -17
- package/lib/hls/hls_parser.js +27 -1
- package/lib/media/media_source_engine.js +124 -120
- package/lib/media/preload_manager.js +10 -5
- package/lib/media/region_observer.js +9 -8
- package/lib/media/region_timeline.js +10 -8
- package/lib/media/streaming_engine.js +25 -9
- package/lib/player.js +87 -38
- package/lib/text/cue.js +6 -2
- package/lib/text/ui_text_displayer.js +25 -4
- package/lib/util/platform.js +24 -3
- package/lib/util/stream_utils.js +13 -0
- package/package.json +1 -1
- package/project-words.txt +1 -0
- package/ui/ad_statistics_button.js +2 -0
- package/ui/statistics_button.js +3 -1
package/eslint.config.mjs
CHANGED
|
@@ -81,7 +81,6 @@ export default [
|
|
|
81
81
|
},
|
|
82
82
|
rules: {
|
|
83
83
|
// Things the compiler already takes care of, with more precision: {{{
|
|
84
|
-
'no-console': 'off',
|
|
85
84
|
'no-eq-null': 'off',
|
|
86
85
|
'no-eval': 'off',
|
|
87
86
|
'no-undef': 'off',
|
|
@@ -132,6 +131,7 @@ export default [
|
|
|
132
131
|
'guard-for-in': 'off',
|
|
133
132
|
'no-alert': 'error',
|
|
134
133
|
'no-caller': 'error',
|
|
134
|
+
'no-console': 'error',
|
|
135
135
|
'no-div-regex': 'error',
|
|
136
136
|
'no-extend-native': 'error', // May conflict with future polyfills
|
|
137
137
|
'no-extra-label': 'error',
|
|
@@ -340,4 +340,17 @@ export default [
|
|
|
340
340
|
'jsdoc/require-jsdoc': 'off',
|
|
341
341
|
},
|
|
342
342
|
},
|
|
343
|
+
{
|
|
344
|
+
files: [
|
|
345
|
+
'karma.conf.js',
|
|
346
|
+
'build/**/*.js',
|
|
347
|
+
'demo/**/*.js',
|
|
348
|
+
'lib/debug/asserts.js',
|
|
349
|
+
'lib/debug/log.js',
|
|
350
|
+
'test/**/**.js',
|
|
351
|
+
],
|
|
352
|
+
rules: {
|
|
353
|
+
'no-console': 'off',
|
|
354
|
+
},
|
|
355
|
+
},
|
|
343
356
|
];
|
package/lib/cast/cast_proxy.js
CHANGED
|
@@ -81,17 +81,21 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
|
|
|
81
81
|
this.compiledToExternNames_ = new Map();
|
|
82
82
|
|
|
83
83
|
/** @private {shaka.cast.CastSender} */
|
|
84
|
-
this.sender_ =
|
|
85
|
-
receiverAppId,
|
|
86
|
-
() => this.onCastStatusChanged_(),
|
|
87
|
-
() => this.onFirstCastStateUpdate_(),
|
|
88
|
-
(targetName, event) => this.onRemoteEvent_(targetName, event),
|
|
89
|
-
() => this.onResumeLocal_(),
|
|
90
|
-
() => this.getInitState_(),
|
|
91
|
-
androidReceiverCompatible);
|
|
92
|
-
|
|
84
|
+
this.sender_ = null;
|
|
93
85
|
|
|
94
|
-
|
|
86
|
+
if (window.chrome) {
|
|
87
|
+
this.sender_ = new shaka.cast.CastSender(
|
|
88
|
+
receiverAppId,
|
|
89
|
+
() => this.onCastStatusChanged_(),
|
|
90
|
+
() => this.onFirstCastStateUpdate_(),
|
|
91
|
+
(targetName, event) => this.onRemoteEvent_(targetName, event),
|
|
92
|
+
() => this.onResumeLocal_(),
|
|
93
|
+
() => this.getInitState_(),
|
|
94
|
+
androidReceiverCompatible);
|
|
95
|
+
this.init_();
|
|
96
|
+
} else {
|
|
97
|
+
this.initWithoutSender_();
|
|
98
|
+
}
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
/**
|
|
@@ -163,6 +167,9 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
|
|
|
163
167
|
* @export
|
|
164
168
|
*/
|
|
165
169
|
canCast() {
|
|
170
|
+
if (!this.sender_) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
166
173
|
return this.sender_.apiReady() && this.sender_.hasReceivers();
|
|
167
174
|
}
|
|
168
175
|
|
|
@@ -171,6 +178,9 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
|
|
|
171
178
|
* @export
|
|
172
179
|
*/
|
|
173
180
|
isCasting() {
|
|
181
|
+
if (!this.sender_) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
174
184
|
return this.sender_.isCasting();
|
|
175
185
|
}
|
|
176
186
|
|
|
@@ -179,6 +189,9 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
|
|
|
179
189
|
* @export
|
|
180
190
|
*/
|
|
181
191
|
receiverName() {
|
|
192
|
+
if (!this.sender_) {
|
|
193
|
+
return '';
|
|
194
|
+
}
|
|
182
195
|
return this.sender_.receiverName();
|
|
183
196
|
}
|
|
184
197
|
|
|
@@ -188,6 +201,9 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
|
|
|
188
201
|
* @export
|
|
189
202
|
*/
|
|
190
203
|
async cast() {
|
|
204
|
+
if (!this.sender_) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
191
207
|
// TODO: transfer manually-selected tracks?
|
|
192
208
|
// TODO: transfer side-loaded text tracks?
|
|
193
209
|
|
|
@@ -208,6 +224,9 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
|
|
|
208
224
|
* @export
|
|
209
225
|
*/
|
|
210
226
|
setAppData(appData) {
|
|
227
|
+
if (!this.sender_) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
211
230
|
this.sender_.setAppData(appData);
|
|
212
231
|
}
|
|
213
232
|
|
|
@@ -216,6 +235,9 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
|
|
|
216
235
|
* @export
|
|
217
236
|
*/
|
|
218
237
|
suggestDisconnect() {
|
|
238
|
+
if (!this.sender_) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
219
241
|
this.sender_.showDisconnectDialog();
|
|
220
242
|
}
|
|
221
243
|
|
|
@@ -224,6 +246,9 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
|
|
|
224
246
|
* @export
|
|
225
247
|
*/
|
|
226
248
|
forceDisconnect() {
|
|
249
|
+
if (!this.sender_) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
227
252
|
this.sender_.forceDisconnect();
|
|
228
253
|
}
|
|
229
254
|
|
|
@@ -243,6 +268,10 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
|
|
|
243
268
|
this.receiverAppId_ = newAppId;
|
|
244
269
|
this.androidReceiverCompatible_ = newCastAndroidReceiver;
|
|
245
270
|
|
|
271
|
+
if (!this.sender_) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
246
275
|
// Destroy the old sender
|
|
247
276
|
this.sender_.forceDisconnect();
|
|
248
277
|
await this.sender_.destroy();
|
|
@@ -262,6 +291,15 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
|
|
|
262
291
|
this.sender_.init();
|
|
263
292
|
}
|
|
264
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Initialize the Proxies without Cast sender.
|
|
296
|
+
* @private
|
|
297
|
+
*/
|
|
298
|
+
initWithoutSender_() {
|
|
299
|
+
this.videoProxy_ = /** @type {Object} */(this.localVideo_);
|
|
300
|
+
this.playerProxy_ = /** @type {Object} */(this.localPlayer_);
|
|
301
|
+
}
|
|
302
|
+
|
|
265
303
|
/**
|
|
266
304
|
* Initialize the Proxies and the Cast sender.
|
|
267
305
|
* @private
|
package/lib/debug/log.js
CHANGED
|
@@ -135,15 +135,14 @@ shaka.log.oneTimeWarningIssued_ = new Set();
|
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
if (window.console) {
|
|
138
|
-
/** @private {!
|
|
139
|
-
shaka.log.logMap_ =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
};
|
|
138
|
+
/** @private {!Map<shaka.log.Level, function(...*)>} */
|
|
139
|
+
shaka.log.logMap_ = new Map()
|
|
140
|
+
.set(shaka.log.Level.ERROR, (...args) => console.error(...args))
|
|
141
|
+
.set(shaka.log.Level.WARNING, (...args) => console.warn(...args))
|
|
142
|
+
.set(shaka.log.Level.INFO, (...args) => console.info(...args))
|
|
143
|
+
.set(shaka.log.Level.DEBUG, (...args) => console.log(...args))
|
|
144
|
+
.set(shaka.log.Level.V1, (...args) => console.debug(...args))
|
|
145
|
+
.set(shaka.log.Level.V2, (...args) => console.debug(...args));
|
|
147
146
|
|
|
148
147
|
shaka.log.alwaysWarn = (...args) => console.warn(...args);
|
|
149
148
|
shaka.log.alwaysError = (...args) => console.error(...args);
|
|
@@ -168,8 +167,8 @@ if (window.console) {
|
|
|
168
167
|
const getLog = (curLevel) => {
|
|
169
168
|
if (curLevel <= level) {
|
|
170
169
|
goog.asserts.assert(
|
|
171
|
-
shaka.log.logMap_
|
|
172
|
-
return shaka.log.logMap_
|
|
170
|
+
shaka.log.logMap_.has(curLevel), 'Unexpected log level');
|
|
171
|
+
return shaka.log.logMap_.get(curLevel);
|
|
173
172
|
} else {
|
|
174
173
|
return () => {};
|
|
175
174
|
}
|
|
@@ -187,22 +186,22 @@ if (window.console) {
|
|
|
187
186
|
shaka.log.setLevel(shaka.log.MAX_LOG_LEVEL);
|
|
188
187
|
} else {
|
|
189
188
|
if (shaka.log.MAX_LOG_LEVEL >= shaka.log.Level.ERROR) {
|
|
190
|
-
shaka.log.error = shaka.log.logMap_
|
|
189
|
+
shaka.log.error = shaka.log.logMap_.get(shaka.log.Level.ERROR);
|
|
191
190
|
}
|
|
192
191
|
if (shaka.log.MAX_LOG_LEVEL >= shaka.log.Level.WARNING) {
|
|
193
|
-
shaka.log.warning = shaka.log.logMap_
|
|
192
|
+
shaka.log.warning = shaka.log.logMap_.get(shaka.log.Level.WARNING);
|
|
194
193
|
}
|
|
195
194
|
if (shaka.log.MAX_LOG_LEVEL >= shaka.log.Level.INFO) {
|
|
196
|
-
shaka.log.info = shaka.log.logMap_
|
|
195
|
+
shaka.log.info = shaka.log.logMap_.get(shaka.log.Level.INFO);
|
|
197
196
|
}
|
|
198
197
|
if (shaka.log.MAX_LOG_LEVEL >= shaka.log.Level.DEBUG) {
|
|
199
|
-
shaka.log.debug = shaka.log.logMap_
|
|
198
|
+
shaka.log.debug = shaka.log.logMap_.get(shaka.log.Level.DEBUG);
|
|
200
199
|
}
|
|
201
200
|
if (shaka.log.MAX_LOG_LEVEL >= shaka.log.Level.V1) {
|
|
202
|
-
shaka.log.v1 = shaka.log.logMap_
|
|
201
|
+
shaka.log.v1 = shaka.log.logMap_.get(shaka.log.Level.V1);
|
|
203
202
|
}
|
|
204
203
|
if (shaka.log.MAX_LOG_LEVEL >= shaka.log.Level.V2) {
|
|
205
|
-
shaka.log.v2 = shaka.log.logMap_
|
|
204
|
+
shaka.log.v2 = shaka.log.logMap_.get(shaka.log.Level.V2);
|
|
206
205
|
}
|
|
207
206
|
}
|
|
208
207
|
}
|
package/lib/hls/hls_parser.js
CHANGED
|
@@ -988,6 +988,31 @@ shaka.hls.HlsParser = class {
|
|
|
988
988
|
new shaka.hls.Tag(tag.id, tag.name, newAttributes, null));
|
|
989
989
|
}
|
|
990
990
|
variantTags.push(...newVariantTags);
|
|
991
|
+
|
|
992
|
+
// Duplicate iFrame tags with supplementalCodecs
|
|
993
|
+
const newIFrameTags = [];
|
|
994
|
+
for (const tag of iFrameTags) {
|
|
995
|
+
const supplementalCodecsString =
|
|
996
|
+
tag.getAttributeValue('SUPPLEMENTAL-CODECS');
|
|
997
|
+
if (!supplementalCodecsString) {
|
|
998
|
+
continue;
|
|
999
|
+
}
|
|
1000
|
+
const supplementalCodecs = supplementalCodecsString.split(/\s*,\s*/)
|
|
1001
|
+
.map((codec) => {
|
|
1002
|
+
return codec.split('/')[0];
|
|
1003
|
+
});
|
|
1004
|
+
const newAttributes = tag.attributes.map((attr) => {
|
|
1005
|
+
const name = attr.name;
|
|
1006
|
+
let value = attr.value;
|
|
1007
|
+
if (name == 'CODECS') {
|
|
1008
|
+
value = supplementalCodecs.join(',');
|
|
1009
|
+
}
|
|
1010
|
+
return new shaka.hls.Attribute(name, value);
|
|
1011
|
+
});
|
|
1012
|
+
newIFrameTags.push(
|
|
1013
|
+
new shaka.hls.Tag(tag.id, tag.name, newAttributes, null));
|
|
1014
|
+
}
|
|
1015
|
+
iFrameTags.push(...newIFrameTags);
|
|
991
1016
|
}
|
|
992
1017
|
|
|
993
1018
|
this.parseCodecs_(variantTags);
|
|
@@ -2386,12 +2411,13 @@ shaka.hls.HlsParser = class {
|
|
|
2386
2411
|
return this.uriToStreamInfosMap_.get(key);
|
|
2387
2412
|
}
|
|
2388
2413
|
|
|
2414
|
+
const name = verbatimMediaPlaylistUris.join(',');
|
|
2389
2415
|
const closedCaptions = this.getClosedCaptions_(tags[0], type);
|
|
2390
2416
|
const codecs = shaka.util.ManifestParserUtils.guessCodecs(type, allCodecs);
|
|
2391
2417
|
const streamInfo = this.createStreamInfo_(
|
|
2392
2418
|
streamId, verbatimMediaPlaylistUris,
|
|
2393
2419
|
codecs, type, /* language= */ null, /* primary= */ false,
|
|
2394
|
-
|
|
2420
|
+
name, /* channelCount= */ null, closedCaptions,
|
|
2395
2421
|
/* characteristics= */ null, /* forced= */ false,
|
|
2396
2422
|
/* sampleRate= */ null, /* spatialAudio= */ false);
|
|
2397
2423
|
|