mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-11 00:05:09 +01:00
mrvjs suggested changes
This commit is contained in:
parent
fac0a878f3
commit
a3e244285c
@ -32,7 +32,6 @@ export function PictureInPictureAction(props: Props) {
|
||||
className={props.className}
|
||||
icon={Icons.PICTURE_IN_PICTURE}
|
||||
onClick={handleClick}
|
||||
disabled={false}
|
||||
text={
|
||||
isMobile ? (t("videoPlayer.buttons.pictureInPicture") as string) : ""
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ function initPlayer(): VideoPlayerState {
|
||||
isFocused: false,
|
||||
leftControlHovering: false,
|
||||
popoutBounds: null,
|
||||
isPictureInPicture: false,
|
||||
},
|
||||
|
||||
mediaPlaying: {
|
||||
|
@ -84,7 +84,7 @@ export function createCastingStateProvider(
|
||||
this.pause();
|
||||
},
|
||||
togglePictureInPicture() {
|
||||
updateSource(descriptor, state);
|
||||
// no picture in picture while casting
|
||||
},
|
||||
async setVolume(v) {
|
||||
// clamp time between 0 and 1
|
||||
|
@ -214,20 +214,12 @@ export function createVideoStateProvider(
|
||||
? "inline"
|
||||
: "picture-in-picture"
|
||||
);
|
||||
state.interface.isPictureInPicture =
|
||||
webkitPlayer.webkitPresentationMode === "picture-in-picture";
|
||||
}
|
||||
if (canPictureInPicture()) {
|
||||
if (player !== document.pictureInPictureElement) {
|
||||
try {
|
||||
player.requestPictureInPicture();
|
||||
state.interface.isPictureInPicture = true;
|
||||
} catch {
|
||||
state.interface.isPictureInPicture = false;
|
||||
}
|
||||
player.requestPictureInPicture();
|
||||
} else {
|
||||
document.exitPictureInPicture();
|
||||
state.interface.isPictureInPicture = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -30,7 +30,6 @@ export type VideoPlayerState = {
|
||||
isFocused: boolean; // is the video player the users focus? (shortcuts only works when its focused)
|
||||
leftControlHovering: boolean; // is the cursor hovered over the left side of player controls
|
||||
popoutBounds: null | DOMRect; // bounding box of current popout
|
||||
isPictureInPicture: boolean; // is picture in picture active
|
||||
};
|
||||
|
||||
// state related to the playing state of the media
|
||||
|
Loading…
Reference in New Issue
Block a user