@desynova-digital/player 4.1.11 → 4.1.12
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/components/Video.js
CHANGED
|
@@ -598,7 +598,6 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
598
598
|
attachAndLoad(originalSrc);
|
|
599
599
|
}
|
|
600
600
|
this.hls.on(_hls["default"].Events.MANIFEST_PARSED, function (event, data) {
|
|
601
|
-
// Add isDubbedTrack flag to audio tracks
|
|
602
601
|
var audioTracksWithFlag = (data.audioTracks || []).map(function (track) {
|
|
603
602
|
if (self.dubbedTrackNames && self.dubbedTrackNames.includes(track.name)) {
|
|
604
603
|
return _objectSpread(_objectSpread({}, track), {}, {
|
|
@@ -608,10 +607,27 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
608
607
|
return track;
|
|
609
608
|
});
|
|
610
609
|
actions.handleAudioTracks(audioTracksWithFlag);
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
610
|
+
var defaultIndex;
|
|
611
|
+
var firstDubbedIndex = audioTracksWithFlag.findIndex(function (t) {
|
|
612
|
+
return t.isDubbedTrack;
|
|
613
|
+
});
|
|
614
|
+
if (firstDubbedIndex !== -1) {
|
|
615
|
+
defaultIndex = firstDubbedIndex;
|
|
616
|
+
} else {
|
|
617
|
+
if (activeTrackIndex !== undefined && activeTrackIndex < audioTracksWithFlag.length) {
|
|
618
|
+
defaultIndex = activeTrackIndex;
|
|
619
|
+
} else {
|
|
620
|
+
var autoselectIndex = data.audioTracks.findIndex(function (t) {
|
|
621
|
+
return t.autoselect;
|
|
622
|
+
});
|
|
623
|
+
defaultIndex = autoselectIndex !== -1 ? autoselectIndex : 0;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
self.hls.audioTrack = defaultIndex;
|
|
627
|
+
var selectedTrack = audioTracksWithFlag[defaultIndex];
|
|
628
|
+
if (selectedTrack) {
|
|
629
|
+
actions.handleAudioTrackChange(selectedTrack);
|
|
630
|
+
}
|
|
615
631
|
});
|
|
616
632
|
this.hls.on(_hls["default"].Events.ERROR, function (event, data) {
|
|
617
633
|
console.log('HLS.Events.ERROR: ', event, data);
|
|
@@ -75,7 +75,7 @@ var AudioTracksMenuButton = /*#__PURE__*/function (_Component) {
|
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
_this.state = {
|
|
78
|
-
openAccordion: '
|
|
78
|
+
openAccordion: 'dubbed'
|
|
79
79
|
};
|
|
80
80
|
return _this;
|
|
81
81
|
}
|
|
@@ -104,19 +104,38 @@ var AudioTracksMenuButton = /*#__PURE__*/function (_Component) {
|
|
|
104
104
|
player = _this$props.player,
|
|
105
105
|
actions = _this$props.actions;
|
|
106
106
|
var allTracks = player.audioTracksArr || [];
|
|
107
|
+
var dubbedTracks = allTracks.filter(function (track) {
|
|
108
|
+
return track.isDubbedTrack === true;
|
|
109
|
+
});
|
|
107
110
|
if (allTracks.length === 0) return;
|
|
108
111
|
var currentActive = player.activeAudio;
|
|
109
112
|
var isCurrentTrackValid = currentActive && allTracks.some(function (track) {
|
|
110
113
|
return track.id === currentActive.id;
|
|
111
114
|
});
|
|
112
115
|
if (!isCurrentTrackValid) {
|
|
113
|
-
var
|
|
114
|
-
return track.
|
|
116
|
+
var firstDubbed = allTracks.find(function (track) {
|
|
117
|
+
return track.isDubbedTrack === true;
|
|
115
118
|
});
|
|
116
|
-
if (
|
|
117
|
-
actions.handleAudioTrackChange(
|
|
119
|
+
if (firstDubbed) {
|
|
120
|
+
actions.handleAudioTrackChange(firstDubbed);
|
|
121
|
+
} else {
|
|
122
|
+
var fallbackTrack = allTracks.find(function (track) {
|
|
123
|
+
return track.autoselect;
|
|
124
|
+
}) || allTracks[0];
|
|
125
|
+
if (fallbackTrack) {
|
|
126
|
+
actions.handleAudioTrackChange(fallbackTrack);
|
|
127
|
+
}
|
|
118
128
|
}
|
|
119
129
|
}
|
|
130
|
+
if (dubbedTracks.length) {
|
|
131
|
+
this.setState({
|
|
132
|
+
openAccordion: 'dubbed'
|
|
133
|
+
});
|
|
134
|
+
} else {
|
|
135
|
+
this.setState({
|
|
136
|
+
openAccordion: 'original'
|
|
137
|
+
});
|
|
138
|
+
}
|
|
120
139
|
}
|
|
121
140
|
}, {
|
|
122
141
|
key: "changeTrack",
|