Skip to content

Commit

Permalink
fix: Fix screen unlocking on Safari
Browse files Browse the repository at this point in the history
screen.orientation.unlock is not defined on Safari, even though
screen.orientation is. This change checks for the presence of
that function before calling it.

Fixes shaka-project#5437
  • Loading branch information
theodab committed Jul 25, 2023
1 parent d6d5b15 commit f8dc029
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,9 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
/** @private */
async exitFullScreen_() {
if (document.fullscreenEnabled) {
if (screen.orientation) {
// There are some platforms (e.g. Safari) where screen.orientation does
// not have the "unlock" method.
if (screen.orientation && screen.orientation.unlock !== undefined) {
screen.orientation.unlock();
}
await document.exitFullscreen();
Expand Down

0 comments on commit f8dc029

Please sign in to comment.