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

@@ -34,27 +34,6 @@ export default function autoOrientation(art) {
}
});
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);
addClass($player, 'art-auto-orientation-fullscreen');
}
} else {
if (hasClass($player, 'art-auto-orientation-fullscreen')) {
await screen.orientation.lock?.(lastOrientation);
removeClass($player, 'art-auto-orientation-fullscreen');
}
}
});
return {
name: 'autoOrientation',
get state() {