@@ -73,6 +73,42 @@ export default function StreamPlayer(props: Props) {
7373 }
7474}
7575
76+ function PlayPauseButton ( {
77+ isPaused,
78+ loading,
79+ togglePause,
80+ hideOnMobile,
81+ } : {
82+ isPaused : boolean ;
83+ loading : boolean ;
84+ togglePause : ( ) => void ;
85+ hideOnMobile ?: boolean ;
86+ } ) {
87+ return (
88+ < Tooltip
89+ label = { isPaused ? 'Pause' : 'Play' }
90+ visibleFrom = { hideOnMobile ? 'md' : undefined }
91+ >
92+ < ActionIcon
93+ color = "#ea3722"
94+ size = { 64 }
95+ aria-label = { isPaused === false ? 'play' : 'pause' }
96+ onClick = { ( ) => togglePause ( ) }
97+ disabled = { loading }
98+ visibleFrom = { hideOnMobile ? 'md' : undefined }
99+ >
100+ { loading ? (
101+ < Loader color = "white" />
102+ ) : isPaused ? (
103+ < IconPlayerPlay size = { 48 } />
104+ ) : (
105+ < IconPlayerPause size = { 48 } />
106+ ) }
107+ </ ActionIcon >
108+ </ Tooltip >
109+ ) ;
110+ }
111+
76112function logEvent < T > ( event : string , action ?: ( t : T ) => void ) : ( t : T ) => void {
77113 return ( t ) => {
78114 console . log ( `[player] [event] ${ event } ` ) ;
@@ -197,7 +233,7 @@ function StreamPlayerInner({ streamId, isLive, logPlayerErrors }: Props) {
197233 />
198234
199235 < Group >
200- < Text >
236+ < Text visibleFrom = "md" >
201237 { formatTimestamp ( currentTime ) } { ' ' }
202238 { ! isLive && ! loading && < > / { formatTimestamp ( duration ) } </ > }
203239 </ Text >
@@ -217,7 +253,20 @@ function StreamPlayerInner({ streamId, isLive, logPlayerErrors }: Props) {
217253 />
218254 </ Group >
219255
220- < br />
256+ < Center hiddenFrom = "md" >
257+ < Text >
258+ { formatTimestamp ( currentTime ) } { ' ' }
259+ { ! isLive && ! loading && < > / { formatTimestamp ( duration ) } </ > }
260+ </ Text >
261+ </ Center >
262+
263+ < Group justify = "center" hiddenFrom = "md" >
264+ < PlayPauseButton
265+ isPaused = { isPaused }
266+ loading = { loading }
267+ togglePause = { togglePause }
268+ />
269+ </ Group >
221270
222271 < Group justify = "center" >
223272 { isLive && (
@@ -246,23 +295,12 @@ function StreamPlayerInner({ streamId, isLive, logPlayerErrors }: Props) {
246295 </ ActionIcon >
247296 </ Tooltip >
248297
249- < Tooltip label = { isPaused ? 'Pause' : 'Play' } >
250- < ActionIcon
251- color = "#ea3722"
252- size = { 64 }
253- aria-label = { audio ?. current ?. paused === false ? 'play' : 'pause' }
254- onClick = { ( ) => togglePause ( ) }
255- disabled = { loading }
256- >
257- { loading ? (
258- < Loader color = "white" />
259- ) : isPaused ? (
260- < IconPlayerPlay size = { 48 } />
261- ) : (
262- < IconPlayerPause size = { 48 } />
263- ) }
264- </ ActionIcon >
265- </ Tooltip >
298+ < PlayPauseButton
299+ isPaused = { isPaused }
300+ loading = { loading }
301+ togglePause = { togglePause }
302+ hideOnMobile
303+ />
266304
267305 < Tooltip label = "Skip 10 seconds" >
268306 < ActionIcon
0 commit comments