shaka-player 4.7.13 → 4.8.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/AUTHORS +2 -0
- package/CONTRIBUTORS +2 -0
- package/LICENSE +54 -0
- package/README.md +22 -1
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/deps.js +34 -23
- package/dist/locales.js +41 -31
- package/dist/shaka-player.compiled.d.ts +196 -45
- package/dist/shaka-player.compiled.debug.d.ts +196 -45
- package/dist/shaka-player.compiled.debug.externs.js +491 -348
- package/dist/shaka-player.compiled.debug.js +969 -847
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +491 -348
- package/dist/shaka-player.compiled.js +1238 -1171
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +259 -48
- package/dist/shaka-player.ui.debug.d.ts +259 -48
- package/dist/shaka-player.ui.debug.externs.js +598 -377
- package/dist/shaka-player.ui.debug.js +1185 -980
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +598 -377
- package/dist/shaka-player.ui.js +1526 -1408
- package/dist/shaka-player.ui.map +4 -4
- package/externs/device_sensor_event.js +18 -0
- package/externs/hisense.js +16 -0
- package/externs/playstation.js +31 -0
- package/externs/shaka/abr_manager.js +3 -1
- package/externs/shaka/ads.js +5 -0
- package/externs/shaka/codecs.js +13 -0
- package/externs/shaka/manifest.js +58 -6
- package/externs/shaka/net.js +13 -1
- package/externs/shaka/player.js +184 -13
- package/externs/shaka/text.js +19 -0
- package/externs/tizen.js +41 -0
- package/externs/webos.js +19 -0
- package/externs/xbox.js +43 -0
- package/lib/abr/simple_abr_manager.js +9 -1
- package/lib/ads/ad_manager.js +19 -2
- package/lib/ads/client_side_ad_manager.js +5 -3
- package/lib/ads/media_tailor_ad_manager.js +9 -0
- package/lib/cast/cast_receiver.js +0 -14
- package/lib/cast/cast_utils.js +1 -0
- package/lib/cea/mp4_cea_parser.js +6 -1
- package/lib/dash/content_protection.js +97 -53
- package/lib/dash/dash_parser.js +237 -177
- package/lib/dash/mpd_utils.js +72 -65
- package/lib/dash/segment_base.js +27 -21
- package/lib/dash/segment_list.js +18 -16
- package/lib/dash/segment_template.js +45 -22
- package/lib/hls/hls_parser.js +358 -164
- package/lib/media/buffering_observer.js +25 -1
- package/lib/media/drm_engine.js +91 -71
- package/lib/media/manifest_filterer.js +220 -0
- package/lib/media/media_source_engine.js +34 -5
- package/lib/media/preload_manager.js +827 -0
- package/lib/media/presentation_timeline.js +11 -0
- package/lib/media/segment_index.js +93 -47
- package/lib/media/segment_prefetch.js +140 -43
- package/lib/media/segment_reference.js +43 -8
- package/lib/media/segment_utils.js +208 -25
- package/lib/media/streaming_engine.js +355 -66
- package/lib/mss/content_protection.js +31 -25
- package/lib/mss/mss_parser.js +79 -55
- package/lib/net/networking_engine.js +49 -4
- package/lib/offline/storage.js +3 -3
- package/lib/player.js +882 -672
- package/lib/polyfill/media_capabilities.js +16 -1
- package/lib/text/simple_text_displayer.js +9 -0
- package/lib/text/stub_text_displayer.js +7 -0
- package/lib/text/text_engine.js +16 -3
- package/lib/text/ttml_text_parser.js +116 -114
- package/lib/text/ui_text_displayer.js +28 -11
- package/lib/text/vtt_text_parser.js +54 -115
- package/lib/transmuxer/opus.js +91 -0
- package/lib/transmuxer/ts_transmuxer.js +115 -0
- package/lib/util/cmcd_manager.js +153 -3
- package/lib/util/dom_utils.js +11 -0
- package/lib/util/error.js +5 -0
- package/lib/util/fake_event.js +2 -0
- package/lib/util/manifest_parser_utils.js +97 -3
- package/lib/util/mp4_box_parsers.js +346 -17
- package/lib/util/mp4_generator.js +23 -0
- package/lib/util/periods.js +19 -0
- package/lib/util/platform.js +161 -9
- package/lib/util/player_configuration.js +79 -13
- package/lib/util/stats.js +16 -0
- package/lib/util/stream_utils.js +22 -8
- package/lib/util/string_utils.js +36 -0
- package/lib/util/tXml.js +814 -0
- package/lib/util/ts_parser.js +50 -0
- package/lib/util/xml_utils.js +10 -338
- package/package.json +2 -2
- package/shaka-player.uncompiled.js +8 -0
- package/ui/controls.js +187 -5
- package/ui/enums.js +2 -0
- package/ui/externs/ui.js +30 -3
- package/ui/gl_matrix/matrix_4x4.js +568 -0
- package/ui/gl_matrix/matrix_quaternion.js +45 -0
- package/ui/less/containers.less +11 -0
- package/ui/locales/en-GB.json +2 -0
- package/ui/locales/en.json +2 -0
- package/ui/locales/es-419.json +2 -0
- package/ui/locales/es.json +2 -0
- package/ui/locales/source.json +8 -0
- package/ui/recenter_vr.js +126 -0
- package/ui/resolution_selection.js +25 -5
- package/ui/statistics_button.js +12 -0
- package/ui/text_selection.js +1 -1
- package/ui/toggle_stereoscopic.js +127 -0
- package/ui/ui.js +74 -38
- package/ui/vr_manager.js +557 -0
- package/ui/vr_utils.js +232 -0
- package/ui/vr_webgl.js +697 -0
package/lib/util/ts_parser.js
CHANGED
|
@@ -62,6 +62,9 @@ shaka.util.TsParser = class {
|
|
|
62
62
|
|
|
63
63
|
/** @private {?number} */
|
|
64
64
|
this.referenceDts_ = null;
|
|
65
|
+
|
|
66
|
+
/** @private {?shaka.util.TsParser.OpusMetadata} */
|
|
67
|
+
this.opusMetadata_ = null;
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
/**
|
|
@@ -302,6 +305,29 @@ shaka.util.TsParser = class {
|
|
|
302
305
|
result.audioCodec = 'aac';
|
|
303
306
|
}
|
|
304
307
|
break;
|
|
308
|
+
// DVB extension descriptor
|
|
309
|
+
case 0x7f:
|
|
310
|
+
if (result.audioCodec == 'opus') {
|
|
311
|
+
const extensionDescriptorId = data[parsePos + 2];
|
|
312
|
+
let channelConfigCode = null;
|
|
313
|
+
// User defined (provisional Opus)
|
|
314
|
+
if (extensionDescriptorId === 0x80) {
|
|
315
|
+
channelConfigCode = data[parsePos + 3];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (channelConfigCode == null) {
|
|
319
|
+
// Not Supported Opus channel count.
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
const channelCount = (channelConfigCode & 0x0F) === 0 ?
|
|
323
|
+
2 : (channelConfigCode & 0x0F);
|
|
324
|
+
this.opusMetadata_ = {
|
|
325
|
+
channelCount,
|
|
326
|
+
channelConfigCode,
|
|
327
|
+
sampleRate: 48000,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
break;
|
|
305
331
|
}
|
|
306
332
|
parsePos += descriptorLen;
|
|
307
333
|
remaining -= descriptorLen;
|
|
@@ -1113,6 +1139,15 @@ shaka.util.TsParser = class {
|
|
|
1113
1139
|
return videoInfo;
|
|
1114
1140
|
}
|
|
1115
1141
|
|
|
1142
|
+
/**
|
|
1143
|
+
* Return the Opus metadata
|
|
1144
|
+
*
|
|
1145
|
+
* @return {?shaka.util.TsParser.OpusMetadata}
|
|
1146
|
+
*/
|
|
1147
|
+
getOpusMetadata() {
|
|
1148
|
+
return this.opusMetadata_;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1116
1151
|
/**
|
|
1117
1152
|
* Convert a byte to 2 digits of hex. (Only handles values 0-255.)
|
|
1118
1153
|
*
|
|
@@ -1272,3 +1307,18 @@ shaka.util.TsParser.PROFILES_WITH_OPTIONAL_SPS_DATA_ =
|
|
|
1272
1307
|
*/
|
|
1273
1308
|
shaka.util.TsParser.PMT;
|
|
1274
1309
|
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* @typedef {{
|
|
1313
|
+
* channelCount: number,
|
|
1314
|
+
* channelConfigCode: number,
|
|
1315
|
+
* sampleRate: number
|
|
1316
|
+
* }}
|
|
1317
|
+
*
|
|
1318
|
+
* @summary PMT.
|
|
1319
|
+
* @property {number} channelCount
|
|
1320
|
+
* @property {number} channelConfigCode
|
|
1321
|
+
* @property {number} sampleRate
|
|
1322
|
+
*/
|
|
1323
|
+
shaka.util.TsParser.OpusMetadata;
|
|
1324
|
+
|
package/lib/util/xml_utils.js
CHANGED
|
@@ -16,343 +16,6 @@ goog.require('shaka.util.StringUtils');
|
|
|
16
16
|
* @summary A set of XML utility functions.
|
|
17
17
|
*/
|
|
18
18
|
shaka.util.XmlUtils = class {
|
|
19
|
-
/**
|
|
20
|
-
* Finds a child XML element.
|
|
21
|
-
* @param {!Node} elem The parent XML element.
|
|
22
|
-
* @param {string} name The child XML element's tag name.
|
|
23
|
-
* @return {Element} The child XML element, or null if a child XML element
|
|
24
|
-
* does not exist with the given tag name OR if there exists more than one
|
|
25
|
-
* child XML element with the given tag name.
|
|
26
|
-
*/
|
|
27
|
-
static findChild(elem, name) {
|
|
28
|
-
const children = shaka.util.XmlUtils.findChildren(elem, name);
|
|
29
|
-
if (children.length != 1) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return children[0];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Finds a namespace-qualified child XML element.
|
|
38
|
-
* @param {!Node} elem The parent XML element.
|
|
39
|
-
* @param {string} ns The child XML element's namespace URI.
|
|
40
|
-
* @param {string} name The child XML element's local name.
|
|
41
|
-
* @return {Element} The child XML element, or null if a child XML element
|
|
42
|
-
* does not exist with the given tag name OR if there exists more than one
|
|
43
|
-
* child XML element with the given tag name.
|
|
44
|
-
*/
|
|
45
|
-
static findChildNS(elem, ns, name) {
|
|
46
|
-
const children = shaka.util.XmlUtils.findChildrenNS(elem, ns, name);
|
|
47
|
-
if (children.length != 1) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
return children[0];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Finds child XML elements.
|
|
56
|
-
* @param {!Node} elem The parent XML element.
|
|
57
|
-
* @param {string} name The child XML element's tag name.
|
|
58
|
-
* @return {!Array.<!Element>} The child XML elements.
|
|
59
|
-
*/
|
|
60
|
-
static findChildren(elem, name) {
|
|
61
|
-
const found = [];
|
|
62
|
-
for (const child of elem.childNodes) {
|
|
63
|
-
if (child instanceof Element && child.tagName == name) {
|
|
64
|
-
found.push(child);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return found;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @param {!Node} elem the parent XML element.
|
|
73
|
-
* @return {!Array.<!Element>} The child XML elements.
|
|
74
|
-
*/
|
|
75
|
-
static getChildren(elem) {
|
|
76
|
-
return Array.from(elem.childNodes).filter((child) => {
|
|
77
|
-
return child instanceof Element;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Finds namespace-qualified child XML elements.
|
|
84
|
-
* @param {!Node} elem The parent XML element.
|
|
85
|
-
* @param {string} ns The child XML element's namespace URI.
|
|
86
|
-
* @param {string} name The child XML element's local name.
|
|
87
|
-
* @return {!Array.<!Element>} The child XML elements.
|
|
88
|
-
*/
|
|
89
|
-
static findChildrenNS(elem, ns, name) {
|
|
90
|
-
const found = [];
|
|
91
|
-
for (const child of elem.childNodes) {
|
|
92
|
-
if (child instanceof Element && child.localName == name &&
|
|
93
|
-
child.namespaceURI == ns) {
|
|
94
|
-
found.push(child);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return found;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Gets a namespace-qualified attribute.
|
|
103
|
-
* @param {!Element} elem The element to get from.
|
|
104
|
-
* @param {string} ns The namespace URI.
|
|
105
|
-
* @param {string} name The local name of the attribute.
|
|
106
|
-
* @return {?string} The attribute's value, or null if not present.
|
|
107
|
-
*/
|
|
108
|
-
static getAttributeNS(elem, ns, name) {
|
|
109
|
-
// Some browsers return the empty string when the attribute is missing,
|
|
110
|
-
// so check if it exists first. See: https://mzl.la/2L7F0UK
|
|
111
|
-
return elem.hasAttributeNS(ns, name) ? elem.getAttributeNS(ns, name) : null;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Gets a namespace-qualified attribute.
|
|
117
|
-
* @param {!Element} elem The element to get from.
|
|
118
|
-
* @param {!Array.<string>} nsList The lis of namespace URIs.
|
|
119
|
-
* @param {string} name The local name of the attribute.
|
|
120
|
-
* @return {?string} The attribute's value, or null if not present.
|
|
121
|
-
*/
|
|
122
|
-
static getAttributeNSList(elem, nsList, name) {
|
|
123
|
-
// Some browsers return the empty string when the attribute is missing,
|
|
124
|
-
// so check if it exists first. See: https://mzl.la/2L7F0UK
|
|
125
|
-
for (const ns of nsList) {
|
|
126
|
-
if (elem.hasAttributeNS(ns, name)) {
|
|
127
|
-
return elem.getAttributeNS(ns, name);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Gets the text contents of a node.
|
|
136
|
-
* @param {!Node} elem The XML element.
|
|
137
|
-
* @return {?string} The text contents, or null if there are none.
|
|
138
|
-
*/
|
|
139
|
-
static getContents(elem) {
|
|
140
|
-
const XmlUtils = shaka.util.XmlUtils;
|
|
141
|
-
if (!Array.from(elem.childNodes).every(XmlUtils.isText)) {
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Read merged text content from all text nodes.
|
|
146
|
-
return elem.textContent.trim();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Checks if a node is of type text.
|
|
151
|
-
* @param {!Node} elem The XML element.
|
|
152
|
-
* @return {boolean} True if it is a text node.
|
|
153
|
-
*/
|
|
154
|
-
static isText(elem) {
|
|
155
|
-
return elem.nodeType == Node.TEXT_NODE ||
|
|
156
|
-
elem.nodeType == Node.CDATA_SECTION_NODE;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Parses an attribute by its name.
|
|
161
|
-
* @param {!Element} elem The XML element.
|
|
162
|
-
* @param {string} name The attribute name.
|
|
163
|
-
* @param {function(string): (T|null)} parseFunction A function that parses
|
|
164
|
-
* the attribute.
|
|
165
|
-
* @param {(T|null)=} defaultValue The attribute's default value, if not
|
|
166
|
-
* specified, the attibute's default value is null.
|
|
167
|
-
* @return {(T|null)} The parsed attribute on success, or the attribute's
|
|
168
|
-
* default value if the attribute does not exist or could not be parsed.
|
|
169
|
-
* @template T
|
|
170
|
-
*/
|
|
171
|
-
static parseAttr(
|
|
172
|
-
elem, name, parseFunction, defaultValue = null) {
|
|
173
|
-
let parsedValue = null;
|
|
174
|
-
|
|
175
|
-
const value = elem.getAttribute(name);
|
|
176
|
-
if (value != null) {
|
|
177
|
-
parsedValue = parseFunction(value);
|
|
178
|
-
}
|
|
179
|
-
return parsedValue == null ? defaultValue : parsedValue;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Parses an XML date string.
|
|
185
|
-
* @param {string} dateString
|
|
186
|
-
* @return {?number} The parsed date in seconds on success; otherwise, return
|
|
187
|
-
* null.
|
|
188
|
-
*/
|
|
189
|
-
static parseDate(dateString) {
|
|
190
|
-
if (!dateString) {
|
|
191
|
-
return null;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Times in the manifest should be in UTC. If they don't specify a timezone,
|
|
195
|
-
// Date.parse() will use the local timezone instead of UTC. So manually add
|
|
196
|
-
// the timezone if missing ('Z' indicates the UTC timezone).
|
|
197
|
-
// Format: YYYY-MM-DDThh:mm:ss.ssssss
|
|
198
|
-
if (/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(dateString)) {
|
|
199
|
-
dateString += 'Z';
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const result = Date.parse(dateString);
|
|
203
|
-
return isNaN(result) ? null : (result / 1000.0);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Parses an XML duration string.
|
|
209
|
-
* Negative values are not supported. Years and months are treated as exactly
|
|
210
|
-
* 365 and 30 days respectively.
|
|
211
|
-
* @param {string} durationString The duration string, e.g., "PT1H3M43.2S",
|
|
212
|
-
* which means 1 hour, 3 minutes, and 43.2 seconds.
|
|
213
|
-
* @return {?number} The parsed duration in seconds on success; otherwise,
|
|
214
|
-
* return null.
|
|
215
|
-
* @see {@link http://www.datypic.com/sc/xsd/t-xsd_duration.html}
|
|
216
|
-
*/
|
|
217
|
-
static parseDuration(durationString) {
|
|
218
|
-
if (!durationString) {
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const re = '^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?' +
|
|
223
|
-
'(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$';
|
|
224
|
-
const matches = new RegExp(re).exec(durationString);
|
|
225
|
-
|
|
226
|
-
if (!matches) {
|
|
227
|
-
shaka.log.warning('Invalid duration string:', durationString);
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Note: Number(null) == 0 but Number(undefined) == NaN.
|
|
232
|
-
const years = Number(matches[1] || null);
|
|
233
|
-
const months = Number(matches[2] || null);
|
|
234
|
-
const days = Number(matches[3] || null);
|
|
235
|
-
const hours = Number(matches[4] || null);
|
|
236
|
-
const minutes = Number(matches[5] || null);
|
|
237
|
-
const seconds = Number(matches[6] || null);
|
|
238
|
-
|
|
239
|
-
// Assume a year always has 365 days and a month always has 30 days.
|
|
240
|
-
const d = (60 * 60 * 24 * 365) * years +
|
|
241
|
-
(60 * 60 * 24 * 30) * months +
|
|
242
|
-
(60 * 60 * 24) * days +
|
|
243
|
-
(60 * 60) * hours +
|
|
244
|
-
60 * minutes +
|
|
245
|
-
seconds;
|
|
246
|
-
return isFinite(d) ? d : null;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Parses a range string.
|
|
252
|
-
* @param {string} rangeString The range string, e.g., "101-9213".
|
|
253
|
-
* @return {?{start: number, end: number}} The parsed range on success;
|
|
254
|
-
* otherwise, return null.
|
|
255
|
-
*/
|
|
256
|
-
static parseRange(rangeString) {
|
|
257
|
-
const matches = /([0-9]+)-([0-9]+)/.exec(rangeString);
|
|
258
|
-
|
|
259
|
-
if (!matches) {
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
const start = Number(matches[1]);
|
|
264
|
-
if (!isFinite(start)) {
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const end = Number(matches[2]);
|
|
269
|
-
if (!isFinite(end)) {
|
|
270
|
-
return null;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
return {start: start, end: end};
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Parses an integer.
|
|
279
|
-
* @param {string} intString The integer string.
|
|
280
|
-
* @return {?number} The parsed integer on success; otherwise, return null.
|
|
281
|
-
*/
|
|
282
|
-
static parseInt(intString) {
|
|
283
|
-
const n = Number(intString);
|
|
284
|
-
return (n % 1 === 0) ? n : null;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Parses a positive integer.
|
|
290
|
-
* @param {string} intString The integer string.
|
|
291
|
-
* @return {?number} The parsed positive integer on success; otherwise,
|
|
292
|
-
* return null.
|
|
293
|
-
*/
|
|
294
|
-
static parsePositiveInt(intString) {
|
|
295
|
-
const n = Number(intString);
|
|
296
|
-
return (n % 1 === 0) && (n > 0) ? n : null;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Parses a non-negative integer.
|
|
302
|
-
* @param {string} intString The integer string.
|
|
303
|
-
* @return {?number} The parsed non-negative integer on success; otherwise,
|
|
304
|
-
* return null.
|
|
305
|
-
*/
|
|
306
|
-
static parseNonNegativeInt(intString) {
|
|
307
|
-
const n = Number(intString);
|
|
308
|
-
return (n % 1 === 0) && (n >= 0) ? n : null;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Parses a floating point number.
|
|
314
|
-
* @param {string} floatString The floating point number string.
|
|
315
|
-
* @return {?number} The parsed floating point number on success; otherwise,
|
|
316
|
-
* return null. May return -Infinity or Infinity.
|
|
317
|
-
*/
|
|
318
|
-
static parseFloat(floatString) {
|
|
319
|
-
const n = Number(floatString);
|
|
320
|
-
return !isNaN(n) ? n : null;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Parses a boolean.
|
|
326
|
-
* @param {string} booleanString The boolean string.
|
|
327
|
-
* @return {boolean} The boolean
|
|
328
|
-
*/
|
|
329
|
-
static parseBoolean(booleanString) {
|
|
330
|
-
if (!booleanString) {
|
|
331
|
-
return false;
|
|
332
|
-
}
|
|
333
|
-
return booleanString.toLowerCase() === 'true';
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Evaluate a division expressed as a string.
|
|
339
|
-
* @param {string} exprString
|
|
340
|
-
* The expression to evaluate, e.g. "200/2". Can also be a single number.
|
|
341
|
-
* @return {?number} The evaluated expression as floating point number on
|
|
342
|
-
* success; otherwise return null.
|
|
343
|
-
*/
|
|
344
|
-
static evalDivision(exprString) {
|
|
345
|
-
let res;
|
|
346
|
-
let n;
|
|
347
|
-
if ((res = exprString.match(/^(\d+)\/(\d+)$/))) {
|
|
348
|
-
n = Number(res[1]) / Number(res[2]);
|
|
349
|
-
} else {
|
|
350
|
-
n = Number(exprString);
|
|
351
|
-
}
|
|
352
|
-
return !isNaN(n) ? n : null;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
|
|
356
19
|
/**
|
|
357
20
|
* Parse a string and return the resulting root element if it was valid XML.
|
|
358
21
|
*
|
|
@@ -437,6 +100,16 @@ shaka.util.XmlUtils = class {
|
|
|
437
100
|
return null;
|
|
438
101
|
}
|
|
439
102
|
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Converts a Element to BufferSource.
|
|
107
|
+
* @param {!Element} elem
|
|
108
|
+
* @return {!ArrayBuffer}
|
|
109
|
+
*/
|
|
110
|
+
static toArrayBuffer(elem) {
|
|
111
|
+
return shaka.util.StringUtils.toUTF8(elem.outerHTML);
|
|
112
|
+
}
|
|
440
113
|
};
|
|
441
114
|
|
|
442
115
|
/**
|
|
@@ -458,4 +131,3 @@ shaka.util.XmlUtils.trustedHTMLFromString_ = new shaka.util.Lazy(() => {
|
|
|
458
131
|
// Fall back to strings in environments that don't support Trusted Types.
|
|
459
132
|
return (s) => s;
|
|
460
133
|
});
|
|
461
|
-
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shaka-player",
|
|
3
3
|
"description": "DASH/EME video player library",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.8.1",
|
|
5
5
|
"homepage": "https://github.com/shaka-project/shaka-player",
|
|
6
6
|
"author": "Google",
|
|
7
7
|
"maintainers": [
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"karma-sourcemap-loader": "^0.3.8",
|
|
49
49
|
"karma-spec-reporter": "^0.0.34",
|
|
50
50
|
"karma-webdriver-launcher": "^1.0.8",
|
|
51
|
-
"lcevc_dec.js": "^1.
|
|
51
|
+
"lcevc_dec.js": "^1.1.3",
|
|
52
52
|
"less": "^4.2.0",
|
|
53
53
|
"less-plugin-clean-css": "github:austingardner/less-plugin-clean-css#4e9e77bf",
|
|
54
54
|
"material-design-lite": "^1.3.0",
|
|
@@ -75,6 +75,7 @@ goog.require('shaka.transmuxer.H265');
|
|
|
75
75
|
goog.require('shaka.transmuxer.Mp3Transmuxer');
|
|
76
76
|
goog.require('shaka.transmuxer.MpegAudio');
|
|
77
77
|
goog.require('shaka.transmuxer.MpegTsTransmuxer');
|
|
78
|
+
goog.require('shaka.transmuxer.Opus');
|
|
78
79
|
goog.require('shaka.transmuxer.TransmuxerEngine');
|
|
79
80
|
goog.require('shaka.transmuxer.MssTransmuxer');
|
|
80
81
|
goog.require('shaka.transmuxer.TsTransmuxer');
|
|
@@ -94,11 +95,14 @@ goog.require('shaka.ui.FastForwardButton');
|
|
|
94
95
|
goog.require('shaka.ui.FullscreenButton');
|
|
95
96
|
goog.require('shaka.ui.Localization');
|
|
96
97
|
goog.require('shaka.ui.LoopButton');
|
|
98
|
+
goog.require('shaka.ui.Matrix4x4');
|
|
99
|
+
goog.require('shaka.ui.MatrixQuaternion');
|
|
97
100
|
goog.require('shaka.ui.MuteButton');
|
|
98
101
|
goog.require('shaka.ui.Overlay');
|
|
99
102
|
goog.require('shaka.ui.PipButton');
|
|
100
103
|
goog.require('shaka.ui.PlaybackRateSelection');
|
|
101
104
|
goog.require('shaka.ui.PresentationTimeTracker');
|
|
105
|
+
goog.require('shaka.ui.RecenterVRButton');
|
|
102
106
|
goog.require('shaka.ui.RemoteButton');
|
|
103
107
|
goog.require('shaka.ui.ResolutionSelection');
|
|
104
108
|
goog.require('shaka.ui.RewindButton');
|
|
@@ -107,7 +111,11 @@ goog.require('shaka.ui.SmallPlayButton');
|
|
|
107
111
|
goog.require('shaka.ui.Spacer');
|
|
108
112
|
goog.require('shaka.ui.StatisticsButton');
|
|
109
113
|
goog.require('shaka.ui.TextSelection');
|
|
114
|
+
goog.require('shaka.ui.ToggleStereoscopicButton');
|
|
110
115
|
goog.require('shaka.ui.VolumeBar');
|
|
116
|
+
goog.require('shaka.ui.VRManager');
|
|
117
|
+
goog.require('shaka.ui.VRUtils');
|
|
118
|
+
goog.require('shaka.ui.VRWebgl');
|
|
111
119
|
goog.require('shaka.util.Dom');
|
|
112
120
|
goog.require('shaka.util.Error');
|
|
113
121
|
goog.require('shaka.util.FairPlayUtils');
|