shaka-player 4.6.11 → 4.6.13

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 (52) hide show
  1. package/AUTHORS +1 -0
  2. package/CHANGELOG.md +29 -0
  3. package/CONTRIBUTORS +1 -0
  4. package/README.md +14 -12
  5. package/demo/common/assets.js +3 -1
  6. package/dist/controls.css +1 -1
  7. package/dist/controls.css.map +1 -1
  8. package/dist/demo.compiled.debug.js +5 -5
  9. package/dist/demo.compiled.debug.map +1 -1
  10. package/dist/demo.compiled.js +5 -5
  11. package/dist/demo.compiled.map +1 -1
  12. package/dist/deps.js +1 -1
  13. package/dist/locales.js +33 -33
  14. package/dist/receiver.compiled.debug.js +5 -5
  15. package/dist/receiver.compiled.debug.map +1 -1
  16. package/dist/receiver.compiled.js +5 -5
  17. package/dist/receiver.compiled.map +1 -1
  18. package/dist/shaka-player.compiled.debug.js +265 -265
  19. package/dist/shaka-player.compiled.debug.map +2 -2
  20. package/dist/shaka-player.compiled.js +1127 -1122
  21. package/dist/shaka-player.compiled.map +3 -3
  22. package/dist/shaka-player.ui.d.ts +1 -1
  23. package/dist/shaka-player.ui.debug.d.ts +1 -1
  24. package/dist/shaka-player.ui.debug.js +207 -217
  25. package/dist/shaka-player.ui.debug.map +4 -4
  26. package/dist/shaka-player.ui.js +1191 -1193
  27. package/dist/shaka-player.ui.map +4 -4
  28. package/docs/tutorials/ui-customization.md +0 -13
  29. package/lib/dash/dash_parser.js +1 -1
  30. package/lib/media/content_workarounds.js +24 -0
  31. package/lib/mss/mss_parser.js +2 -0
  32. package/lib/player.js +12 -2
  33. package/lib/polyfill/media_capabilities.js +14 -1
  34. package/lib/transmuxer/aac_transmuxer.js +2 -0
  35. package/lib/transmuxer/ac3_transmuxer.js +2 -0
  36. package/lib/transmuxer/ec3_transmuxer.js +2 -0
  37. package/lib/transmuxer/h264.js +28 -1
  38. package/lib/transmuxer/h265.js +25 -5
  39. package/lib/transmuxer/mp3_transmuxer.js +2 -0
  40. package/lib/transmuxer/ts_transmuxer.js +12 -0
  41. package/lib/util/cmcd_manager.js +13 -0
  42. package/lib/util/manifest_parser_utils.js +2 -0
  43. package/lib/util/mp4_generator.js +31 -2
  44. package/lib/util/stream_utils.js +2 -10
  45. package/package.json +1 -1
  46. package/test/dash/dash_parser_live_unit.js +19 -0
  47. package/test/player_integration.js +46 -40
  48. package/test/util/stream_utils_unit.js +2 -8
  49. package/ui/externs/ui.js +1 -10
  50. package/ui/less/range_elements.less +0 -33
  51. package/ui/seek_bar.js +0 -212
  52. package/ui/ui.js +0 -2
package/ui/externs/ui.js CHANGED
@@ -21,9 +21,7 @@ shaka.extern = {};
21
21
  * base: string,
22
22
  * buffered: string,
23
23
  * played: string,
24
- * adBreaks: string,
25
- * chapterMarks: string,
26
- * chapterLabels: string
24
+ * adBreaks: string
27
25
  * }}
28
26
  *
29
27
  * @property {string} base
@@ -38,13 +36,6 @@ shaka.extern = {};
38
36
  * @property {string} adBreaks
39
37
  * The CSS background color applied to the portion of the seek bar showing
40
38
  * when the ad breaks are scheduled to occur on the timeline.
41
- * @property {string} chapterMarks
42
- * The CSS border color applied to sections of the seek bar showing
43
- * when the chapters start and end on the timeline.
44
- * Defaults to dark grey rgb(27, 27, 27).
45
- * @property {string} chapterLabels
46
- * The CSS text color applied to the chapter labels that appear above the
47
- * seek bar on hover. Defaults to white rgb(255, 255, 255).
48
39
  * @exportDoc
49
40
  */
50
41
  shaka.extern.UISeekBarColors;
@@ -154,36 +154,3 @@
154
154
  .shaka-ad-markers {
155
155
  .overlay-child();
156
156
  }
