shaka-player 4.3.13 → 4.3.15

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.
Files changed (137) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  2. package/.github/ISSUE_TEMPLATE/question.md +7 -0
  3. package/.github/workflows/release-please.yaml +2 -27
  4. package/.github/workflows/shaka-bot-commands/lib.sh +37 -12
  5. package/.github/workflows/shaka-bot-commands/main.sh +4 -2
  6. package/.github/workflows/talk-to-shaka-bot.yaml +1 -0
  7. package/AUTHORS +5 -0
  8. package/CHANGELOG.md +96 -0
  9. package/CODE_OF_CONDUCT.md +1 -1
  10. package/CONTRIBUTORS +6 -0
  11. package/README.md +2 -0
  12. package/demo/common/asset.js +0 -1
  13. package/demo/common/assets.js +0 -1
  14. package/demo/custom.js +2 -0
  15. package/dist/controls.css +1 -1
  16. package/dist/controls.css.map +1 -1
  17. package/dist/demo.compiled.debug.js +1 -1
  18. package/dist/demo.compiled.debug.map +1 -1
  19. package/dist/demo.compiled.js +1 -1
  20. package/dist/demo.compiled.map +1 -1
  21. package/dist/deps.js +6 -6
  22. package/dist/locales.js +30 -30
  23. package/dist/receiver.compiled.debug.map +1 -1
  24. package/dist/receiver.compiled.map +1 -1
  25. package/dist/shaka-player.compiled.d.ts +25 -5
  26. package/dist/shaka-player.compiled.debug.d.ts +25 -5
  27. package/dist/shaka-player.compiled.debug.externs.js +73 -45
  28. package/dist/shaka-player.compiled.debug.js +426 -406
  29. package/dist/shaka-player.compiled.debug.map +4 -4
  30. package/dist/shaka-player.compiled.externs.js +73 -45
  31. package/dist/shaka-player.compiled.js +912 -903
  32. package/dist/shaka-player.compiled.map +4 -4
  33. package/dist/shaka-player.ui.d.ts +37 -6
  34. package/dist/shaka-player.ui.debug.d.ts +37 -6
  35. package/dist/shaka-player.ui.debug.externs.js +74 -45
  36. package/dist/shaka-player.ui.debug.js +449 -428
  37. package/dist/shaka-player.ui.debug.map +4 -4
  38. package/dist/shaka-player.ui.externs.js +74 -45
  39. package/dist/shaka-player.ui.js +1060 -1051
  40. package/dist/shaka-player.ui.map +4 -4
  41. package/docs/tutorials/ad_monetization.md +54 -0
  42. package/docs/tutorials/fairplay.md +2 -2
  43. package/docs/tutorials/index.json +1 -0
  44. package/docs/tutorials/plugins.md +4 -0
  45. package/docs/tutorials/text-displayer.md +15 -0
  46. package/docs/tutorials/ui-customization.md +29 -0
  47. package/docs/tutorials/ui.md +4 -1
  48. package/externs/lcevc.js +6 -0
  49. package/externs/shaka/manifest_parser.js +8 -0
  50. package/externs/shaka/player.js +1 -1
  51. package/externs/shaka/text.js +3 -1
  52. package/lib/abr/simple_abr_manager.js +1 -1
  53. package/lib/ads/client_side_ad.js +9 -0
  54. package/lib/ads/client_side_ad_manager.js +7 -2
  55. package/lib/ads/server_side_ad_manager.js +4 -0
  56. package/lib/cast/cast_proxy.js +18 -0
  57. package/lib/cea/cea608_memory.js +1 -1
  58. package/lib/cea/cea_decoder.js +11 -1
  59. package/lib/dash/dash_parser.js +75 -41
  60. package/lib/dash/mpd_utils.js +39 -27
  61. package/lib/deprecate/deprecate.js +1 -1
  62. package/lib/hls/hls_parser.js +106 -28
  63. package/lib/hls/hls_utils.js +5 -5
  64. package/lib/media/content_workarounds.js +30 -0
  65. package/lib/media/drm_engine.js +16 -12
  66. package/lib/media/manifest_parser.js +2 -1
  67. package/lib/media/media_source_engine.js +4 -2
  68. package/lib/media/play_rate_controller.js +1 -0
  69. package/lib/media/presentation_timeline.js +11 -0
  70. package/lib/media/quality_observer.js +1 -1
  71. package/lib/media/segment_reference.js +5 -2
  72. package/lib/media/streaming_engine.js +50 -30
  73. package/lib/media/transmuxer.js +1 -1
  74. package/lib/media/video_wrapper.js +4 -3
  75. package/lib/offline/offline_manifest_parser.js +5 -0
  76. package/lib/offline/session_deleter.js +0 -8
  77. package/lib/offline/storage.js +4 -1
  78. package/lib/player.js +80 -19
  79. package/lib/polyfill/media_capabilities.js +23 -3
  80. package/lib/polyfill/mediasource.js +5 -36
  81. package/lib/text/mp4_ttml_parser.js +2 -2
  82. package/lib/text/simple_text_displayer.js +7 -6
  83. package/lib/text/srt_text_parser.js +2 -2
  84. package/lib/text/text_engine.js +3 -2
  85. package/lib/text/ttml_text_parser.js +33 -5
  86. package/lib/text/ui_text_displayer.js +81 -15
  87. package/lib/text/vtt_text_parser.js +17 -3
  88. package/lib/util/buffer_utils.js +26 -4
  89. package/lib/util/cmcd_manager.js +10 -0
  90. package/lib/util/error.js +1 -0
  91. package/lib/util/fairplay_utils.js +1 -1
  92. package/lib/util/manifest_parser_utils.js +14 -8
  93. package/lib/util/object_utils.js +1 -1
  94. package/lib/util/periods.js +91 -36
  95. package/lib/util/platform.js +39 -2
  96. package/lib/util/player_configuration.js +5 -3
  97. package/lib/util/stream_utils.js +36 -28
  98. package/lib/util/xml_utils.js +5 -0
  99. package/package.json +3 -3
  100. package/test/cea/cea_decoder_unit.js +40 -0
  101. package/test/dash/dash_parser_live_unit.js +5 -8
  102. package/test/hls/hls_parser_unit.js +78 -3
  103. package/test/media/buffering_observer_unit.js +13 -0
  104. package/test/media/content_workarounds_unit.js +1 -1
  105. package/test/media/drm_engine_unit.js +30 -3
  106. package/test/media/media_source_engine_unit.js +1 -1
  107. package/test/media/transmuxer_integration.js +2 -2
  108. package/test/offline/storage_integration.js +3 -0
  109. package/test/player_integration.js +49 -41
  110. package/test/player_load_graph_integration.js +13 -7
  111. package/test/player_src_equals_integration.js +2 -2
  112. package/test/player_unit.js +40 -3
  113. package/test/polyfill/media_capabilities_unit.js +12 -6
  114. package/test/test/util/fake_drm_engine.js +7 -0
  115. package/test/test/util/layout_tests.js +2 -1
  116. package/test/test/util/simple_fakes.js +2 -2
  117. package/test/test/util/test_scheme.js +3 -0
  118. package/test/test/util/waiter.js +5 -0
  119. package/test/text/mp4_ttml_parser_unit.js +4 -4
  120. package/test/text/simple_text_displayer_unit.js +1 -1
  121. package/test/text/srt_text_parser_unit.js +1 -1
  122. package/test/text/text_engine_unit.js +6 -0
  123. package/test/text/ttml_text_parser_unit.js +49 -18
  124. package/test/text/ui_text_displayer_unit.js +9 -0
  125. package/test/text/vtt_text_parser_unit.js +31 -0
  126. package/test/util/buffer_utils_unit.js +1 -1
  127. package/test/util/periods_unit.js +113 -0
  128. package/third_party/closure-uri/uri.js +1 -1
  129. package/ui/externs/ui.js +24 -0
  130. package/ui/language_utils.js +11 -5
  131. package/ui/less/containers.less +1 -0
  132. package/ui/play_button.js +20 -0
  133. package/ui/playback_rate_selection.js +4 -0
  134. package/ui/presentation_time.js +5 -5
  135. package/ui/small_play_button.js +2 -2
  136. package/ui/volume_bar.js +10 -6
  137. /package/.github/{config.yml → ISSUE_TEMPLATE/config.yml} +0 -0
