setDeviceOrientation
Sets the mini-app's screen orientation to portrait ('portrait') or landscape ('landscape'). Use for features that genuinely require a specific orientation — video players, games, maps.
Signature
import { setDeviceOrientation } from '@apps-in-toss/web-framework';
declare function setDeviceOrientation(options: {
type: 'portrait' | 'landscape';
}): Promise<void>;
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
options.type | 'portrait' | 'landscape' | ✓ | The orientation to lock to. 'portrait' is vertical, 'landscape' is horizontal. |
Returns
Promise<void>— resolves once the orientation request is delivered.- In the devtools mock, the Viewport tab orientation changes. If the panel has the orientation pinned to a fixed value (not
auto), the SDK call is ignored and a warning is logged.
Permission
No permission required.
Examples
Minimal
import { setDeviceOrientation } from '@apps-in-toss/web-framework';
await setDeviceOrientation({ type: 'landscape' });
Realistic — fullscreen video player
import { setDeviceOrientation } from '@apps-in-toss/web-framework';
import { useEffect } from 'react';
export function FullscreenVideoPlayer() {
useEffect(() => {
// Lock to landscape when the video player mounts.
setDeviceOrientation({ type: 'landscape' });
return () => {
// Restore portrait when leaving.
setDeviceOrientation({ type: 'portrait' });
};
}, []);
return <video src="/sample.mp4" controls />;
}
Try it live
Open the Navigation page in sdk-example and run the setDeviceOrientation card.
Related APIs
setScreenAwakeMode— prevent the screen from auto-dimming.setIosSwipeGestureEnabled— control the iOS edge-swipe back gesture.
Related guides
- Guides — Mini-app navigation flow patterns — mini-app entry/exit, opening external URLs, and screen-context (orientation, awake, secure) patterns.
External references
@apps-in-toss/web-framework— SDK package. The actual exports are re-exported from@apps-in-toss/web-bridge.