55 Grid ,
66 Group ,
77 MantineStyleProps ,
8+ Paper ,
89 Text ,
910 ThemeIcon ,
1011 Tooltip
@@ -22,8 +23,11 @@ import {
2223 RepeatOffIcon ,
2324 ReplayIcon ,
2425 SoundIcon ,
25- SoundOffIcon
26+ SoundOffIcon ,
27+ TimeIcon
2628} from '@/icons/icons' ;
29+ import styles from '@/theme/global.module.css' ;
30+ import { IconSize } from '@/types/enums' ;
2731import { Uri } from '@/types/types' ;
2832
2933interface Props extends MantineStyleProps {
@@ -55,10 +59,30 @@ export function VideoPlayer({ uri, ...styleProps }: Props) {
5559 playAudioUri
5660 ) ;
5761
62+ const [ isPlaying ] = useProperty ( 'BoolProperty' , `${ uri } .IsPlaying` ) ;
63+ const [ startTime ] = useProperty ( 'StringProperty' , `${ uri } .StartTime` ) ;
64+ const [ endTime ] = useProperty ( 'StringProperty' , `${ uri } .EndTime` ) ;
65+
5866 if ( ! propertyOwner ) {
5967 throw Error ( `No property owner found for uri: ${ uri } ` ) ;
6068 }
6169
70+ const shouldHidePlaybackControls = Boolean ( startTime ) || Boolean ( endTime ) ;
71+
72+ if ( shouldHidePlaybackControls ) {
73+ // This video player is mapped to time
74+ return (
75+ < Paper ml = { 'xs' } p = { 'xs' } >
76+ < Group wrap = { 'nowrap' } gap = { 'xs' } >
77+ < ThemeIcon variant = { 'subtle' } size = { 'xs' } >
78+ < TimeIcon size = { IconSize . xs } />
79+ </ ThemeIcon >
80+ < Text size = { 'sm' } > { t ( 'mapped-to-time-info' ) } </ Text >
81+ </ Group >
82+ </ Paper >
83+ ) ;
84+ }
85+
6286 // Data for the different properties that the controls represent, to show in the
6387 // info box
6488 const propertyData = [
@@ -76,24 +100,17 @@ export function VideoPlayer({ uri, ...styleProps }: Props) {
76100 return (
77101 < Group pl = { 'xs' } wrap = { 'nowrap' } { ...styleProps } >
78102 < Group gap = { 'xs' } py = { 'xs' } >
79- < ActionIcon . Group >
80- < Tooltip label = { t ( 'play-button.tooltip' ) } >
81- < ActionIcon
82- onClick = { ( ) => triggerPlay ( null ) }
83- aria-label = { t ( 'play-button.aria-label' ) }
84- >
85- < PlayIcon />
86- </ ActionIcon >
87- </ Tooltip >
88- < Tooltip label = { t ( 'pause-button.tooltip' ) } >
89- < ActionIcon
90- onClick = { ( ) => triggerPause ( null ) }
91- aria-label = { t ( 'pause-button.aria-label' ) }
92- >
93- < PauseIcon />
94- </ ActionIcon >
95- </ Tooltip >
96- </ ActionIcon . Group >
103+ < Tooltip label = { isPlaying ? t ( 'pause-button.tooltip' ) : t ( 'play-button.tooltip' ) } >
104+ < ActionIcon
105+ variant = { isPlaying ? 'filled' : 'default' }
106+ onClick = { ( ) => ( isPlaying ? triggerPause ( null ) : triggerPlay ( null ) ) }
107+ aria-label = {
108+ isPlaying ? t ( 'pause-button.aria-label' ) : t ( 'play-button.aria-label' )
109+ }
110+ >
111+ { isPlaying ? < PauseIcon className = { styles . blinking } /> : < PlayIcon /> }
112+ </ ActionIcon >
113+ </ Tooltip >
97114 < Tooltip label = { t ( 'restart-button.tooltip' ) } >
98115 < ActionIcon
99116 onClick = { ( ) => triggerGoToStart ( null ) }
0 commit comments