@@ -55,7 +55,11 @@ shaka.ui.LanguageUtils = class {
55
55
  }
56
56
  };
57
57
 
58
- const getCombination = (language, rolesString) => {
58
+ const getCombination = (language, rolesString, label) => {
59
+ if (label &&
60
+ trackLabelFormat == shaka.ui.Overlay.TrackLabelFormat.LABEL) {
61
+ return language + ': ' + label + ': ' + rolesString;
62
+ }
59
63
  return language + ': ' + rolesString;
60
64
  };
61
65
 
@@ -72,7 +76,8 @@ shaka.ui.LanguageUtils = class {
72
76
  /** @type {!Set.<string>} */
73
77
  const combinationsMade = new Set();
74
78
  const selectedCombination = selectedTrack ? getCombination(
75
- selectedTrack.language, getRolesString(selectedTrack)) : '';
79
+ selectedTrack.language, getRolesString(selectedTrack),
80
+ selectedTrack.label) : '';
76
81
 
77
82
  for (const track of tracks) {
78
83
  const language = track.language;
@@ -80,7 +85,8 @@ shaka.ui.LanguageUtils = class {
80
85
  const LocIds = shaka.ui.Locales.Ids;
81
86
  const forcedString = localization.resolve(LocIds.SUBTITLE_FORCED);
82
87
  const rolesString = getRolesString(track);
83
- const combinationName = getCombination(language, rolesString);
88
+ const label = track.label;
89
+ const combinationName = getCombination(language, rolesString, label);
84
90
  if (combinationsMade.has(combinationName)) {
85
91
  continue;
86
92
  }
@@ -124,8 +130,8 @@ shaka.ui.LanguageUtils = class {
124
130
  }
125
131
  break;
126
132
  case shaka.ui.Overlay.TrackLabelFormat.LABEL:
127
- if (track.label) {
128
- span.textContent = track.label;
133
+ if (label) {
134
+ span.textContent = label;
129
135
  } else {
130
136
  // Fallback behavior. This probably shouldn't happen.
131
137
  shaka.log.alwaysWarn('Track #' + track.id + ' does not have a ' +
@@ -24,6 +24,7 @@
24
24
  /* Set the fonts for all other content. */
25
25
  * {
26
26
  font-family: Roboto-Regular, Roboto, sans-serif, TengwarTelcontar;
27
+ -webkit-font-smoothing: antialiased;
27
28
  }
28
29
  }
29
30
 
package/ui/play_button.js CHANGED
@@ -16,6 +16,7 @@ goog.requireType('shaka.ui.Controls');
16
16
 
17
17
  /**
18
18
  * @extends {shaka.ui.Element}
19
+ * @implements {shaka.extern.IUIPlayButton}
19
20
  * @export
20
21
  */
21
22
  shaka.ui.PlayButton = class extends shaka.ui.Element {
@@ -72,6 +73,11 @@ shaka.ui.PlayButton = class extends shaka.ui.Element {
72
73
  this.updateIcon();
73
74
  });
74
75
 
76
+ this.eventManager.listen(this.adManager, AdManager.AD_STOPPED, () => {
77
+ this.updateAriaLabel();
78
+ this.updateIcon();
79
+ });
80
+
75
81
  this.eventManager.listen(this.button, 'click', () => {
76
82
  if (this.ad && this.ad.isLinear()) {
77
83
  this.controls.playPauseAd();
@@ -90,6 +96,7 @@ shaka.ui.PlayButton = class extends shaka.ui.Element {
90
96
  /**
91
97
  * @return {boolean}
92
98
  * @protected
99
+ * @override
93
100
  */
94
101
  isPaused() {
95
102
  if (this.ad && this.ad.isLinear()) {
@@ -99,6 +106,19 @@ shaka.ui.PlayButton = class extends shaka.ui.Element {
99
106
  return this.controls.presentationIsPaused();
100
107
  }
101
108
 
109
+ /**
110
+ * @return {boolean}
111
+ * @protected
112
+ * @override
113
+ */
114
+ isEnded() {
115
+ if (this.ad && this.ad.isLinear()) {
116
+ return false;
117
+ }
118
+
119
+ return this.video.ended;
120
+ }
121
+
102
122
  /**
103
123
  * Called when the button's aria label needs to change.
104
124
  * To be overridden by subclasses.
@@ -44,6 +44,10 @@ shaka.ui.PlaybackRateSelection = class extends shaka.ui.SettingsMenu {
44
44
  this.updateLocalizedStrings_();
45
45
  });
46
46
 
47
+ this.eventManager.listen(this.player, 'loaded', () => {
48
+ this.updatePlaybackRateSelection_(this.player.getPlaybackRate());
49
+ });
50
+
47
51
  this.eventManager.listen(this.player, 'ratechange', () => {
48
52
  this.updatePlaybackRateSelection_(this.player.getPlaybackRate());
49
53
  });
@@ -64,7 +64,6 @@ shaka.ui.PresentationTimeTracker = class extends shaka.ui.Element {
64
64
  updateTime_() {
65
65
  const isSeeking = this.controls.isSeeking();
66
66
  let displayTime = this.controls.getDisplayTime();
67
- const duration = this.video.duration;
68
67
  const seekRange = this.player.seekRange();
69
68
  const seekRangeSize = seekRange.end - seekRange.start;
70
69
  const Utils = shaka.ui.Utils;
@@ -89,11 +88,12 @@ shaka.ui.PresentationTimeTracker = class extends shaka.ui.Element {
89
88
  this.currentTime_.disabled = true;
90
89
  }
91
90
  } else {
92
- const showHour = duration >= 3600;
91
+ const showHour = seekRangeSize >= 3600;
93
92
 
94
- let value = Utils.buildTimeString(displayTime, showHour);
95
- if (duration) {
96
- value += ' / ' + Utils.buildTimeString(duration, showHour);
93
+ const currentTime = Math.max(0, displayTime - seekRange.start);
94
+ let value = Utils.buildTimeString(currentTime, showHour);
95
+ if (seekRangeSize) {
96
+ value += ' / ' + Utils.buildTimeString(seekRangeSize, showHour);
97
97
  }
98
98
  this.setValue_(value);
99
99
  this.currentTime_.disabled = true;
@@ -38,7 +38,7 @@ shaka.ui.SmallPlayButton = class extends shaka.ui.PlayButton {
38
38
  /** @override */
39
39
  updateIcon() {
40
40
  const Icons = shaka.ui.Enums.MaterialDesignIcons;
41
- if (this.video.ended) {
41
+ if (this.isEnded()) {
42
42
  this.button.textContent = Icons.REPLAY;
43
43
  } else {
44
44
  this.button.textContent = this.isPaused() ? Icons.PLAY : Icons.PAUSE;
@@ -48,7 +48,7 @@ shaka.ui.SmallPlayButton = class extends shaka.ui.PlayButton {
48
48
  /** @override */
49
49
  updateAriaLabel() {
50
50
  const LocIds = shaka.ui.Locales.Ids;
51
- if (this.video.ended) {
51
+ if (this.isEnded()) {
52
52
  this.button.ariaLabel = this.localization.resolve(LocIds.REPLAY);
53
53
  } else {
54
54
  const label = this.isPaused() ? LocIds.PLAY : LocIds.PAUSE;
package/ui/volume_bar.js CHANGED
@@ -32,6 +32,10 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
32
32
  /** @private {!shaka.extern.UIConfiguration} */
33
33
  this.config_ = this.controls.getConfig();
34
34
 
35
+ // We use a range of 100 to avoid problems with Firefox.
36
+ // See https://github.com/shaka-project/shaka-player/issues/3987
37
+ this.setRange(0, 100);
38
+
35
39
  this.eventManager.listen(this.video,
36
40
  'volumechange',
37
41
  () => this.onPresentationVolumeChange_());
@@ -74,9 +78,9 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
74
78
  */
75
79
  onChange() {
76
80
  if (this.ad && this.ad.isLinear()) {
77
- this.ad.setVolume(this.getValue());
81
+ this.ad.setVolume(this.getValue() / 100);
78
82
  } else {
79
- this.video.volume = this.getValue();
83
+ this.video.volume = this.getValue() / 100;
80
84
  if (this.video.volume == 0) {
81
85
  this.video.muted = true;
82
86
  } else {
@@ -90,7 +94,7 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
90
94
  if (this.video.muted) {
91
95
  this.setValue(0);
92
96
  } else {
93
- this.setValue(this.video.volume);
97
+ this.setValue(this.video.volume * 100);
94
98
  }
95
99
 
96
100
  this.updateColors_();
@@ -102,7 +106,7 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
102
106
  'This.ad should exist at this point!');
103
107
 
104
108
  const volume = this.ad.getVolume();
105
- this.setValue(volume);
109
+ this.setValue(volume * 100);
106
110
  this.updateColors_();
107
111
  }
108
112
 
@@ -110,8 +114,8 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
110
114
  updateColors_() {
111
115
  const colors = this.config_.volumeBarColors;
112
116
  const gradient = ['to right'];
113
- gradient.push(colors.level + (this.getValue() * 100) + '%');
114
- gradient.push(colors.base + (this.getValue() * 100) + '%');
117
+ gradient.push(colors.level + this.getValue() + '%');
118
+ gradient.push(colors.base + this.getValue() + '%');
115
119
  gradient.push(colors.base + '100%');
116
120
 
117
121
  this.container.style.background =