mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-05-28 17:07:08 +00:00
fix(web): fullscreen targets container, guard double enable, remove unused mimeType
This commit is contained in:
@@ -118,6 +118,7 @@ class VideoPlayer extends VideoPlayerEvents implements VideoPlayerBase {
|
||||
if (this._store) { this._store.seek(v); } else { this.video.currentTime = v; }
|
||||
}
|
||||
get muted(): boolean { return this.media.muted; }
|
||||
// v10 store has toggleMuted() but no direct setter — always use video element
|
||||
set muted(v: boolean) { this.video.muted = v; }
|
||||
get loop(): boolean { return this.video.loop; }
|
||||
set loop(v: boolean) { this.video.loop = v; }
|
||||
|
||||
@@ -14,11 +14,6 @@ export type VideoConfig = {
|
||||
* ```
|
||||
*/
|
||||
uri: VideoSource;
|
||||
/**
|
||||
* complete mime type, used to select a backend for playback.
|
||||
* if not specified, the extension of the url might be used
|
||||
*/
|
||||
mimeType?: string
|
||||
/**
|
||||
* The headers to be sent with the request.
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useImperativeHandle,
|
||||
useRef,
|
||||
type CSSProperties,
|
||||
} from "react";
|
||||
import { View } from "react-native";
|
||||
@@ -80,6 +81,7 @@ const VideoView = forwardRef<VideoViewRef, VideoViewProps>(
|
||||
ref,
|
||||
) => {
|
||||
const player = nPlayer as unknown as VideoPlayer;
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const objectFitMap: Record<string, CSSProperties["objectFit"]> = {
|
||||
contain: "contain",
|
||||
@@ -93,7 +95,7 @@ const VideoView = forwardRef<VideoViewRef, VideoViewProps>(
|
||||
ref,
|
||||
() => ({
|
||||
enterFullscreen: () => {
|
||||
document.documentElement.requestFullscreen?.();
|
||||
containerRef.current?.requestFullscreen?.();
|
||||
},
|
||||
exitFullscreen: () => {
|
||||
document.exitFullscreen?.();
|
||||
@@ -123,6 +125,7 @@ const VideoView = forwardRef<VideoViewRef, VideoViewProps>(
|
||||
<Player.Provider>
|
||||
<PlayerBridge player={player} />
|
||||
<Player.Container
|
||||
ref={containerRef}
|
||||
style={{
|
||||
position: "absolute",
|
||||
inset: "0",
|
||||
|
||||
@@ -12,6 +12,7 @@ export class MediaSessionHandler {
|
||||
constructor(private store: MediaSessionStore) {}
|
||||
|
||||
enable() {
|
||||
if (this.enabled) return;
|
||||
const mediaSession = getMediaSession();
|
||||
if (!mediaSession) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user