chore: Update screen.orientation.lock usage for autoOrientation plugin

This commit is contained in:
Harvey Zack committed 2024-06-01 07:11:53 +08:00
1 parent 574bb14643
commit d86840749b
3 files changed
+5 -5

No files matched your search

+3 -3
View File
@@ -242,7 +242,7 @@ class Artplayer extends (0, _emitterDefault.default) {
return "development";
}
static get build() {
return "2024-06-01 07:07:16";
return "2024-06-01 07:11:45";
}
static get config() {
return 0, _configDefault.default;
@@ -5107,11 +5107,11 @@ function autoOrientation(art) {
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);
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);
await screen.orientation.lock?.(lastOrientation);
(0, _utils.removeClass)($player, "art-auto-orientation-fullscreen");
}
});