Skip to content

Commit a85fc2c

Browse files
committed
Make sure audio only icon is visible
With the way we do it now, we can't change the color of the audio only icon, as it is effictively an image. But we can change the background for the icon instead. Also fixes an issue where themed css was not properly applied to the react player.
1 parent a7903d0 commit a85fc2c

2 files changed

Lines changed: 27 additions & 18 deletions

File tree

src/main/VideoPlayers.tsx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ export const VideoPlayer = React.forwardRef<VideoPlayerForwardRef, VideoPlayerPr
410410
borderTopLeftRadius: "5px",
411411
borderBottomRightRadius: "5px",
412412
},
413+
backgroundColor: theme.audio_only_bg,
414+
// ...(audioOnly) && { background: `${theme.audio_only_bg}` },
413415
});
414416

415417
const videoPlayerWrapperStyles = css({
@@ -436,24 +438,26 @@ export const VideoPlayer = React.forwardRef<VideoPlayerForwardRef, VideoPlayerPr
436438
if (!errorState) {
437439
return (
438440
<div css={videoPlayerWrapperStyles}>
439-
<ReactPlayer url={url}
440-
css={overwritePlayerCSS ?? [backgroundBoxStyle(theme), reactPlayerStyle]}
441-
ref={ref}
442-
width="unset"
443-
height="100%"
444-
playing={isPlaying}
445-
volume={volume}
446-
muted={!isPrimary || isMuted}
447-
onProgress={onProgressCallback}
448-
progressInterval={100}
449-
onReady={onReadyCallback}
450-
onPlay={onPlay}
451-
onEnded={onEndedCallback}
452-
onError={onErrorCallback}
453-
tabIndex={-1}
454-
config={playerConfig}
455-
disablePictureInPicture
456-
/>
441+
{/* Make sure themeing is applied properly with this wrapper*/}
442+
<div css={overwritePlayerCSS ?? [backgroundBoxStyle(theme), reactPlayerStyle]}>
443+
<ReactPlayer url={url}
444+
ref={ref}
445+
width="unset"
446+
height="100%"
447+
playing={isPlaying}
448+
volume={volume}
449+
muted={!isPrimary || isMuted}
450+
onProgress={onProgressCallback}
451+
progressInterval={100}
452+
onReady={onReadyCallback}
453+
onPlay={onPlay}
454+
onEnded={onEndedCallback}
455+
onError={onErrorCallback}
456+
tabIndex={-1}
457+
config={playerConfig}
458+
disablePictureInPicture
459+
/>
460+
</div>
457461
</div>
458462
);
459463
} else {

src/themes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export interface Theme {
6868
clock_focus: string;
6969
digit_selected: string;
7070
text_shadow: string;
71+
audio_only_bg: string;
7172
}
7273

7374
export const lightMode: Theme = {
@@ -130,6 +131,7 @@ export const lightMode: Theme = {
130131
`0 2px ${COLORS.neutral15}, 0 -2px ${COLORS.neutral15},` +
131132
`1px 1px ${COLORS.neutral15}, -1px -1px ${COLORS.neutral15},` +
132133
`1px -1px ${COLORS.neutral15}, -1px 1px ${COLORS.neutral15}`,
134+
audio_only_bg: COLORS.neutral05,
133135
};
134136

135137
export const darkMode: Theme = {
@@ -190,6 +192,7 @@ export const darkMode: Theme = {
190192
`0 2px ${COLORS.neutral15}, 0 -2px ${COLORS.neutral15},` +
191193
`1px 1px ${COLORS.neutral15}, -1px -1px ${COLORS.neutral15},` +
192194
`1px -1px ${COLORS.neutral15}, -1px 1px ${COLORS.neutral15}`,
195+
audio_only_bg: COLORS.neutral90,
193196
};
194197

195198
export const highContrastDarkMode: Theme = {
@@ -248,6 +251,7 @@ export const highContrastDarkMode: Theme = {
248251
digit_selected: "#000",
249252
text_shadow: "2px 0 #000, -2px 0 #000, 0 2px #000, 0 -2px #000," +
250253
" 1px 1px #000, -1px -1px #000, 1px -1px #000, -1px 1px #000",
254+
audio_only_bg: "#fff",
251255
};
252256

253257
export const highContrastLightMode: Theme = {
@@ -306,4 +310,5 @@ export const highContrastLightMode: Theme = {
306310
digit_selected: "#fff",
307311
text_shadow: "2px 0 snow, -2px 0 snow, 0 2px snow, 0 -2px snow," +
308312
" 1px 1px snow, -1px -1px snow, 1px -1px snow, -1px 1px snow",
313+
audio_only_bg: "#fff",
309314
};

0 commit comments

Comments
 (0)