Guard unsupported web orientation methods
This commit is contained in:
@@ -139,15 +139,19 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
navigationUI: 'hide',
|
||||
});
|
||||
if (orientation === 'all' || !orientation || autorotate) {
|
||||
screen.orientation.unlock();
|
||||
} else {
|
||||
if (typeof screen.orientation?.unlock === 'function') {
|
||||
screen.orientation.unlock();
|
||||
}
|
||||
} else if (typeof screen.orientation?.lock === 'function') {
|
||||
await screen.orientation.lock(orientation);
|
||||
}
|
||||
} else {
|
||||
if (document.fullscreenElement) {
|
||||
await document.exitFullscreen();
|
||||
}
|
||||
screen.orientation.unlock();
|
||||
if (typeof screen.orientation?.unlock === 'function') {
|
||||
screen.orientation.unlock();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// Changing fullscreen status without a button click is not allowed so it throws.
|
||||
|
||||
Reference in New Issue
Block a user