157
-
158
- #shaka-player-ui-chapters-container {
159
- width: 100%;
160
- height: 100%;
161
- display: flex;
162
- flex-direction: row;
163
- z-index: 0;
164
- }
165
-
166
- .shaka-chapter {
167
- height: 100%;
168
- position: relative;
169
- }
170
-
171
- .shaka-chapter-label {
172
- position: relative;
173
- top: -2.5em;
174
- width: 100%;
175
- text-align: center;
176
- text-shadow: 1px 1px gray;
177
- line-height: normal;
178
- }
179
-
180
- .shaka-chapter > div:first-child {
181
- width: 100%;
182
- height: 100%;
183
- border-right: 1px solid;
184
- position: absolute;
185
- }
186
-
187
- .shaka-chapter:last-child > div:first-child {
188
- border-right: none;
189
- }
package/ui/seek_bar.js CHANGED
@@ -16,7 +16,6 @@ goog.require('shaka.ui.RangeElement');
16
16
  goog.require('shaka.ui.Utils');
17
17
  goog.require('shaka.util.Dom');
18
18
  goog.require('shaka.util.Error');
19
- goog.require('shaka.util.EventManager');
20
19
  goog.require('shaka.util.Mp4Parser');
21
20
  goog.require('shaka.util.Networking');
22
21
  goog.require('shaka.util.Timer');
@@ -84,18 +83,6 @@ shaka.ui.SeekBar = class extends shaka.ui.RangeElement {
84
83
  this.markAdBreaks_();
85
84
  });
86
85
 
87
- /**
88
- * @private {shaka.util.EventManager}
89
- */
90
- this.chaptersEventManager_ = new shaka.util.EventManager();
91
-
92
-
93
- /** @private {!HTMLElement} */
94
- this.chaptersContainer_ = shaka.util.Dom.createHTMLElement('div');
95
- this.chaptersContainer_.id = 'shaka-player-ui-chapters-container';
96
- this.container.appendChild(this.chaptersContainer_);
97
-
98
- this.setupChapters_();
99
86
 
