chore: Remove screen.orientation.lock functionality due to compatibility issues

This commit is contained in:
Harvey Zack committed 2024-06-01 07:19:03 +08:00
1 parent d86840749b
commit 34b7018e3d
8 files changed
+7 -42

No files matched your search

+1 -16
View File
@@ -242,7 +242,7 @@ class Artplayer extends (0, _emitterDefault.default) {
return "development";
}
static get build() {
return "2024-06-01 07:11:45";
return "2024-06-01 07:16:48";
}
static get config() {
return 0, _configDefault.default;
@@ -5100,21 +5100,6 @@ function autoOrientation(art) {
art.emit("resize");
}
});
art.on("fullscreen", async (state)=>{
const lastOrientation = screen.orientation.type;
if (state) {
const { videoWidth, videoHeight } = $video;
const { clientWidth: viewWidth, clientHeight: viewHeight } = document.documentElement;
if (videoWidth > videoHeight && viewWidth < viewHeight || videoWidth < videoHeight && viewWidth > viewHeight) {
const oppositeOrientation = lastOrientation.startsWith("portrait") ? "landscape" : "portrait";
await screen.orientation.lock?.(oppositeOrientation);
(0, _utils.addClass)($player, "art-auto-orientation-fullscreen");
}
} else if ((0, _utils.hasClass)($player, "art-auto-orientation-fullscreen")) {
await screen.orientation.lock?.(lastOrientation);
(0, _utils.removeClass)($player, "art-auto-orientation-fullscreen");
}
});
return {
name: "autoOrientation",
get state () {