Skip to content

Commit

Permalink
Fix LG Extended Tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
jaruba committed Jun 3, 2024
1 parent 0f44df8 commit cb6323b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
21 changes: 10 additions & 11 deletions src/WebOsVideo/WebOsVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ function WebOsVideo(options) {
var nrAudio = 0;
textTracks = [];
audioTracks = [];
var respArr = resp || [];
respArr.forEach(function(track) {
if (track.type === 'text') {
tracksData = resp;
if (((tracksData || {}).subs || []).length) {
tracksData.subs.forEach(function(track) {
var textTrackId = nrSubs;
nrSubs++;
if (!currentSubTrack && !textTracks.length) {
Expand All @@ -465,7 +465,12 @@ function WebOsVideo(options) {
embedded: true,
mode: textTrackId === currentSubTrack ? 'showing' : 'disabled',
});
} else if (track.type === 'audio') {
});
onPropChanged('subtitlesTracks');
onPropChanged('selectedSubtitlesTrackId');
}
if (((tracksData || {}).audio || []).length) {
tracksData.audio.forEach(function(track) {
var audioTrackId = nrAudio;
nrAudio++;
if (!currentAudioTrack && !audioTracks.length) {
Expand All @@ -479,13 +484,7 @@ function WebOsVideo(options) {
embedded: true,
mode: audioTrackId === currentAudioTrack ? 'showing' : 'disabled',
});
}
})
if (((tracksData || {}).subs || []).length) {
onPropChanged('subtitlesTracks');
onPropChanged('selectedSubtitlesTrackId');
}
if (((tracksData || {}).audio || []).length) {
});
onPropChanged('audioTracks');
onPropChanged('selectedAudioTrackId');
}
Expand Down
4 changes: 2 additions & 2 deletions src/tracksData.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = function(url, cb) {
fetch('http://127.0.0.1:11470/tracks/'+encodeURIComponent(url)).then(function(resp) {
resp.json().then(function(tracks) {
var audioTracks = tracks.filter(function(el) { return el['@type'] === 'Audio'; });
var subsTracks = tracks.filter(function(el) { return el['@type'] === 'Text'; });
var audioTracks = tracks.filter(function(el) { return el.type === 'audio'; });
var subsTracks = tracks.filter(function(el) { return el.type === 'text'; });
cb({ audio: audioTracks, subs: subsTracks });
}).catch(function(err) {
// eslint-disable-next-line no-console
Expand Down

0 comments on commit cb6323b

Please sign in to comment.