Skip to content

Commit

Permalink
Prefer videoElement.mediaId
Browse files Browse the repository at this point in the history
  • Loading branch information
jaruba committed Jun 4, 2024
1 parent fc7afb3 commit 5880f35
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/WebOsVideo/WebOsVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ function WebOsVideo(options) {

var count_message = 0;

var mediaId = function() {
return videoElement.mediaId || knownMediaId;
};

var subStyles = {
color: 'white',
font_size: 1,
Expand Down Expand Up @@ -238,7 +242,7 @@ function WebOsVideo(options) {
luna({
method: 'subscribe',
parameters: {
'mediaId': knownMediaId,
'mediaId': mediaId(),
'subscribe': true
}
}, function (result) {
Expand Down Expand Up @@ -293,7 +297,7 @@ function WebOsVideo(options) {
luna({
method: 'subscribe',
parameters: {
'mediaId': knownMediaId,
'mediaId': mediaId(),
'subscribe': false
}
}, function () { // function(result)
Expand All @@ -310,7 +314,7 @@ function WebOsVideo(options) {
// luna({
// method: 'unload',
// parameters: {
// 'mediaId': knownMediaId
// 'mediaId': mediaId()
// }
// }, cb, cb);
// };
Expand All @@ -323,7 +327,7 @@ function WebOsVideo(options) {
luna({
method: 'setSubtitleEnable',
parameters: {
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'enable': status
}
});
Expand Down Expand Up @@ -696,7 +700,7 @@ function WebOsVideo(options) {
luna({
method: key,
parameters: {
mediaId: videoElement.mediaId,
mediaId: mediaId(),
charColor: subStyles.color,
bgColor: subStyles.bg_color === 'none' ? 'black' : subStyles.bg_color,
position: subStyles.position,
Expand Down Expand Up @@ -733,7 +737,7 @@ function WebOsVideo(options) {
method: 'selectTrack',
parameters: {
'type': 'text',
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'index': trackIndex
}
}, successCb, successCb);
Expand Down Expand Up @@ -761,7 +765,7 @@ function WebOsVideo(options) {
luna({
method: 'setSubtitlePosition',
parameters: {
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'position': nextOffset,
}
});
Expand All @@ -784,7 +788,7 @@ function WebOsVideo(options) {
luna({
method: 'setSubtitleFontSize',
parameters: {
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'fontSize': nextSubSize,
}
});
Expand All @@ -808,7 +812,7 @@ function WebOsVideo(options) {
luna({
method: 'setSubtitleCharacterColor',
parameters: {
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'charColor': nextColor,
}
});
Expand All @@ -827,23 +831,23 @@ function WebOsVideo(options) {
luna({
method: 'setSubtitleBackgroundColor',
parameters: {
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'bgColor': stremioColors[propValue] === 'none' ? 'black' : stremioColors[propValue],
}
});
if (stremioColors[propValue] === 'none') {
luna({
method: 'setSubtitleBackgroundOpacity',
parameters: {
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'bgOpacity': 0,
}
});
} else {
luna({
method: 'setSubtitleBackgroundOpacity',
parameters: {
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'bgOpacity': 255,
}
});
Expand All @@ -864,7 +868,7 @@ function WebOsVideo(options) {
luna({
method: 'setSubtitleCharacterOpacity',
parameters: {
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'charOpacity': nextSubOpacity,
}
});
Expand All @@ -885,7 +889,7 @@ function WebOsVideo(options) {
method: 'selectTrack',
parameters: {
'type': 'audio',
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'index': trackIndex
}
}, function() {
Expand Down Expand Up @@ -938,7 +942,7 @@ function WebOsVideo(options) {
luna({
method: 'setPlayRate',
parameters: {
'mediaId': videoElement.mediaId,
'mediaId': mediaId(),
'playRate': lastPlaybackSpeed,
'audioOutput': true,
}
Expand Down

0 comments on commit 5880f35

Please sign in to comment.