Add most properties

This commit is contained in:
Zoe Roux 2024-06-30 11:38:52 +00:00
parent f5fa063bc0
commit cad63d465d
No known key found for this signature in database

View File

@ -14,7 +14,11 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
paused, paused,
muted, muted,
volume, volume,
rate,
repeat,
controls,
showNotificationControls, showNotificationControls,
poster,
onBuffer, onBuffer,
onLoad, onLoad,
onProgress, onProgress,
@ -126,6 +130,13 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
}, 500); }, 500);
}, [onPlaybackStateChanged]); }, [onPlaybackStateChanged]);
useEffect(() => {
if (!nativeRef.current || rate === undefined) {
return;
}
nativeRef.current.playbackRate = rate;
}, [rate]);
return ( return (
<> <>
{showNotificationControls && ( {showNotificationControls && (
@ -136,8 +147,10 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
src={source.uri as string | undefined} src={source.uri as string | undefined}
muted={muted} muted={muted}
autoPlay={!paused} autoPlay={!paused}
controls={false} controls={controls}
loop={repeat}
playsInline playsInline
poster={poster}
onCanPlay={() => onBuffer?.({isBuffering: false})} onCanPlay={() => onBuffer?.({isBuffering: false})}
onWaiting={() => onBuffer?.({isBuffering: true})} onWaiting={() => onBuffer?.({isBuffering: true})}
onRateChange={() => { onRateChange={() => {
@ -196,7 +209,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
} }
}} }}
onLoadedMetadata={() => { onLoadedMetadata={() => {
if (source.startPosition) setProgress(source.startPosition / 1000); if (source.startPosition) seek(source.startPosition / 1000);
}} }}
onPlay={() => onPlaybackStateChanged?.({isPlaying: true})} onPlay={() => onPlaybackStateChanged?.({isPlaying: true})}
onPause={() => onPlaybackStateChanged?.({isPlaying: false})} onPause={() => onPlaybackStateChanged?.({isPlaying: false})}