Skip to content

Commit

Permalink
fix: webkit fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-pousette committed Feb 6, 2024
1 parent 91d018c commit 39dd272
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,22 +511,29 @@ export const Controls = (props: {
<FitScreen />
</IconButton>
</Grid> */}
<Grid item justifyContent="center">
<IconButton
onClick={() => {
if (props.viewRef) {
if (props.viewRef.requestFullscreen)
props.viewRef.requestFullscreen();
if (props.viewRef["webkitRequestFullscreen"]) {
props.viewRef["webkitRequestFullscreen"]();
{(props.videoRef?.requestFullscreen ||
props.videoRef?.["webkitExitFullscreen"]) && (
<Grid item justifyContent="center">
<IconButton
onClick={() => {
if (props.videoRef) {
if (props.videoRef.requestFullscreen) {
props.videoRef.requestFullscreen();
} else if (
props.videoRef["webkitExitFullscreen"]
) {
props.videoRef[
"webkitExitFullscreen"
]();
}
}
}
}}
sx={{ borderRadius: 0 }}
>
<Fullscreen />
</IconButton>
</Grid>
}}
sx={{ borderRadius: 0 }}
>
<Fullscreen />
</IconButton>
</Grid>
)}
</Grid>
</Grid>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const Controls = (
selectedResolution?: Resolution[];
onStreamTypeChange?: (settings: StreamType) => void;
onQualityChange: (settings: SourceSetting[]) => void;
viewRef: HTMLElement;
viewRef: HTMLCanvasElement;
} & ControlInterface
) => {
const [showControls, setShowControls] = useState(false);
Expand Down Expand Up @@ -616,22 +616,27 @@ export const Controls = (
<FitScreen />
</IconButton>
</Grid> */}
<Grid item justifyContent="center">
<IconButton
onClick={() => {
if (props.viewRef) {
if (props.viewRef.requestFullscreen)
props.viewRef.requestFullscreen();
if (props.viewRef["webkitRequestFullscreen"]) {
props.viewRef["webkitRequestFullscreen"]();
{(props.viewRef?.requestFullscreen ||
props.viewRef?.["webkitExitFullscreen"]) && (
<Grid item justifyContent="center">
<IconButton
onClick={() => {
if (props.viewRef) {
if (props.viewRef.requestFullscreen) {
props.viewRef.requestFullscreen();
} else if (
props.viewRef["webkitExitFullscreen"]
) {
props.viewRef["webkitExitFullscreen"]();
}
}
}
}}
sx={{ borderRadius: 0 }}
>
<Fullscreen />
</IconButton>
</Grid>
}}
sx={{ borderRadius: 0 }}
>
<Fullscreen />
</IconButton>
</Grid>
)}
</Grid>
</Grid>
);
Expand Down

0 comments on commit 39dd272

Please sign in to comment.