# Fullscreen

ByteArk Player SDK for iOS presents fullscreen in one of two ways, selected with .fullscreenMode(_:) on ByteArkPlayerConfigBuilder.

# Fullscreen modes

Value Behavior
.rotate Force landscape and rotate the video to fill a landscape frame. This is the default.
.expand Fill the screen in place without rotating. Best for vertical (portrait) video.
let config = try ByteArkPlayerConfigBuilder(licenseKey: "<YOUR_LICENSE_KEY>")
  .item(item)
  .fullscreenMode(.expand) // portrait-capable fullscreen
  .build()
1
2
3
4

# Host app requirement for Rotate fullscreen

Rotate fullscreen requires your app to permit landscape. Declare application(_:supportedInterfaceOrientationsFor:) on your UIApplicationDelegate; the SDK widens it to landscape while fullscreen and restores your orientation on exit. This is required for SwiftUI apps using @UIApplicationDelegateAdaptor:

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(
        _ application: UIApplication,
        supportedInterfaceOrientationsFor window: UIWindow?
    ) -> UIInterfaceOrientationMask {
        .portrait // the SDK temporarily widens this to landscape while fullscreen
    }
}
1
2
3
4
5
6
7
8

In a pure SwiftUI app, attach it with @UIApplicationDelegateAdaptor(AppDelegate.self).

Note

If your app does not permit landscape (and has not declared the method above), the player falls back to Expand fullscreen instead of crashing, and logs a one-line warning explaining how to enable Rotate. .expand works regardless of your app's supported orientations.

// Toggle fullscreen programmatically
player.toggleFullscreen()
// Whether the player is currently fullscreen
let isFull: Bool = player.isFullscreen
1
2
3
4
5

Receive fullscreen events via the delegate:

override func playerEnterFullscreen(player: ByteArkPlayer) {
  super.playerEnterFullscreen(player: player)
  // Entered fullscreen
}
override func playerExitFullscreen(player: ByteArkPlayer) {
  super.playerExitFullscreen(player: player)
  // Exited fullscreen
}
1
2
3
4
5
6
7
8
9