shaka-player 3.1.0 → 3.1.4
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 +8 -2
- package/CHANGELOG.md +209 -0
- package/CONTRIBUTORS +10 -3
- package/README.md +3 -0
- package/build/apps.py +2 -2
- package/build/check.py +2 -2
- package/build/conformance.textproto +0 -9
- package/build/generateExterns.js +1 -1
- package/build/misspellings.txt +1 -0
- package/build/shakaBuildHelpers.py +6 -5
- package/build/subprocessWindowsPatch.py +103 -0
- package/demo/common/asset.js +11 -0
- package/demo/common/assets.js +1 -1
- package/demo/common/message_ids.js +5 -0
- package/demo/config.js +2 -1
- package/demo/custom.js +84 -3
- package/demo/demo.less +13 -1
- package/demo/demo_utils.js +1 -0
- package/demo/input.js +31 -12
- package/demo/input_container.js +24 -1
- package/demo/locales/en.json +6 -1
- package/demo/locales/source.json +20 -0
- package/demo/main.js +5 -1
- package/dist/controls.css +2 -2
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +99 -91
- package/dist/demo.compiled.debug.map +3 -3
- package/dist/demo.compiled.js +99 -91
- package/dist/demo.compiled.map +3 -3
- package/dist/demo.css +1 -1
- package/dist/demo.css.map +1 -1
- package/dist/deps.js +9 -9
- package/dist/locales.js +36 -34
- package/dist/receiver.compiled.debug.js +74 -70
- package/dist/receiver.compiled.debug.map +3 -3
- package/dist/receiver.compiled.js +74 -70
- package/dist/receiver.compiled.map +3 -3
- package/dist/shaka-player.compiled.d.ts +165 -9
- package/dist/shaka-player.compiled.debug.d.ts +165 -9
- package/dist/shaka-player.compiled.debug.externs.js +179 -11
- package/dist/shaka-player.compiled.debug.js +367 -339
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +179 -11
- package/dist/shaka-player.compiled.js +818 -807
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +165 -9
- package/dist/shaka-player.ui.debug.d.ts +165 -9
- package/dist/shaka-player.ui.debug.externs.js +181 -13
- package/dist/shaka-player.ui.debug.js +459 -429
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +181 -13
- package/dist/shaka-player.ui.js +973 -961
- package/dist/shaka-player.ui.map +4 -4
- package/docs/tutorials/fairplay.md +1 -1
- package/docs/tutorials/faq.md +25 -0
- package/docs/tutorials/index.json +2 -2
- package/docs/tutorials/upgrade-v3.md +38 -0
- package/docs/tutorials/upgrade.md +3 -3
- package/externs/ima.js +4 -0
- package/externs/media_capabilities.js +16 -0
- package/externs/shaka/ads.js +2 -0
- package/externs/shaka/net.js +2 -2
- package/externs/shaka/player.js +6 -0
- package/karma.conf.js +1 -0
- package/lib/abr/simple_abr_manager.js +1 -1
- package/lib/ads/ad_manager.js +29 -11
- package/lib/ads/client_side_ad_manager.js +76 -86
- package/lib/ads/server_side_ad_manager.js +26 -11
- package/lib/cast/cast_proxy.js +3 -2
- package/lib/cast/cast_receiver.js +2 -1
- package/lib/cast/cast_sender.js +2 -2
- package/lib/cea/sei_processor.js +24 -17
- package/lib/dash/dash_parser.js +107 -4
- package/lib/dash/segment_list.js +1 -1
- package/lib/dash/segment_template.js +45 -15
- package/lib/dependencies/all.js +15 -15
- package/lib/hls/hls_parser.js +46 -18
- package/lib/media/closed_caption_parser.js +3 -1
- package/lib/media/content_workarounds.js +18 -0
- package/lib/media/drm_engine.js +20 -1
- package/lib/media/gap_jumping_controller.js +8 -4
- package/lib/media/media_source_engine.js +1 -2
- package/lib/media/playhead.js +1 -1
- package/lib/media/presentation_timeline.js +3 -1
- package/lib/media/segment_index.js +38 -12
- package/lib/media/segment_reference.js +8 -0
- package/lib/media/streaming_engine.js +30 -21
- package/lib/net/http_fetch_plugin.js +2 -2
- package/lib/net/networking_engine.js +3 -2
- package/lib/offline/storage.js +4 -0
- package/lib/player.js +113 -56
- package/lib/polyfill/encryption_scheme.js +2 -0
- package/lib/polyfill/fullscreen.js +2 -0
- package/lib/polyfill/mathround.js +2 -0
- package/lib/polyfill/media_capabilities.js +62 -23
- package/lib/polyfill/mediasource.js +8 -0
- package/lib/polyfill/orientation.js +3 -1
- package/lib/polyfill/patchedmediakeys_apple.js +6 -4
- package/lib/polyfill/patchedmediakeys_ms.js +6 -4
- package/lib/polyfill/patchedmediakeys_nop.js +2 -0
- package/lib/polyfill/patchedmediakeys_webkit.js +6 -4
- package/lib/polyfill/pip_webkit.js +2 -0
- package/lib/polyfill/storage_estimate.js +2 -0
- package/lib/polyfill/video_play_promise.js +2 -0
- package/lib/polyfill/videoplaybackquality.js +2 -0
- package/lib/polyfill/vttcue.js +2 -0
- package/lib/text/cue.js +11 -0
- package/lib/text/mp4_ttml_parser.js +3 -0
- package/lib/text/text_engine.js +14 -2
- package/lib/text/ttml_text_parser.js +52 -30
- package/lib/text/ui_text_displayer.js +255 -82
- package/lib/text/vtt_text_parser.js +4 -2
- package/lib/util/error.js +1 -4
- package/lib/util/fake_event.js +53 -7
- package/lib/util/mime_utils.js +33 -0
- package/lib/util/mp4_box_parsers.js +1 -1
- package/lib/util/mp4_parser.js +14 -0
- package/lib/util/networking.js +1 -1
- package/lib/util/periods.js +132 -37
- package/lib/util/platform.js +13 -1
- package/lib/util/stream_utils.js +46 -7
- package/package.json +3 -3
- package/test/cast/cast_proxy_unit.js +12 -6
- package/test/cast/cast_receiver_integration.js +1 -1
- package/test/cast/cast_utils_unit.js +1 -1
- package/test/cea/mp4_cea_parser_unit.js +26 -0
- package/test/dash/dash_parser_live_unit.js +1 -0
- package/test/dash/dash_parser_manifest_unit.js +187 -1
- package/test/dash/dash_parser_segment_template_unit.js +3 -3
- package/test/demo/demo_unit.js +0 -1
- package/test/hls/hls_parser_unit.js +45 -1
- package/test/media/closed_caption_parser_unit.js +20 -0
- package/test/media/drm_engine_unit.js +59 -3
- package/test/media/playhead_unit.js +27 -1
- package/test/media/presentation_timeline_unit.js +19 -0
- package/test/media/segment_index_unit.js +76 -3
- package/test/media/streaming_engine_unit.js +3 -3
- package/test/player_integration.js +38 -0
- package/test/player_unit.js +125 -6
- package/test/test/assets/3675/chunk-stream0-00001.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00002.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00003.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00004.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00005.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00006.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00007.m4s +0 -0
- package/test/test/assets/3675/dash_0.mpd +30 -0
- package/test/test/assets/3675/dash_1.mpd +30 -0
- package/test/test/assets/3675/dash_2.mpd +30 -0
- package/test/test/assets/3675/dash_3.mpd +30 -0
- package/test/test/assets/3675/dash_4.mpd +30 -0
- package/test/test/assets/3675/dash_5.mpd +26 -0
- package/test/test/assets/3675/init-stream0.m4s +0 -0
- package/test/test/assets/empty_caption_video_init.mp4 +0 -0
- package/test/test/assets/empty_caption_video_segment.mp4 +0 -0
- package/test/test/util/fake_ad_manager.js +4 -1
- package/test/test/util/simple_fakes.js +5 -3
- package/test/test/util/waiter.js +36 -2
- package/test/text/ttml_text_parser_unit.js +55 -0
- package/test/text/ui_text_displayer_unit.js +95 -18
- package/test/text/vtt_text_parser_unit.js +17 -1
- package/test/ui/localization_unit.js +15 -14
- package/test/ui/text_displayer_layout_unit.js +52 -1
- package/test/ui/ui_unit.js +4 -0
- package/test/util/mp4_box_parsers_unit.js +28 -0
- package/test/util/periods_unit.js +190 -2
- package/test/util/stream_utils_unit.js +56 -5
- package/ui/airplay_button.js +5 -0
- package/ui/big_play_button.js +10 -0
- package/ui/cast_button.js +2 -3
- package/ui/controls.js +9 -7
- package/ui/less/containers.less +10 -5
- package/ui/locales/en.json +1 -0
- package/ui/locales/ru.json +6 -6
- package/ui/locales/source.json +4 -0
- package/ui/localization.js +28 -51
- package/ui/pip_button.js +2 -3
- package/ui/play_button.js +10 -10
- package/ui/small_play_button.js +12 -0
- package/ui/ui.js +1 -1
- package/docs/tutorials/upgrade-v2-4.md +0 -481
package/ui/locales/en.json
CHANGED
package/ui/locales/ru.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"AD_DURATION": "Продолжительность
|
|
3
|
-
"AD_PROGRESS": "
|
|
4
|
-
"AD_TIME": "
|
|
2
|
+
"AD_DURATION": "Продолжительность рекламы",
|
|
3
|
+
"AD_PROGRESS": "Реклама [AD_ON] из [NUM_ADS]",
|
|
4
|
+
"AD_TIME": "Реклама: [AD_TIME]",
|
|
5
5
|
"AUTO_QUALITY": "Авто",
|
|
6
6
|
"BACK": "Назад",
|
|
7
|
-
"CAPTIONS": "
|
|
7
|
+
"CAPTIONS": "Субтитры",
|
|
8
8
|
"CAST": "Транслировать...",
|
|
9
9
|
"ENTER_LOOP_MODE": "Зациклить текущее видео",
|
|
10
10
|
"ENTER_PICTURE_IN_PICTURE": "Перейти в режим \"Картинка в картинке\"",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"MULTIPLE_LANGUAGES": "Несколько языков",
|
|
21
21
|
"MUTE": "Отключить звук",
|
|
22
22
|
"NOT_APPLICABLE": "Неприменимо",
|
|
23
|
-
"OFF": "
|
|
24
|
-
"ON": "
|
|
23
|
+
"OFF": "Выкл.",
|
|
24
|
+
"ON": "Вкл.",
|
|
25
25
|
"PAUSE": "Пауза",
|
|
26
26
|
"PICTURE_IN_PICTURE": "Картинка в картинке",
|
|
27
27
|
"PLAY": "Воспроизвести",
|
package/ui/locales/source.json
CHANGED
|
@@ -113,6 +113,10 @@
|
|
|
113
113
|
"message": "Playback speed",
|
|
114
114
|
"description": "Label for a button used to navigate to a submenu to choose the playback speed in the video player."
|
|
115
115
|
},
|
|
116
|
+
"REPLAY": {
|
|
117
|
+
"description": "Label for a button used to replay the video in a video player.",
|
|
118
|
+
"message": "Replay"
|
|
119
|
+
},
|
|
116
120
|
"RESOLUTION": {
|
|
117
121
|
"description": "Label for a button used to open a submenu to choose a video resolution in the video player.",
|
|
118
122
|
"meaning": "Visual quality",
|
package/ui/localization.js
CHANGED
|
@@ -130,28 +130,20 @@ shaka.ui.Localization = class {
|
|
|
130
130
|
(locale) => !this.localizations_.has(locale));
|
|
131
131
|
|
|
132
132
|
if (missing.length) {
|
|
133
|
-
/** @type {shaka.ui.Localization.UnknownLocalesEvent} */
|
|
134
|
-
const eMissing = {
|
|
135
|
-
'locales': missing,
|
|
136
|
-
};
|
|
137
|
-
|
|
138
133
|
this.events_.dispatchEvent(new shaka.util.FakeEvent(
|
|
139
134
|
Class.UNKNOWN_LOCALES,
|
|
140
|
-
|
|
135
|
+
(new Map()).set('locales', missing)));
|
|
141
136
|
}
|
|
142
137
|
|
|
143
138
|
const found = shaka.util.Iterables.filter(
|
|
144
139
|
this.currentLocales_,
|
|
145
140
|
(locale) => this.localizations_.has(locale));
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
'locales': found.length ? found : [this.fallbackLocale_],
|
|
150
|
-
};
|
|
151
|
-
|
|
142
|
+
const data = (new Map()).set(
|
|
143
|
+
'locales', found.length ? found : [this.fallbackLocale_]);
|
|
152
144
|
this.events_.dispatchEvent(new shaka.util.FakeEvent(
|
|
153
145
|
Class.LOCALE_CHANGED,
|
|
154
|
-
|
|
146
|
+
data));
|
|
155
147
|
}
|
|
156
148
|
|
|
157
149
|
/**
|
|
@@ -253,14 +245,11 @@ shaka.ui.Localization = class {
|
|
|
253
245
|
// number of locales. Since we don't know which ones we actually checked,
|
|
254
246
|
// just tell them the preferred locale.
|
|
255
247
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
this.events_.dispatchEvent(new FakeEvent(Class.UNKNOWN_LOCALIZATION, e));
|
|
248
|
+
const data = new Map()
|
|
249
|
+
// Make a copy to avoid leaking references.
|
|
250
|
+
.set('locales', Array.from(this.currentLocales_))
|
|
251
|
+
.set('missing', id);
|
|
252
|
+
this.events_.dispatchEvent(new FakeEvent(Class.UNKNOWN_LOCALIZATION, data));
|
|
264
253
|
|
|
265
254
|
return '';
|
|
266
255
|
}
|
|
@@ -381,18 +370,16 @@ shaka.ui.Localization = class {
|
|
|
381
370
|
}
|
|
382
371
|
|
|
383
372
|
if (missing.size > 0) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
'missing': Array.from(missing),
|
|
391
|
-
};
|
|
373
|
+
const data = new Map()
|
|
374
|
+
// Make a copy of the preferred locales to avoid leaking references.
|
|
375
|
+
.set('locales', Array.from(preferredLocales))
|
|
376
|
+
// Because more people like arrays more than sets, convert the set to
|
|
377
|
+
// an array.
|
|
378
|
+
.set('missing', Array.from(missing));
|
|
392
379
|
|
|
393
380
|
this.events_.dispatchEvent(new shaka.util.FakeEvent(
|
|
394
381
|
shaka.ui.Localization.MISSING_LOCALIZATIONS,
|
|
395
|
-
|
|
382
|
+
data));
|
|
396
383
|
}
|
|
397
384
|
}
|
|
398
385
|
|
|
@@ -478,52 +465,42 @@ shaka.ui.Localization.LOCALE_CHANGED = 'locale-changed';
|
|
|
478
465
|
shaka.ui.Localization.LOCALE_UPDATED = 'locale-updated';
|
|
479
466
|
|
|
480
467
|
/**
|
|
481
|
-
* @
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
*
|
|
468
|
+
* @event shaka.ui.Localization.UnknownLocalesEvent
|
|
469
|
+
* @property {string} type
|
|
470
|
+
* 'unknown-locales'
|
|
485
471
|
* @property {!Array.<string>} locales
|
|
486
472
|
* The locales that the user wanted but could not be found.
|
|
487
473
|
* @exportDoc
|
|
488
474
|
*/
|
|
489
|
-
shaka.ui.Localization.UnknownLocalesEvent;
|
|
490
475
|
|
|
491
476
|
/**
|
|
492
|
-
* @
|
|
493
|
-
*
|
|
494
|
-
* '
|
|
495
|
-
* }}
|
|
496
|
-
*
|
|
477
|
+
* @event shaka.ui.Localization.MissingLocalizationsEvent
|
|
478
|
+
* @property {string} type
|
|
479
|
+
* 'unknown-localization'
|
|
497
480
|
* @property {!Array.<string>} locales
|
|
498
481
|
* The locales that the user wanted.
|
|
499
482
|
* @property {string} missing
|
|
500
483
|
* The id of the unknown entry.
|
|
501
484
|
* @exportDoc
|
|
502
485
|
*/
|
|
503
|
-
shaka.ui.Localization.UnknownLocalizationEvent;
|
|
504
486
|
|
|
505
487
|
/**
|
|
506
|
-
* @
|
|
507
|
-
*
|
|
508
|
-
* 'missing'
|
|
509
|
-
* }}
|
|
510
|
-
*
|
|
488
|
+
* @event shaka.ui.Localization.MissingLocalizationsEvent
|
|
489
|
+
* @property {string} type
|
|
490
|
+
* 'missing-localizations'
|
|
511
491
|
* @property {string} locale
|
|
512
492
|
* The locale that the user wanted.
|
|
513
493
|
* @property {!Array.<string>} missing
|
|
514
494
|
* The ids of the missing entries.
|
|
515
495
|
* @exportDoc
|
|
516
496
|
*/
|
|
517
|
-
shaka.ui.Localization.MissingLocalizationsEvent;
|
|
518
497
|
|
|
519
498
|
/**
|
|
520
|
-
* @
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
499
|
+
* @event shaka.ui.Localization.LocaleChangedEvent
|
|
500
|
+
* @property {string} type
|
|
501
|
+
* 'locale-changed'
|
|
524
502
|
* @property {!Array.<string>} locales
|
|
525
503
|
* The new set of locales that user wanted,
|
|
526
504
|
* and that were successfully found.
|
|
527
505
|
* @exportDoc
|
|
528
506
|
*/
|
|
529
|
-
shaka.ui.Localization.LocaleChangedEvent;
|
package/ui/pip_button.js
CHANGED
|
@@ -131,9 +131,8 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
|
|
|
131
131
|
await document.exitPictureInPicture();
|
|
132
132
|
}
|
|
133
133
|
} catch (error) {
|
|
134
|
-
this.controls.dispatchEvent(new shaka.util.FakeEvent(
|
|
135
|
-
|
|
136
|
-
}));
|
|
134
|
+
this.controls.dispatchEvent(new shaka.util.FakeEvent(
|
|
135
|
+
'error', (new Map()).set('detail', error)));
|
|
137
136
|
}
|
|
138
137
|
}
|
|
139
138
|
|
package/ui/play_button.js
CHANGED
|
@@ -8,9 +8,7 @@
|
|
|
8
8
|
goog.provide('shaka.ui.PlayButton');
|
|
9
9
|
|
|
10
10
|
goog.require('shaka.ads.AdManager');
|
|
11
|
-
goog.require('shaka.ui.Constants');
|
|
12
11
|
goog.require('shaka.ui.Element');
|
|
13
|
-
goog.require('shaka.ui.Locales');
|
|
14
12
|
goog.require('shaka.ui.Localization');
|
|
15
13
|
goog.require('shaka.util.Dom');
|
|
16
14
|
goog.requireType('shaka.ui.Controls');
|
|
@@ -54,6 +52,11 @@ shaka.ui.PlayButton = class extends shaka.ui.Element {
|
|
|
54
52
|
this.updateIcon();
|
|
55
53
|
});
|
|
56
54
|
|
|
55
|
+
this.eventManager.listen(this.video, 'seeking', () => {
|
|
56
|
+
this.updateAriaLabel();
|
|
57
|
+
this.updateIcon();
|
|
58
|
+
});
|
|
59
|
+
|
|
57
60
|
this.eventManager.listen(this.adManager, AdManager.AD_PAUSED, () => {
|
|
58
61
|
this.updateAriaLabel();
|
|
59
62
|
this.updateIcon();
|
|
@@ -96,14 +99,11 @@ shaka.ui.PlayButton = class extends shaka.ui.Element {
|
|
|
96
99
|
return this.controls.presentationIsPaused();
|
|
97
100
|
}
|
|
98
101
|
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.button.setAttribute(shaka.ui.Constants.ARIA_LABEL,
|
|
105
|
-
this.localization.resolve(label));
|
|
106
|
-
}
|
|
102
|
+
/**
|
|
103
|
+
* Called when the button's aria label needs to change.
|
|
104
|
+
* To be overridden by subclasses.
|
|
105
|
+
*/
|
|
106
|
+
updateAriaLabel() {}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* Called when the button's icon needs to change.
|
package/ui/small_play_button.js
CHANGED
|
@@ -9,6 +9,7 @@ goog.provide('shaka.ui.SmallPlayButton');
|
|
|
9
9
|
|
|
10
10
|
goog.require('shaka.ui.Controls');
|
|
11
11
|
goog.require('shaka.ui.Enums');
|
|
12
|
+
goog.require('shaka.ui.Locales');
|
|
12
13
|
goog.require('shaka.ui.PlayButton');
|
|
13
14
|
|
|
14
15
|
|
|
@@ -42,6 +43,17 @@ shaka.ui.SmallPlayButton = class extends shaka.ui.PlayButton {
|
|
|
42
43
|
this.button.textContent = this.isPaused() ? Icons.PLAY : Icons.PAUSE;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
46
|
+
|
|
47
|
+
/** @override */
|
|
48
|
+
updateAriaLabel() {
|
|
49
|
+
const LocIds = shaka.ui.Locales.Ids;
|
|
50
|
+
if (this.video.ended) {
|
|
51
|
+
this.button.ariaLabel = this.localization.resolve(LocIds.REPLAY);
|
|
52
|
+
} else {
|
|
53
|
+
const label = this.isPaused() ? LocIds.PLAY : LocIds.PAUSE;
|
|
54
|
+
this.button.ariaLabel = this.localization.resolve(label);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
45
57
|
};
|
|
46
58
|
|
|
47
59
|
|
package/ui/ui.js
CHANGED