From 769a6dc632730c27332be80f750b1c7c6aa6a339 Mon Sep 17 00:00:00 2001 From: Nikita Krupin Date: Sat, 28 May 2022 18:04:35 -0400 Subject: [PATCH] fullscreen orientation fix --- NUXT/components/Player/fullscreen.vue | 7 +- NUXT/components/Player/index.vue | 67 ++++++------- NUXT/components/Player/loop.vue | 2 +- NUXT/components/Player/quality.vue | 7 +- NUXT/components/Player/seekbar.vue | 11 +-- NUXT/components/Player/speed.vue | 7 +- android/app/src/main/res/xml/config.xml | 4 + .../screenorientation/CDVOrientation.java | 98 +++++++++++++++++++ ios/App/App/config.xml | 4 + ios/App/Podfile | 1 + package.json | 2 + 11 files changed, 159 insertions(+), 51 deletions(-) create mode 100644 android/capacitor-cordova-android-plugins/src/main/java/cordova/plugins/screenorientation/CDVOrientation.java diff --git a/NUXT/components/Player/fullscreen.vue b/NUXT/components/Player/fullscreen.vue index 7ce07bf..b5e7155 100644 --- a/NUXT/components/Player/fullscreen.vue +++ b/NUXT/components/Player/fullscreen.vue @@ -11,7 +11,12 @@ diff --git a/NUXT/components/Player/index.vue b/NUXT/components/Player/index.vue index 60fe2a3..e21f4db 100644 --- a/NUXT/components/Player/index.vue +++ b/NUXT/components/Player/index.vue @@ -26,7 +26,6 @@ : 'filter: none; object-fit: cover' " /> - - + @@ -130,48 +134,33 @@ export default { }, methods: { handleFullscreenChange() { - console.log(this.$refs.player); - console.log(document.fullscreenElement); + // close fullscreen 👇 if (document?.fullscreenElement === this.$refs.vidcontainer) { - // const cancellFullScreen = - // document.exitFullscreen || - // document.mozCancelFullScreen || - // document.webkitExitFullscreen || - // document.msExitFullscreen; - // cancellFullScreen.call(document); - if (document.exitFullscreen) { - document.exitFullscreen(); - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen(); - } else if (document.webkitExitFullscreen) { - document.webkitExitFullscreen(); - } - this.isFullscreen = false; - this.$vuetube.statusBar.show(); + const cancellFullScreen = + document.exitFullscreen || + document.mozCancelFullScreen || + document.webkitExitFullscreen || + document.msExitFullscreen; + cancellFullScreen.call(document); + screen.orientation.lock("portrait"); + screen.orientation.unlock(); this.$vuetube.navigationBar.show(); + this.$vuetube.statusBar.show(); + this.isFullscreen = false; + // open fullscreen 👇 } else { - // const element = document; - // const requestFullScreen = - // element.requestFullscreen || - // element.webkitRequestFullScreen || - // element.mozRequestFullScreen || - // element.msRequestFullScreen; - // requestFullScreen.call(element); - this.$refs.vidcontainer.requestFullscreen({ - requireOrientation: "landscape", - }); - this.isFullscreen = true; - this.$vuetube.statusBar.hide(); + const element = this.$refs.vidcontainer; + const requestFullScreen = + element.requestFullscreen || + element.webkitRequestFullScreen || + element.mozRequestFullScreen || + element.msRequestFullScreen; + requestFullScreen.call(element); + screen.orientation.lock("landscape"); this.$vuetube.navigationBar.hide(); + this.$vuetube.statusBar.hide(); + this.isFullscreen = true; } - // screen.orientation - // .lock("landscape") - // .then(function () { - // console.log("Locked"); - // }) - // .catch(function (error) { - // console.log(error); - // }); }, getPlayer() { return this.$refs.player; diff --git a/NUXT/components/Player/loop.vue b/NUXT/components/Player/loop.vue index 563b9c4..930c489 100644 --- a/NUXT/components/Player/loop.vue +++ b/NUXT/components/Player/loop.vue @@ -1,5 +1,5 @@ diff --git a/NUXT/components/Player/quality.vue b/NUXT/components/Player/quality.vue index 7edf15a..c16e4ff 100644 --- a/NUXT/components/Player/quality.vue +++ b/NUXT/components/Player/quality.vue @@ -1,5 +1,10 @@ diff --git a/NUXT/components/Player/seekbar.vue b/NUXT/components/Player/seekbar.vue index eb6147a..34518bc 100644 --- a/NUXT/components/Player/seekbar.vue +++ b/NUXT/components/Player/seekbar.vue @@ -23,13 +23,8 @@ hide-details height="2" dense - style=" - position: absolute; - z-index: 69420; - width: 100%; - bottom: 0; - left: 0; - " + style="position: absolute; z-index: 69420; width: 100%; left: 0" + :style="fullscreen ? 'bottom: 5rem;' : 'bottom: 0;'" :thumb-size="0" :max="duration" :value="progress" @@ -63,7 +58,7 @@