What Problem Does This Solve?
Mobile users hold their devices in portrait (vertical) or landscape (horizontal) orientation. Social media platforms like Instagram Stories, TikTok, and YouTube Shorts expect vertical video (9:16), while traditional YouTube prefers horizontal (16:9).LckCameraOrientation lets you set the output orientation to match how users hold their device or the platform they’re targeting.
When to Use This
UseLckCameraOrientation when:
- Building a mobile app with recording/streaming
- Supporting social media uploads (TikTok, Instagram, Snapchat)
- Users can rotate their device during gameplay
- Creating platform-specific content (vertical for Stories, horizontal for YouTube)
Quick Example
How It Works
Camera orientation determines the aspect ratio of the output video: Portrait (Vertical)- Aspect ratio: 9:16 (e.g., 1080×1920)
- Matches vertical phone orientation
- Best for: TikTok, Instagram Stories, Snapchat, Reels
- Aspect ratio: 16:9 (e.g., 1920×1080)
- Matches horizontal phone orientation
- Best for: YouTube, traditional video platforms
The orientation affects how the resolution is interpreted. A
CameraResolutionDescriptor(1080, 1920) in portrait mode outputs vertical video, while landscape swaps it to 1920×1080.Common Patterns
Auto-detect device orientation
Platform-specific orientation
UI toggle
Resolution by Orientation
Portrait (9:16)Platform Orientation Guidelines
Enum Values
API Reference
Set Orientation
orientation—PortraitorLandscape
LckResult indicating success/failure
Best Practices
Match target platform — Use portrait for TikTok, landscape for YouTube
Set before recording — Orientation should be configured before starting capture
Test both modes — Ensure your UI works in both orientations
Good Pattern
Mobile Development Tips
Lock orientation in Unity
Handle safe areas
Related
- CameraResolutionDescriptor — Set output resolution
- QualityOption — Quality presets with resolution