mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-21 14:47:41 +01:00
mrvjs suggested changes
This commit is contained in:
parent
fac0a878f3
commit
a3e244285c
5 changed files with 2 additions and 13 deletions
|
@ -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) : ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ function initPlayer(): VideoPlayerState {
|
||||||
isFocused: false,
|
isFocused: false,
|
||||||
leftControlHovering: false,
|
leftControlHovering: false,
|
||||||
popoutBounds: null,
|
popoutBounds: null,
|
||||||
isPictureInPicture: false,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mediaPlaying: {
|
mediaPlaying: {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue