22import { useCallback , useEffect , useMemo , useRef , useState } from 'react' ;
33import './index.less' ;
44import {
5+ CaretRightOutlined ,
56 CompressOutlined ,
67 DownloadOutlined ,
78 ExpandOutlined ,
89 ExportOutlined ,
10+ LoadingOutlined ,
11+ PauseOutlined ,
912 ThunderboltOutlined ,
1013 VideoCameraOutlined ,
1114} from '@ant-design/icons' ;
@@ -14,6 +17,7 @@ import type {
1417 PlayerRef ,
1518 RenderCustomControls ,
1619 RenderFullscreenButton ,
20+ RenderPlayPauseButton ,
1721} from '@remotion/player' ;
1822import { Dropdown , Spin , Switch , Tooltip , message } from 'antd' ;
1923import GlobalPerspectiveIcon from '../../icons/global-perspective.svg' ;
@@ -138,12 +142,26 @@ export function Player(props?: {
138142
139143 const [ mouseOverSettingsIcon , setMouseOverSettingsIcon ] = useState ( false ) ;
140144
145+ const renderPlayPauseButton : RenderPlayPauseButton = useCallback (
146+ ( { playing, isBuffering } ) => {
147+ if ( isBuffering )
148+ return < LoadingOutlined spin style = { { color : '#fff' } } /> ;
149+ return playing ? (
150+ < PauseOutlined style = { { color : '#fff' } } />
151+ ) : (
152+ < CaretRightOutlined style = { { color : '#fff' } } />
153+ ) ;
154+ } ,
155+ [ ] ,
156+ ) ;
157+
141158 const renderFullscreenButton : RenderFullscreenButton = useCallback (
142- ( { isFullscreen } ) => (
143- < div className = "status-icon" >
144- { isFullscreen ? < CompressOutlined /> : < ExpandOutlined /> }
145- </ div >
146- ) ,
159+ ( { isFullscreen } ) =>
160+ isFullscreen ? (
161+ < CompressOutlined style = { { color : '#fff' } } />
162+ ) : (
163+ < ExpandOutlined style = { { color : '#fff' } } />
164+ ) ,
147165 [ ] ,
148166 ) ;
149167
@@ -161,29 +179,41 @@ export function Player(props?: {
161179 </ Tooltip >
162180 ) : null }
163181
164- < Tooltip title = { isExporting ? 'Generating...' : 'Export Video' } >
165- < div
166- className = "status-icon"
167- onClick = { isExporting ? undefined : handleExportVideo }
168- style = { {
169- opacity : isExporting ? 0.5 : 1 ,
170- cursor : isExporting ? 'not-allowed' : 'pointer' ,
171- } }
172- >
173- { isExporting ? (
174- < Spin size = "small" percent = { exportProgress } />
175- ) : (
176- < ExportOutlined />
177- ) }
178- </ div >
179- </ Tooltip >
180-
181182 < Dropdown
182183 trigger = { [ 'hover' , 'click' ] }
183184 placement = "topRight"
184185 overlayStyle = { { minWidth : '148px' } }
185186 dropdownRender = { ( ) => (
186187 < div className = "player-settings-dropdown" >
188+ { /* Export video */ }
189+ < div
190+ className = "player-settings-item"
191+ style = { {
192+ display : 'flex' ,
193+ alignItems : 'center' ,
194+ gap : '4px' ,
195+ height : '32px' ,
196+ padding : '0 8px' ,
197+ borderRadius : '4px' ,
198+ cursor : isExporting ? 'not-allowed' : 'pointer' ,
199+ opacity : isExporting ? 0.5 : 1 ,
200+ } }
201+ onClick = { isExporting ? undefined : handleExportVideo }
202+ >
203+ { isExporting ? (
204+ < Spin size = "small" percent = { exportProgress } />
205+ ) : (
206+ < ExportOutlined style = { { width : '16px' , height : '16px' } } />
207+ ) }
208+ < span style = { { fontSize : '12px' } } >
209+ { isExporting
210+ ? `Exporting ${ exportProgress } %`
211+ : 'Export video' }
212+ </ span >
213+ </ div >
214+
215+ < div className = "player-settings-divider" />
216+
187217 { /* Focus on cursor toggle */ }
188218 < div
189219 className = "player-settings-item"
@@ -345,8 +375,9 @@ export function Player(props?: {
345375 playbackRate = { playbackSpeed }
346376 controls
347377 showVolumeControls = { false }
348- renderCustomControls = { renderCustomControls }
378+ renderPlayPauseButton = { renderPlayPauseButton }
349379 renderFullscreenButton = { renderFullscreenButton }
380+ renderCustomControls = { renderCustomControls }
350381 autoPlay
351382 loop = { false }
352383 style = { {
0 commit comments