Getting Started
이 플러그인의 설치 단계와 전체 마크다운 가이드를 포함하여 __CAPGO_KEEP_0__를 복사할 수 있습니다.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-screen-orientation`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/screen-orientation/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
__CAPGO_KEEP_0__: 설치 단계입니다.
__CAPGO_KEEP_0__bun add @capgo/capacitor-screen-orientationbunx cap syncimport { ScreenOrientation } from '@capgo/capacitor-screen-orientation';API 개요
API 개요 제목의 섹션orientation
‘방향’ 제목의 섹션화면의 현재 방향을 가져옵니다.
화면의 기기 화면의 현재 방향을 반환합니다.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
const result = await ScreenOrientation.orientation();console.log('Current orientation:', result.type);lock
‘잠금’ 제목의 섹션__CAPGO_KEEP_0__ 방향을 특정 유형으로 고정합니다.
__CAPGO_KEEP_0__를 지정된 방향으로 고정합니다. iOS에서 bypassOrientationLock이 true일 경우, motion sensors를 사용하여 물리적 장치 방향을 추적하기 시작합니다.
주의: 사용자 UI 방향 잠금 설정을 존중합니다. 물리적 장치 방향을 감지하기 위해 motion tracking을 사용할 수 있습니다. UI가 회전하지 않아도 장치가 물리적으로 어떤 방향으로 잡혀 있는지 감지할 수 있습니다.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
// Standard lockawait ScreenOrientation.lock({ orientation: 'landscape' });
// Lock with motion tracking on iOSawait ScreenOrientation.lock({ orientation: 'portrait', bypassOrientationLock: true});__CAPGO_KEEP_1__ 방향을 해제합니다.
__CAPGO_KEEP_0__를 장치 위치에 따라 자유롭게 회전합니다. 또한 motion-based orientation tracking을 중단합니다.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.unlock();startOrientationTracking
‘__CAPGO_KEEP_2__’ 제목의 섹션__CAPGO_KEEP_2__를 사용하여 장치 방향을 motion sensors를 사용하여 추적합니다.
이 메서드는 화면 방향 잠금과 독립적으로 장치 물리적 방향을 추적하고 싶을 때 유용합니다. iOS에서 Core Motion을 사용하여 방향 변경을 감지합니다.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.startOrientationTracking({ bypassOrientationLock: true});
// Listen for changesScreenOrientation.addListener('screenOrientationChange', (result) => { console.log('Orientation changed:', result.type);});stopOrientationTracking
Section titled “stopOrientationTracking”장치 방향 추적을 사용하는 운동 센서를 중지합니다.
운동 기반 방향 추적이 시작된 경우 운동 센서를 중지합니다.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.stopOrientationTracking();isOrientationLocked
Section titled “isOrientationLocked”장치 방향 잠금이 현재 활성화되어 있는지 확인합니다.
이 메서드는 물리 장치 방향 (운동 센서에서) UI 방향과 비교합니다. 그들이 다르면 방향 잠금이 활성화됩니다.
주의: 이 메서드는 startOrientationTracking() 또는 lock()을 사용하여 bypassOrientationLock: true를 활성화해야 합니다. iOS (Core Motion)와 Android (Accelerometer) 모두에서 작동합니다.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
// Start motion tracking firstawait ScreenOrientation.startOrientationTracking({ bypassOrientationLock: true});
// Check lock statusconst status = await ScreenOrientation.isOrientationLocked();if (status.locked) { console.log('Orientation lock is ON'); console.log('Physical:', status.physicalOrientation); console.log('UI:', status.uiOrientation);}ScreenOrientationResult
Section titled “ScreenOrientationResult”__CAPGO_KEEP_0__
export interface ScreenOrientationResult { /** * The current orientation type. * * @since 1.0.0 */ type: OrientationType;}OrientationLockOptions
__CAPGO_KEEP_2____CAPGO_KEEP_3__
export interface OrientationLockOptions { /** * The orientation type to lock to. * * @since 1.0.0 */ orientation: OrientationLockType;
/** * Whether to track physical device orientation using motion sensors. * When true, uses device motion sensors to detect the true physical * orientation of the device, even when the device orientation lock is enabled. * * **Important:** This does NOT bypass the UI orientation lock. * The screen will still respect the user's orientation lock setting. * This option only affects orientation detection/tracking - you'll receive * orientation change events based on how the device is physically held, * but the UI will not rotate if orientation lock is enabled. * * Supported on iOS (Core Motion) and Android (Accelerometer). * * @default false * @since 1.0.0 */ bypassOrientationLock?: boolean;}StartOrientationTrackingOptions
__CAPGO_KEEP_4____CAPGO_KEEP_5__
export interface StartOrientationTrackingOptions { /** * Whether to track physical device orientation using motion sensors. * When true, uses device motion sensors to detect the true physical * orientation of the device, even when the device orientation lock is enabled. * * **Important:** This does NOT bypass the UI orientation lock. * This only enables detection of the physical orientation. * * Supported on iOS (Core Motion) and Android (Accelerometer). * * @default false * @since 1.0.0 */ bypassOrientationLock?: boolean;}OrientationLockStatusResult
__CAPGO_KEEP_6____CAPGO_KEEP_1__
export interface OrientationLockStatusResult { /** * Whether the device orientation lock is currently enabled. * * This is determined by comparing the physical device orientation * (from motion sensors) with the UI orientation. If they differ, * orientation lock is enabled. * * Available on iOS (Core Motion) and Android (Accelerometer) when motion tracking is active. * * @since 1.0.0 */ locked: boolean;
/** * The physical orientation of the device from motion sensors. * Available when motion tracking is active (iOS and Android). * * @since 1.0.0 */ physicalOrientation?: OrientationType;
/** * The current UI orientation reported by the system. * * @since 1.0.0 */ uiOrientation: OrientationType;}OrientationType
__CAPGO_KEEP_1__장치의 방향 상태를 설명하는 방향 타입.
export type OrientationType = 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';OrientationLockType
방향LockType장치 방향을 잠그기 위해 사용할 수 있는 방향 잠금 타입.
export type OrientationLockType = | 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';진실의 원천
이 페이지는 플러그인의__CAPGO_KEEP_0__의 공개 버전이 업스트림에서 변경될 때 다시 싱크를 실행하세요. src/definitions.ts. Re-run the sync when the public API changes upstream.
장치 방향을 잠그기 위해 사용할 수 있는 방향 잠금 타입.
클립보드에 복사이 페이지는 플러그인의 Getting Started 자연스러운 미디어 및 인터페이스 동작을 계획하기 위해 연결하세요. capgo/capacitor-스크린 방향 설정 사용 capgo/capacitor-스크린 방향 설정 사용의 원천 기능 capgo/capacitor-라이브 활동 capgo/capacitor-라이브 활동의 원천 기능 capgo/capacitor-라이브 활동 capgo/capacitor-라이브 활동의 구현 세부 사항 capgo/capacitor-비디오 플레이어 사용 capgo/capacitor-비디오 플레이어 사용의 원천 기능 capgo/capacitor-비디오 플레이어 capgo/capacitor-비디오 플레이어의 구현 세부 사항