Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(FEC-10486): Lock orientation according to screenLockOrientionMode config when switching to full screen #499

Merged
merged 17 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion flow-typed/types/playback-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ declare type PKPlaybackConfigObject = {
streamPriority: Array<PKStreamPriorityObject>,
preferNative: PKPreferNativeConfigObject,
inBrowserFullscreen: boolean,
playAdsWithMSE: boolean
playAdsWithMSE: boolean,
disableFullScreenOrientation: boolean
};
17 changes: 15 additions & 2 deletions src/fullscreen/fullscreen-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,14 @@ class FullscreenController {
this._player.exitPictureInPicture();
}
Promise.resolve(this._nativeEnterFullScreen(fullScreenElement)).then(
() => (this._isInFullscreen = true),
() => {
this._isInFullscreen = true;
const screenOrientation = screen && screen.orientation && typeof screen.orientation.lock === 'function';
Yuvalke marked this conversation as resolved.
Show resolved Hide resolved
const playbackConfig = this._player.config.playback;
if (screenOrientation && !playbackConfig.disableFullScreenOrientation) {
screen.orientation.lock('landscape');
Yuvalke marked this conversation as resolved.
Show resolved Hide resolved
}
},
() => {}
);
}
Expand Down Expand Up @@ -195,7 +202,13 @@ class FullscreenController {
*/
_requestExitFullscreen(): void {
Promise.resolve(this._nativeExitFullScreen()).then(
() => (this._isInFullscreen = false),
() => {
this._isInFullscreen = false;
const screenOrientation = screen && screen.orientation && typeof screen.orientation.lock === 'function';
Yuvalke marked this conversation as resolved.
Show resolved Hide resolved
Yuvalke marked this conversation as resolved.
Show resolved Hide resolved
if (screenOrientation) {
screen.orientation.unlock();
}
},
() => {}
);
}
Expand Down
1 change: 1 addition & 0 deletions src/player-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const DefaultConfig = {
dash: false
},
inBrowserFullscreen: false,
disableFullScreenOrientation: false,
playAdsWithMSE: false,
streamPriority: [
{
Expand Down