Skip to content

Commit 1702d4d

Browse files
committed
Prevent linting issue for assigning new presentationMode on player (state)
1 parent 1b968ba commit 1702d4d

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

example/src/App.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ const playerConfig: PlayerConfiguration = {
9090
},
9191
};
9292

93+
function updatePresentationModeOnOrientationChange(player: THEOplayer, orientationType: string) {
94+
if (orientationType.startsWith('LANDSCAPE')) {
95+
player.presentationMode = PresentationMode.fullscreen;
96+
} else if (orientationType.startsWith('PORTRAIT')) {
97+
player.presentationMode = PresentationMode.inline;
98+
}
99+
}
100+
93101
/**
94102
* The example app demonstrates the use of the THEOplayerView with a custom UI using the provided UI components.
95103
* If you don't want to create a custom UI, you can just use the THEOplayerDefaultUi component instead.
@@ -112,13 +120,7 @@ export default function App() {
112120

113121
useDeviceOrientationChange((orientationType) => {
114122
if (player !== undefined && isPhone) {
115-
if (orientationType.startsWith('LANDSCAPE')) {
116-
player.presentationMode = PresentationMode.fullscreen;
117-
} else if (orientationType.startsWith('PORTRAIT')) {
118-
player.presentationMode = PresentationMode.inline;
119-
} else {
120-
// keep current presentationMode in other orientations (face up, face down, ...)
121-
}
123+
updatePresentationModeOnOrientationChange(player, orientationType);
122124
}
123125
});
124126

0 commit comments

Comments
 (0)