100
87
  /**
101
88
  * When user is scrubbing the seek bar - we should pause the video - see
@@ -238,8 +225,6 @@ shaka.ui.SeekBar = class extends shaka.ui.RangeElement {
238
225
  this.adBreaksTimer_ = null;
239
226
  }
240
227
 
241
- this.chaptersEventManager_.release();
242
-
243
228
  super.release();
244
229
  }
245
230
 
@@ -693,203 +678,6 @@ shaka.ui.SeekBar = class extends shaka.ui.RangeElement {
693
678
  return minutes + ':' + seconds;
694
679
  }
695
680
  }
696
-
697
- /**
698
- * Sets up the chapter element creator and change handling.
699
- * @private
700
- */
701
- setupChapters_() {
702
- let language = 'und';
703
- /** @type {!Array<shaka.extern.Chapter>} */
704
- let chapters = [];
705
-
706
- /**
707
- * Does a value compare on chapters.
708
- * @param {shaka.extern.Chapter} a
709
- * @param {shaka.extern.Chapter} b
710
- * @return {boolean}
711
- */
712
- const chaptersEqual = (a, b) => {
713
- return (!a && !b) || (a.id === b.id && a.title === b.title &&
714
- a.startTime === b.startTime && a.endTime === b.endTime);
715
- };
716
-
717
- /** @type {function(): void} */
718
- const handleChapterTrackChange = () => {
719
- let nextLanguage = 'und';
720
- /** @type {!Array<shaka.extern.Chapter>} */
721
- let nextChapters = [];
722
-
723
- const currentLocales = this.localization.getCurrentLocales();
724
- for (const locale of Array.from(currentLocales)) {
725
- nextLanguage = locale;
726
- nextChapters = this.player.getChapters(nextLanguage);
727
- if (nextChapters.length) {
728
- break;
729
- }
730
- }
731
- if (!nextChapters.length) {
732
- nextLanguage = 'und';
733
- nextChapters = this.player.getChapters(nextLanguage);
734
- }
735
-
736
- const languageChanged = nextLanguage !== language;
737
- const chaptersChanged = chapters.length !== nextChapters.length ||
738
- !chapters.some((c, idx) => {
739
- const n = nextChapters.at(idx);
740
- return chaptersEqual(c, n) ||
741
- nextChapters.some((n) => chaptersEqual(c, n));
742
- });
743
-
744
- language = nextLanguage;
745
- chapters = nextChapters;
746
- if (!nextChapters.length) {
747
- this.deletePreviousChapters_();
748
- } else if (languageChanged || chaptersChanged) {
749
- this.createChapterElements_(this.container, chapters);
750
- }
751
- };
752
-
753
- handleChapterTrackChange();
754
-
755
- this.eventManager.listen(
756
- this.player, 'unloading', () => {
757
- this.deletePreviousChapters_();
758
- language = 'und';
759
- chapters = [];
760
- });
761
-
762
- this.eventManager.listen(
763
- this.player, 'trackschanged', handleChapterTrackChange);
764
-
765
- this.eventManager.listen(
766
- this.localization, shaka.ui.Localization.LOCALE_UPDATED, () => {
767
- handleChapterTrackChange();
768
- });
769
-
770
- this.eventManager.listen(
771
- this.localization, shaka.ui.Localization.LOCALE_CHANGED, () => {
772
- handleChapterTrackChange();
773
- });
774
- }
775
-
776
- /**
777
- * Builds and inserts ChaptersElement into dom container.
778
- * @param {!HTMLElement} container
779
- * @param {!Array<shaka.extern.Chapter>} chapterTracks
780
- * @private
781
- */
782
- createChapterElements_(container, chapterTracks) {
783
- this.deletePreviousChapters_();
784
-
785
- const hiddenClass = 'shaka-hidden';
786
-
787
- /** @type {{start: number, end: number}} */
788
- const seekRange = this.player.seekRange();
789
-
790
- /**
791
- * @type {!Array<{
792
- * start: number,
793
- * end: number,
794
- * size: number,
795
- * title: string,
796
- * id: string
797
- * }>}
798
- * */
799
- const chapters = [];
800
-
801
- for (const c of chapterTracks) {
802
- if (c.startTime >= seekRange.end) {
803
- continue;
804
- }
805
- const start = c.startTime > seekRange.start ?
806
- c.startTime : seekRange.start;
807
- const end = c.endTime < seekRange.end ?
808
- c.endTime : seekRange.end;
809
- const size = (end-start);
810
- chapters.push({start, end, size, title: c.title, id: c.id});
811
- }
812
-
813
- if (chapters.length < 2) {
814
- return;
815
- }
816
-
817
- const totalSize = chapters.reduce((t, c) => {
818
- t += c.size;
819
- return t;
820
- }, 0);
821
-
822
- /**
823
- * @type {!Array<{
824
- * start: number,
825
- * end: number,
826
- * el: HTMLElement
827
- * }>}
828
- * */
829
- const chapterElMap = [];
830
-
831
- for (const c of chapters) {
832
- /** @type {!HTMLElement} */
833
- const chapterEl = shaka.util.Dom.createHTMLElement('div');
834
- chapterEl.classList.add('shaka-chapter');
835
- chapterEl.style.width = `${c.size * 100 / totalSize}%`;
836
-
837
- this.chaptersContainer_.appendChild(chapterEl);
838
-
839
- /** @type {!HTMLElement} */
840
- const chapterMarker = shaka.util.Dom.createHTMLElement('div');
841
- chapterMarker.style.borderColor =
842
- this.config_.seekBarColors.chapterMarks;
843
- chapterEl.appendChild(chapterMarker);
844
-
845
- /** @type {!HTMLElement} */
846
- const chapterLabel = shaka.util.Dom.createHTMLElement('p');
847
- chapterLabel.classList.add('shaka-chapter-label', hiddenClass);
848
- chapterLabel.style.color =
849
- this.config_.seekBarColors.chapterLabels;
850
- chapterLabel.innerText = c.title;
851
- chapterEl.appendChild(chapterLabel);
852
-
853
- chapterElMap.push(
854
- {start: c.start, end: c.end, el: chapterLabel});
855
- }
856
-
857
- // Add chapter event listeners
858
- this.chaptersEventManager_.listen(this.bar, 'pointermove', (e) => {
859
- if (!e.target) {
860
- return;
861
- }
862
- const target = /** @type {HTMLElement} */(e.target);
863
-
864
- const screenXDiff = e.offsetX / target.clientWidth;
865
- const rangeMax = parseInt(target.getAttribute('max'), 10);
866
- const hoverVal = screenXDiff * rangeMax;
867
-
868
- for (const c of chapterElMap) {
869
- const hidden = c.el.classList.contains(hiddenClass);
870
- const inChapter = c.start <= hoverVal && hoverVal < c.end;
871
- if (inChapter === hidden) {
872
- c.el.classList.toggle(hiddenClass);
873
- }
874
- }
875
- }, {passive: true});
876
-
877
- this.chaptersEventManager_.listen(this.bar, 'pointerout', () => {
878
- for (const c of chapterElMap) {
879
- if (!c.el.classList.contains(hiddenClass)) {
880
- c.el.classList.add(hiddenClass);
881
- }
882
- }
883
- }, {passive: true});
884
- }
885
-
886
- /**
887
- * @private
888
- */
889
- deletePreviousChapters_() {
890
- this.chaptersEventManager_.removeAll();
891
- shaka.util.Dom.removeAllChildren(this.chaptersContainer_);
892
- }
893
681
  };
894
682
 
895
683
 
package/ui/ui.js CHANGED
@@ -229,8 +229,6 @@ shaka.ui.Overlay = class {
229
229
  buffered: 'rgba(255, 255, 255, 0.54)',
230
230
  played: 'rgb(255, 255, 255)',
231
231
  adBreaks: 'rgb(255, 204, 0)',
232
- chapterMarks: 'rgb(27, 27, 27)',
233
- chapterLabels: 'rgb(255, 255, 255)',
234
232
  },
235
233
  volumeBarColors: {
236
234
  base: 'rgba(255, 255, 255, 0.54)',