mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 20:21:20 -08:00
chore: Remove screen.orientation.lock functionality due to compatibility issues
This commit is contained in:
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() {
|
||||
|
||||
Reference in new issue
Block a user