Browse Source

mrvjs suggested changes

pull/175/head
zisra 3 years ago
parent
commit
a3e244285c
  1. 1
      src/video/components/actions/PictureInPictureAction.tsx
  2. 1
      src/video/state/init.ts
  3. 2
      src/video/state/providers/castingStateProvider.ts
  4. 10
      src/video/state/providers/videoStateProvider.ts
  5. 1
      src/video/state/types.ts

1
src/video/components/actions/PictureInPictureAction.tsx

@ -32,7 +32,6 @@ export function PictureInPictureAction(props: Props) { @@ -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) : ""
}

1
src/video/state/init.ts

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

2
src/video/state/providers/castingStateProvider.ts

@ -84,7 +84,7 @@ export function createCastingStateProvider( @@ -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

10
src/video/state/providers/videoStateProvider.ts

@ -214,20 +214,12 @@ export function createVideoStateProvider( @@ -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;
}
}
},

1
src/video/state/types.ts

@ -30,7 +30,6 @@ export type VideoPlayerState = { @@ -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…
Cancel
Save