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,28 @@ 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+ if ( startTime || endTime ) {
71+ // This video player is mapped to time, so don't show the playback controls
72+ return (
73+ < Paper ml = { 'xs' } p = { 'xs' } >
74+ < Group wrap = { 'nowrap' } gap = { 'xs' } >
75+ < ThemeIcon variant = { 'subtle' } size = { 'xs' } >
76+ < TimeIcon size = { IconSize . xs } />
77+ </ ThemeIcon >
78+ < Text size = { 'sm' } > { t ( 'mapped-to-time-info' ) } </ Text >
79+ </ Group >
80+ </ Paper >
81+ ) ;
82+ }
83+
6284 // Data for the different properties that the controls represent, to show in the
6385 // info box
6486 const propertyData = [
@@ -76,24 +98,17 @@ export function VideoPlayer({ uri, ...styleProps }: Props) {
7698 return (
7799 < Group pl = { 'xs' } wrap = { 'nowrap' } { ...styleProps } >
78100 < 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 >
101+ < Tooltip label = { isPlaying ? t ( 'pause-button.tooltip' ) : t ( 'play-button.tooltip' ) } >
102+ < ActionIcon
103+ variant = { isPlaying ? 'filled' : 'default' }
104+ onClick = { ( ) => ( isPlaying ? triggerPause ( null ) : triggerPlay ( null ) ) }
105+ aria-label = {
106+ isPlaying ? t ( 'pause-button.aria-label' ) : t ( 'play-button.aria-label' )
107+ }
108+ >
109+ { isPlaying ? < PauseIcon className = { styles . blinking } /> : < PlayIcon /> }
110+ </ ActionIcon >
111+ </ Tooltip >
97112 < Tooltip label = { t ( 'restart-button.tooltip' ) } >
98113 < ActionIcon
99114 onClick = { ( ) => triggerGoToStart ( null ) }
0 commit comments