shaka-player 4.7.1 → 4.7.3
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 +31 -31
- package/dist/shaka-player.compiled.debug.js +326 -325
- package/dist/shaka-player.compiled.debug.map +3 -3
- package/dist/shaka-player.compiled.js +1135 -1136
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.debug.js +338 -337
- package/dist/shaka-player.ui.debug.map +3 -3
- package/dist/shaka-player.ui.js +1234 -1235
- package/dist/shaka-player.ui.map +3 -3
- package/externs/isoboxer.js +20 -12
- package/externs/shaka/codecs.js +4 -0
- package/lib/ads/client_side_ad.js +9 -0
- package/lib/ads/client_side_ad_manager.js +3 -2
- package/lib/ads/media_tailor_ad_manager.js +3 -2
- package/lib/dash/dash_parser.js +5 -4
- package/lib/hls/hls_parser.js +13 -2
- package/lib/media/media_source_engine.js +11 -6
- package/lib/media/segment_prefetch.js +2 -2
- package/lib/net/networking_utils.js +3 -1
- package/lib/player.js +1 -1
- package/lib/polyfill/patchedmediakeys_apple.js +6 -0
- package/lib/text/ui_text_displayer.js +7 -0
- package/lib/transmuxer/mss_transmuxer.js +3 -2
- package/lib/transmuxer/ts_transmuxer.js +4 -4
- package/lib/util/mp4_generator.js +14 -10
- package/lib/util/periods.js +284 -230
- package/lib/util/platform.js +20 -1
- package/lib/util/ts_parser.js +15 -16
- package/lib/util/uint8array_utils.js +12 -7
- package/package.json +1 -1
- package/ui/controls.js +2 -1
- package/ui/hidden_seek_button.js +5 -1
package/lib/util/platform.js
CHANGED
|
@@ -234,10 +234,12 @@ shaka.util.Platform = class {
|
|
|
234
234
|
return !!navigator.vendor && navigator.vendor.includes('Apple') &&
|
|
235
235
|
!shaka.util.Platform.isTizen() &&
|
|
236
236
|
!shaka.util.Platform.isEOS() &&
|
|
237
|
+
!shaka.util.Platform.isAPL() &&
|
|
237
238
|
!shaka.util.Platform.isVirginMedia() &&
|
|
238
239
|
!shaka.util.Platform.isOrange() &&
|
|
239
240
|
!shaka.util.Platform.isPS4() &&
|
|
240
|
-
!shaka.util.Platform.isAmazonFireTV()
|
|
241
|
+
!shaka.util.Platform.isAmazonFireTV() &&
|
|
242
|
+
!shaka.util.Platform.isWPE();
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
/**
|
|
@@ -292,6 +294,14 @@ shaka.util.Platform = class {
|
|
|
292
294
|
return shaka.util.Platform.userAgentContains_('AFT');
|
|
293
295
|
}
|
|
294
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Check if the current platform is Comcast X1.
|
|
299
|
+
* @return {boolean}
|
|
300
|
+
*/
|
|
301
|
+
static isWPE() {
|
|
302
|
+
return shaka.util.Platform.userAgentContains_('WPE');
|
|
303
|
+
}
|
|
304
|
+
|
|
295
305
|
/**
|
|
296
306
|
* Returns a major version number for Safari, or Safari-based iOS browsers.
|
|
297
307
|
*
|
|
@@ -348,6 +358,15 @@ shaka.util.Platform = class {
|
|
|
348
358
|
return shaka.util.Platform.userAgentContains_('PC=EOS');
|
|
349
359
|
}
|
|
350
360
|
|
|
361
|
+
/**
|
|
362
|
+
* Check if the current platform is an APL set-top box.
|
|
363
|
+
*
|
|
364
|
+
* @return {boolean}
|
|
365
|
+
*/
|
|
366
|
+
static isAPL() {
|
|
367
|
+
return shaka.util.Platform.userAgentContains_('PC=APL');
|
|
368
|
+
}
|
|
369
|
+
|
|
351
370
|
/**
|
|
352
371
|
* Guesses if the platform is a mobile one (iOS or Android).
|
|
353
372
|
*
|
package/lib/util/ts_parser.js
CHANGED
|
@@ -32,7 +32,7 @@ shaka.util.TsParser = class {
|
|
|
32
32
|
/** @private {?string} */
|
|
33
33
|
this.videoCodec_ = null;
|
|
34
34
|
|
|
35
|
-
/** @private {!Array.<Uint8Array
|
|
35
|
+
/** @private {!Array.<!Array.<Uint8Array>>} */
|
|
36
36
|
this.videoData_ = [];
|
|
37
37
|
|
|
38
38
|
/** @private {!Array.<shaka.extern.MPEG_PES>} */
|
|
@@ -44,7 +44,7 @@ shaka.util.TsParser = class {
|
|
|
44
44
|
/** @private {?string} */
|
|
45
45
|
this.audioCodec_ = null;
|
|
46
46
|
|
|
47
|
-
/** @private {!Array.<Uint8Array
|
|
47
|
+
/** @private {!Array.<!Array.<Uint8Array>>} */
|
|
48
48
|
this.audioData_ = [];
|
|
49
49
|
|
|
50
50
|
/** @private {!Array.<shaka.extern.MPEG_PES>} */
|
|
@@ -53,7 +53,7 @@ shaka.util.TsParser = class {
|
|
|
53
53
|
/** @private {?number} */
|
|
54
54
|
this.id3Pid_ = null;
|
|
55
55
|
|
|
56
|
-
/** @private {!Array.<Uint8Array
|
|
56
|
+
/** @private {!Array.<!Array.<Uint8Array>>} */
|
|
57
57
|
this.id3Data_ = [];
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -79,7 +79,6 @@ shaka.util.TsParser = class {
|
|
|
79
79
|
*/
|
|
80
80
|
parse(data) {
|
|
81
81
|
const packetLength = shaka.util.TsParser.PacketLength_;
|
|
82
|
-
const Uint8ArrayUtils = shaka.util.Uint8ArrayUtils;
|
|
83
82
|
|
|
84
83
|
// A TS fragment should contain at least 3 TS packets, a PAT, a PMT, and
|
|
85
84
|
// one PID.
|
|
@@ -162,12 +161,11 @@ shaka.util.TsParser = class {
|
|
|
162
161
|
case this.videoPid_: {
|
|
163
162
|
const videoData = data.subarray(offset, start + packetLength);
|
|
164
163
|
if (payloadUnitStartIndicator) {
|
|
165
|
-
this.videoData_.push(videoData);
|
|
164
|
+
this.videoData_.push([videoData]);
|
|
166
165
|
} else if (this.videoData_.length) {
|
|
167
166
|
const prevVideoData = this.videoData_[this.videoData_.length - 1];
|
|
168
167
|
if (prevVideoData) {
|
|
169
|
-
this.videoData_[this.videoData_.length - 1]
|
|
170
|
-
Uint8ArrayUtils.concat(prevVideoData, videoData);
|
|
168
|
+
this.videoData_[this.videoData_.length - 1].push(videoData);
|
|
171
169
|
}
|
|
172
170
|
}
|
|
173
171
|
break;
|
|
@@ -175,12 +173,11 @@ shaka.util.TsParser = class {
|
|
|
175
173
|
case this.audioPid_: {
|
|
176
174
|
const audioData = data.subarray(offset, start + packetLength);
|
|
177
175
|
if (payloadUnitStartIndicator) {
|
|
178
|
-
this.audioData_.push(audioData);
|
|
176
|
+
this.audioData_.push([audioData]);
|
|
179
177
|
} else if (this.audioData_.length) {
|
|
180
178
|
const prevAudioData = this.audioData_[this.audioData_.length - 1];
|
|
181
179
|
if (prevAudioData) {
|
|
182
|
-
this.audioData_[this.audioData_.length - 1]
|
|
183
|
-
Uint8ArrayUtils.concat(prevAudioData, audioData);
|
|
180
|
+
this.audioData_[this.audioData_.length - 1].push(audioData);
|
|
184
181
|
}
|
|
185
182
|
}
|
|
186
183
|
break;
|
|
@@ -188,12 +185,11 @@ shaka.util.TsParser = class {
|
|
|
188
185
|
case this.id3Pid_: {
|
|
189
186
|
const id3Data = data.subarray(offset, start + packetLength);
|
|
190
187
|
if (payloadUnitStartIndicator) {
|
|
191
|
-
this.id3Data_.push(id3Data);
|
|
188
|
+
this.id3Data_.push([id3Data]);
|
|
192
189
|
} else if (this.id3Data_.length) {
|
|
193
190
|
const prevId3Data = this.id3Data_[this.id3Data_.length - 1];
|
|
194
191
|
if (prevId3Data) {
|
|
195
|
-
this.id3Data_[this.id3Data_.length - 1]
|
|
196
|
-
Uint8ArrayUtils.concat(prevId3Data, id3Data);
|
|
192
|
+
this.id3Data_[this.id3Data_.length - 1].push(id3Data);
|
|
197
193
|
}
|
|
198
194
|
}
|
|
199
195
|
break;
|
|
@@ -588,7 +584,8 @@ shaka.util.TsParser = class {
|
|
|
588
584
|
getMetadata() {
|
|
589
585
|
const timescale = shaka.util.TsParser.Timescale;
|
|
590
586
|
const metadata = [];
|
|
591
|
-
for (const
|
|
587
|
+
for (const id3DataArray of this.id3Data_) {
|
|
588
|
+
const id3Data = shaka.util.Uint8ArrayUtils.concat(...id3DataArray);
|
|
592
589
|
const pes = this.parsePES_(id3Data);
|
|
593
590
|
if (pes) {
|
|
594
591
|
metadata.push({
|
|
@@ -612,7 +609,8 @@ shaka.util.TsParser = class {
|
|
|
612
609
|
getAudioData() {
|
|
613
610
|
if (this.audioData_.length && !this.audioPes_.length) {
|
|
614
611
|
let sort = false;
|
|
615
|
-
for (const
|
|
612
|
+
for (const audioDataArray of this.audioData_) {
|
|
613
|
+
const audioData = shaka.util.Uint8ArrayUtils.concat(...audioDataArray);
|
|
616
614
|
const pes = this.parsePES_(audioData);
|
|
617
615
|
let previousPes = this.audioPes_.length ?
|
|
618
616
|
this.audioPes_[this.audioPes_.length - 1] : null;
|
|
@@ -654,7 +652,8 @@ shaka.util.TsParser = class {
|
|
|
654
652
|
getVideoData(naluProcessing = true) {
|
|
655
653
|
if (this.videoData_.length && !this.videoPes_.length) {
|
|
656
654
|
let sort = false;
|
|
657
|
-
for (const
|
|
655
|
+
for (const videoDataArray of this.videoData_) {
|
|
656
|
+
const videoData = shaka.util.Uint8ArrayUtils.concat(...videoDataArray);
|
|
658
657
|
const pes = this.parsePES_(videoData);
|
|
659
658
|
let previousPes = this.videoPes_.length ?
|
|
660
659
|
this.videoPes_[this.videoPes_.length - 1] : null;
|
|
@@ -107,21 +107,26 @@ shaka.util.Uint8ArrayUtils = class {
|
|
|
107
107
|
* @export
|
|
108
108
|
*/
|
|
109
109
|
static concat(...varArgs) {
|
|
110
|
+
const BufferUtils = shaka.util.BufferUtils;
|
|
110
111
|
let totalLength = 0;
|
|
111
|
-
for (
|
|
112
|
-
|
|
112
|
+
for (let i = 0; i < varArgs.length; ++i) {
|
|
113
|
+
const value = varArgs[i];
|
|
114
|
+
totalLength += value.byteLength;
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
const result = new Uint8Array(totalLength);
|
|
116
118
|
let offset = 0;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
|
|
120
|
+
for (let i = 0; i < varArgs.length; ++i) {
|
|
121
|
+
const value = varArgs[i];
|
|
122
|
+
if (value instanceof Uint8Array) {
|
|
123
|
+
result.set(value, offset);
|
|
120
124
|
} else {
|
|
121
|
-
result.set(
|
|
125
|
+
result.set(BufferUtils.toUint8(value), offset);
|
|
122
126
|
}
|
|
123
|
-
offset +=
|
|
127
|
+
offset += value.byteLength;
|
|
124
128
|
}
|
|
129
|
+
|
|
125
130
|
return result;
|
|
126
131
|
}
|
|
127
132
|
};
|
package/package.json
CHANGED
package/ui/controls.js
CHANGED
|
@@ -652,7 +652,8 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
|
|
|
652
652
|
isPiPAllowed() {
|
|
653
653
|
if ('documentPictureInPicture' in window &&
|
|
654
654
|
this.config_.preferDocumentPictureInPicture) {
|
|
655
|
-
|
|
655
|
+
const video = /** @type {HTMLVideoElement} */(this.localVideo_);
|
|
656
|
+
return !video.disablePictureInPicture;
|
|
656
657
|
}
|
|
657
658
|
if (document.pictureInPictureEnabled) {
|
|
658
659
|
const video = /** @type {HTMLVideoElement} */(this.localVideo_);
|
package/ui/hidden_seek_button.js
CHANGED
|
@@ -44,7 +44,11 @@ shaka.ui.HiddenSeekButton = class extends shaka.ui.Element {
|
|
|
44
44
|
this.seekContainer = shaka.util.Dom.createHTMLElement('div');
|
|
45
45
|
this.parent.appendChild(this.seekContainer);
|
|
46
46
|
|
|
47
|
-
this.eventManager.listen(this.seekContainer, '
|
|
47
|
+
this.eventManager.listen(this.seekContainer, 'touchend', (event) => {
|
|
48
|
+
// Do nothing if the controls are not visible
|
|
49
|
+
if (!this.controls.isOpaque()) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
48
52
|
// In case any settings menu are open this assigns the first touch
|
|
49
53
|
// to close the menu.
|
|
50
54
|
if (this.controls.anySettingsMenusAreOpen()) {
|