Skip to content

Commit

Permalink
fix: clamp propValue
Browse files Browse the repository at this point in the history
  • Loading branch information
tymmesyde committed Jan 31, 2024
1 parent 8c273ca commit b0c9942
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/TizenVideo/TizenVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ function TizenVideo(options) {
case 'subtitlesOpacity': {
if (typeof propValue === 'number') {
try {
subtitlesOpacity = Math.max(Math.max(propValue / 100, 0), 1);
subtitlesOpacity = Math.min(Math.max(propValue / 100, 0), 1);
} catch (error) {
// eslint-disable-next-line no-console
console.error('Tizen player with HTML Subtitles', error);
Expand Down
2 changes: 1 addition & 1 deletion src/WebOsVideo/WebOsVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ function WebOsVideo(options) {
method: 'setSubtitleBackgroundOpacity',
parameters: {
'mediaId': knownMediaId,
'bgOpacity': Math.max(Math.max(propValue / 0.4, 0), 255),
'bgOpacity': Math.min(Math.max(propValue / 0.4, 0), 255),
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/withHTMLSubtitles/withHTMLSubtitles.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ function withHTMLSubtitles(Video) {
case 'extraSubtitlesOpacity': {
if (typeof propValue === 'number') {
try {
opacity = Math.max(Math.max(propValue / 100, 0), 1);
opacity = Math.min(Math.max(propValue / 100, 0), 1);
} catch (error) {
// eslint-disable-next-line no-console
console.error('withHTMLSubtitles', error);
Expand Down

0 comments on commit b0c9942

Please sign in to comment.