mrvjs suggested changes

This commit is contained in:
zisra 2023-03-04 10:24:56 -06:00
parent fac0a878f3
commit a3e244285c
5 changed files with 2 additions and 13 deletions

View File

@ -32,7 +32,6 @@ export function PictureInPictureAction(props: Props) {
className={props.className} className={props.className}
icon={Icons.PICTURE_IN_PICTURE} icon={Icons.PICTURE_IN_PICTURE}
onClick={handleClick} onClick={handleClick}
disabled={false}
text={ text={
isMobile ? (t("videoPlayer.buttons.pictureInPicture") as string) : "" isMobile ? (t("videoPlayer.buttons.pictureInPicture") as string) : ""
} }

View File

@ -31,7 +31,6 @@ function initPlayer(): VideoPlayerState {
isFocused: false, isFocused: false,
leftControlHovering: false, leftControlHovering: false,
popoutBounds: null, popoutBounds: null,
isPictureInPicture: false,
}, },
mediaPlaying: { mediaPlaying: {

View File

@ -84,7 +84,7 @@ export function createCastingStateProvider(
this.pause(); this.pause();
}, },
togglePictureInPicture() { togglePictureInPicture() {
updateSource(descriptor, state); // no picture in picture while casting
}, },
async setVolume(v) { async setVolume(v) {
// clamp time between 0 and 1 // clamp time between 0 and 1

View File

@ -214,20 +214,12 @@ export function createVideoStateProvider(
? "inline" ? "inline"
: "picture-in-picture" : "picture-in-picture"
); );
state.interface.isPictureInPicture =
webkitPlayer.webkitPresentationMode === "picture-in-picture";
} }
if (canPictureInPicture()) { if (canPictureInPicture()) {
if (player !== document.pictureInPictureElement) { if (player !== document.pictureInPictureElement) {
try {
player.requestPictureInPicture(); player.requestPictureInPicture();
state.interface.isPictureInPicture = true;
} catch {
state.interface.isPictureInPicture = false;
}
} else { } else {
document.exitPictureInPicture(); document.exitPictureInPicture();
state.interface.isPictureInPicture = false;
} }
} }
}, },

View File

@ -30,7 +30,6 @@ export type VideoPlayerState = {
isFocused: boolean; // is the video player the users focus? (shortcuts only works when its focused) 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 leftControlHovering: boolean; // is the cursor hovered over the left side of player controls
popoutBounds: null | DOMRect; // bounding box of current popout popoutBounds: null | DOMRect; // bounding box of current popout
isPictureInPicture: boolean; // is picture in picture active
}; };
// state related to the playing state of the media // state related to the playing state of the media