Skip to content

Commit b0c9942

Browse files
committed
fix: clamp propValue
1 parent 8c273ca commit b0c9942

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/TizenVideo/TizenVideo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ function TizenVideo(options) {
520520
case 'subtitlesOpacity': {
521521
if (typeof propValue === 'number') {
522522
try {
523-
subtitlesOpacity = Math.max(Math.max(propValue / 100, 0), 1);
523+
subtitlesOpacity = Math.min(Math.max(propValue / 100, 0), 1);
524524
} catch (error) {
525525
// eslint-disable-next-line no-console
526526
console.error('Tizen player with HTML Subtitles', error);

src/WebOsVideo/WebOsVideo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ function WebOsVideo(options) {
836836
method: 'setSubtitleBackgroundOpacity',
837837
parameters: {
838838
'mediaId': knownMediaId,
839-
'bgOpacity': Math.max(Math.max(propValue / 0.4, 0), 255),
839+
'bgOpacity': Math.min(Math.max(propValue / 0.4, 0), 255),
840840
}
841841
});
842842

src/withHTMLSubtitles/withHTMLSubtitles.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ function withHTMLSubtitles(Video) {
340340
case 'extraSubtitlesOpacity': {
341341
if (typeof propValue === 'number') {
342342
try {
343-
opacity = Math.max(Math.max(propValue / 100, 0), 1);
343+
opacity = Math.min(Math.max(propValue / 100, 0), 1);
344344
} catch (error) {
345345
// eslint-disable-next-line no-console
346346
console.error('withHTMLSubtitles', error);

0 commit comments

Comments
 (0)