shaka-player 4.7.7 → 4.7.9
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/README.md +14 -12
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/deps.js +1 -1
- package/dist/locales.js +31 -31
- package/dist/shaka-player.compiled.debug.js +87 -87
- package/dist/shaka-player.compiled.debug.map +2 -2
- package/dist/shaka-player.compiled.js +1084 -1079
- package/dist/shaka-player.compiled.map +3 -3
- package/dist/shaka-player.ui.d.ts +1 -1
- package/dist/shaka-player.ui.debug.d.ts +1 -1
- package/dist/shaka-player.ui.debug.js +313 -320
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.js +1178 -1180
- package/dist/shaka-player.ui.map +4 -4
- package/lib/dash/dash_parser.js +1 -1
- package/lib/hls/hls_parser.js +14 -6
- package/lib/media/content_workarounds.js +24 -0
- package/lib/mss/mss_parser.js +2 -0
- package/lib/player.js +12 -2
- package/lib/polyfill/media_capabilities.js +14 -1
- package/lib/transmuxer/aac_transmuxer.js +2 -0
- package/lib/transmuxer/ac3_transmuxer.js +2 -0
- package/lib/transmuxer/ec3_transmuxer.js +2 -0
- package/lib/transmuxer/h264.js +28 -1
- package/lib/transmuxer/h265.js +25 -5
- package/lib/transmuxer/mp3_transmuxer.js +2 -0
- package/lib/transmuxer/ts_transmuxer.js +12 -0
- package/lib/util/cmcd_manager.js +13 -10
- package/lib/util/manifest_parser_utils.js +2 -0
- package/lib/util/mp4_generator.js +31 -2
- package/lib/util/stream_utils.js +2 -10
- package/package.json +1 -1
- package/ui/externs/ui.js +1 -10
- package/ui/less/range_elements.less +0 -33
- package/ui/seek_bar.js +0 -212
- package/ui/ui.js +0 -2
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)',
|