Fix web bugs

This commit is contained in:
Zoe Roux 2024-07-01 03:32:39 +00:00
parent aa85d71b87
commit 975fc2f303
No known key found for this signature in database
2 changed files with 11 additions and 3 deletions

View File

@ -240,7 +240,13 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
onVolumeChange?.({volume: nativeRef.current.volume}); onVolumeChange?.({volume: nativeRef.current.volume});
}} }}
onEnded={onEnd} onEnded={onEnd}
style={{position: 'absolute', inset: 0, objectFit: 'contain'}} style={{
position: 'absolute',
inset: 0,
objectFit: 'contain',
width: '100%',
height: '100%',
}}
/> />
); );
}, },
@ -258,7 +264,9 @@ const useMediaSession = (
) => { ) => {
const isPlaying = !nativeRef.current?.paused ?? false; const isPlaying = !nativeRef.current?.paused ?? false;
const progress = nativeRef.current?.currentTime ?? 0; const progress = nativeRef.current?.currentTime ?? 0;
const duration = nativeRef.current?.duration ?? 100; const duration = Number.isFinite(nativeRef.current?.duration)
? nativeRef.current?.duration
: undefined;
const playbackRate = nativeRef.current?.playbackRate ?? 1; const playbackRate = nativeRef.current?.playbackRate ?? 1;
const enabled = 'mediaSession' in navigator && showNotification; const enabled = 'mediaSession' in navigator && showNotification;

View File

@ -1,4 +1,4 @@
import Video from './Video'; import Video from './Video';
export {VideoDecoderProperties} from './VideoDecoderProperties'; export {VideoDecoderProperties} from './VideoDecoderProperties';
export type * from './types'; export * from './types';
export default Video; export default Video;