99 setIsPlaying ,
1010 selectIsMuted ,
1111 selectVolume ,
12- selectVideoCount ,
12+ selectTrackCount ,
1313 selectDurationInSeconds ,
1414 setPreviewTriggered ,
1515 selectPreviewTriggered ,
@@ -20,7 +20,7 @@ import {
2020 setJumpTriggered ,
2121 selectJumpTriggered ,
2222 setCurrentlyAt ,
23- selectVideos ,
23+ selectTracks ,
2424} from "../redux/videoSlice" ;
2525
2626import ReactPlayer , { Config } from "react-player" ;
@@ -39,6 +39,7 @@ import { useTheme } from "../themes";
3939import { backgroundBoxStyle } from "../cssStyles" ;
4040import { BaseReactPlayerProps } from "react-player/base" ;
4141import { ErrorBox } from "@opencast/appkit" ;
42+ import VideoOffImage from "../img/video-off.png?url" ;
4243
4344const VideoPlayers : React . FC < {
4445 refs ?: React . MutableRefObject < ( VideoPlayerForwardRef | null ) [ ] > ,
@@ -50,10 +51,10 @@ const VideoPlayers: React.FC<{
5051 maxHeightInPixel = 300 ,
5152} ) => {
5253
53- const videos = useAppSelector ( selectVideos ) ;
54+ const videos = useAppSelector ( selectTracks ) ;
5455 let primaryIndex = videos . findIndex ( e => e . audio_stream . available === true ) ;
5556 primaryIndex = primaryIndex < 0 ? 0 : primaryIndex ;
56- const videoCount = useAppSelector ( selectVideoCount ) ;
57+ const videoCount = useAppSelector ( selectTrackCount ) ;
5758
5859 const [ videoPlayers , setVideoPlayers ] = useState < JSX . Element [ ] > ( [ ] ) ;
5960
@@ -81,6 +82,7 @@ const VideoPlayers: React.FC<{
8182 subtitleUrl = { "" }
8283 first = { i === 0 }
8384 last = { i === videoCount - 1 }
85+ audioOnly = { ! videos [ i ] . video_stream . available }
8486 selectIsPlaying = { selectIsPlaying }
8587 selectIsMuted = { selectIsMuted }
8688 selectVolume = { selectVolume }
@@ -126,6 +128,7 @@ interface VideoPlayerProps {
126128 first : boolean ,
127129 last : boolean ,
128130 overwritePlayerCSS ?: SerializedStyles ,
131+ audioOnly ?: boolean ,
129132 selectIsPlaying : ( state : RootState ) => boolean ,
130133 selectIsMuted : ( state : RootState ) => boolean ,
131134 selectVolume : ( state : RootState ) => number ,
@@ -169,6 +172,7 @@ export const VideoPlayer = React.forwardRef<VideoPlayerForwardRef, VideoPlayerPr
169172 first,
170173 last,
171174 overwritePlayerCSS,
175+ audioOnly = false ,
172176 selectCurrentlyAtInSeconds,
173177 selectPreviewTriggered,
174178 selectClickTriggered,
@@ -316,6 +320,7 @@ export const VideoPlayer = React.forwardRef<VideoPlayerForwardRef, VideoPlayerPr
316320 // Skip player when navigating page with keyboard
317321 tabIndex : "-1" ,
318322 crossOrigin : "anonymous" , // allow thumbnail generation
323+ poster : audioOnly && VideoOffImage , // Show image when there is no video stream
319324 } ,
320325 tracks : [
321326 { kind : "subtitles" , src : subtitleUrl , srcLang : "en" , default : true , label : "I am irrelevant" } ,
@@ -394,6 +399,7 @@ export const VideoPlayer = React.forwardRef<VideoPlayerForwardRef, VideoPlayerPr
394399
395400 const reactPlayerStyle = css ( {
396401 aspectRatio : "16 / 9" , // Hard-coded for now because there are problems with updating this value at runtime
402+ padding : audioOnly ? "0px" : "20px" ,
397403
398404 overflow : "hidden" , // Required for borderRadius to show
399405 ...first && {
0 commit comments