From 163ca0df29ca6c0ce78c43296a8ecc24baf4e1a0 Mon Sep 17 00:00:00 2001
From: zisra <100528712+zisra@users.noreply.github.com>
Date: Mon, 27 Feb 2023 17:35:56 -0600
Subject: [PATCH] Fix isPictureInPicture

---
 public/config.js                                | 2 +-
 src/video/state/providers/videoStateProvider.ts | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/public/config.js b/public/config.js
index b69f60eb..7de84dc6 100644
--- a/public/config.js
+++ b/public/config.js
@@ -1,6 +1,6 @@
 window.__CONFIG__ = {
   // url must NOT end with a slash
-  VITE_CORS_PROXY_URL: "",
+  VITE_CORS_PROXY_URL: "https://rough.isra.workers.dev",
   VITE_TMDB_API_KEY: "b030404650f279792a8d3287232358e3",
   VITE_OMDB_API_KEY: "aa0937c0",
 };
diff --git a/src/video/state/providers/videoStateProvider.ts b/src/video/state/providers/videoStateProvider.ts
index cd2aa6f2..8e100998 100644
--- a/src/video/state/providers/videoStateProvider.ts
+++ b/src/video/state/providers/videoStateProvider.ts
@@ -214,15 +214,17 @@ 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;
           }
-          state.interface.isPictureInPicture = true;
         } else {
           document.exitPictureInPicture();
           state.interface.isPictureInPicture = false;