JWPlayerViewController Overview (iOS)
Prepackaged user experience for iOS
JWPlayerViewController provides a customizable, prebuilt player interface for iOS, allowing you to display player controls without implementing your own interface.
Prerequisite
| Item | Description |
|---|---|
| JWPlayerKit 4.0.0+ | JWPlayerKit version required to use JWPlayerViewController |
Features
General
The following table lists the customizable native features of the JWPlayerViewController.
JWPlayerViewControllerprovides limited interface customization. For greater control or a simpler interface, useJWPlayerViewand assign your own delegates to the player.
| Topic | Features |
|---|---|
| Branding | Logo/Watermarks: Display a custom logo or watermark Skinning: Customize the player appearance |
| Cross-device streaming | AirPlay: Stream content to AirPlay-enabled devices Google Cast: Stream content to Cast devices using the Google Cast framework |
| Monetization | **Google DAI **, Google IMA: Monetize content with Google DAI and IMA ads (native customization not supported) VAST: Monetize content with VAST ads (native customization supported) |
| User experience | Fullscreen: Enter fullscreen mode by tapping the fullscreen button, rotating the device, or calling the appropriate method Lock screen controls: Enable or disable controls on the lock screen Playback rates: Define the playback rates available to viewers VoiceOver accessibility 4.28.0+: Customize accessibility labels and hints for playlist item titles and descriptions through |
| User interface | Poster Image: Displays the poster image for a player item before playback begins when Picture in Picture: Display or hide a Picture in Picture button Playlist button: Allow viewers to browse the playlist and select another media item |
| Video recommendations | Viewers can access configured recommendations from the playlist screen. Recommendations also appear at the end of a playlist or during the autoplay screen when enabled. |
Additional Features
Basic player interface
The player controls include the following:
- A centered play/pause button.
- 15-second rewind and fast-forward buttons.
Viewers can also double-tap the left or right side of the screen to seek 15 seconds backward or forward, respectively. This gesture works whether the controls are visible or not.
- When the current media item is part of a playlist, Previous and Next buttons.
- A language button that opens the available caption and audio options. In SDK 4.28.0 and later, the button is enabled when the content has captions or more than one audio track. Content with one audio track and no captions leaves the button disabled.
Player controls remain visible during audio-only content. For video content, the controls appear when the viewer taps the player and fade after three seconds by default. You can customize the fade time with the interfaceFadeTime property or use the interfaceBehavior property to keep the controls visible or hidden.
Accessing the player
You can access the JWPlayer instance through the player property. Use this property to call player methods such as play() and pause(), configure player properties, or query the player's state.
You can access the underlying JWPlayerView through the playerView property and use it to configure view-specific properties.
Listening for events
When using the player and playerView properties, you cannot set their delegate properties directly as you can with the JWPlayerView and JWPlayer base types. JWPlayerViewController is already assigned as the delegate for its player.
To listen for player events, subclass JWPlayerViewController and override the appropriate delegate methods. For information about available player delegate methods, see the delegates defined by JWPlayerView and JWPlayer.
When overriding a delegate method in your
JWPlayerViewControllersubclass, always call thesupermethod before your implementation, as shown in our documentation.
To receive view-controller-specific events, assign an object that conforms to the appropriate protocol to one of the following delegate properties.
| Property | Protocol | Events |
|---|---|---|
fullScreenDelegate | JWPlayerViewControllerFullScreenDelegate | Fullscreen transitions, including optional exit reasons in SDK 4.28.0 and later |
relatedDelegate | JWPlayerViewControllerRelatedDelegate | Related-content interactions |
uiDelegate | JWPlayerViewControllerUIDelegate | Player interface events |
For an example using the fullscreen delegate and exit reasons, see Enter and exit full screen (iOS).
Updated 2 days ago
