JWPlayerViewController Overview (iOS)
A prepackaged user experience for iOS.
The JWPlayerViewController
is a customizable view controller that allows you to display user controls for a prepackaged video experience without having to implement your own interface.
Requirement
- JWPlayerKit 4.0.0+
Features
General
The following table lists the customizable native features of the JWPlayerViewController
.
This class does not allow for 100% customization. For more customization or a simpler interface, use
JWPlayerView
and assign your own delegates to the player.
Topic | Features |
---|---|
Branding | Logo/Watermarks: Add a unique logoto your app Skinning: Customize and define the player skin |
Cross-device streaming | AirPlay: Stream to iOS devices through clicking the AirPlay button Google Cast: Stream to Cast devices when linked with the Cast framework |
Monetization | Google DAI , Google IMA: Monetize content with Google DAI and IMA ads (native customization not supported) VAST: Monetize content with JWP VAST ads (native customization supported) |
User Experience | Fullscreen: Initiate fullscreen mode by tapping a button, rotating the device, triggering an event, or calling a method Lock screen controls: Enable or disable lock screen controls for content Playback rates: Define the available playback rates for your content |
User Interface | Poster Image: The poster image you specify for a player item will display at the beginning of a video unless autostart is set to true in the player config. This idle screen will wait until the user taps the play button. This poster image is also displayed during audio-only content.Picture in Picture: Display or hide a Picture in Picture button Playlist button: Playlist button that allows users to navigate through media and choose the next media to be played |
VideoΒ Recommendations | If your content has Recommendations, this can be accessed through the playlist screen. The Recommendations menu will also appear at the end of a playlist or during the autoplay screen, if set up in your configuration. |
Additional Features
Basic Player Interface
The interface comes with a centered play/pause button and fast-forward/rewind buttons (15 seconds). If the currently playing media is part of a playlist there are also centered next/previous buttons. These do not appear unless you are viewing a playlist.
The interface will stay on during audio-only content, but by default the interface will only appear when the user taps it. It will fade after three seconds, but this can be customized by setting the interfaceFadeTime
property. The interface can also be set to always show or always hide using the interfaceBehavior
property.
Another feature related to seeking is double tapping the left or right side of the screen. With or without the controls on the screen, this will trigger a rewind 15 seconds or fast forward 15 seconds event.
Accessing the Player
You have full access to the JWPlayer
object through the player
property. If you wish to call methods on the player directly, such as play()
, pause()
, setting other properties or querying the state of the player, use this property.
You also have full access to the JWPlayerView
through the playerView
property. You can set its properties by using this.
Listening for Events
When using the player
and playerView
properties you will notice they differ from the JWPlayerView
and JWPlayer
base types in that they do not allow you to set the delegate properties. JWPlayerViewController
conforms to every delegate, and is already the assigned delegate for its player.
In order to listen for events, you need to subclass JWPlayerViewController
. This allows you to override any delegate methods. Please refer to the delegates listed in JWPlayerView and JWPlayer for more information on the delegates and their methods.
When you override a delegate method in your
JWPlayerViewController
subclass, always call thesuper
method before your implementation, as in the snippets presented here in our documentation.
In addition, the JWPlayerViewController
itself has a delegate property which takes a JWPlayerViewControllerDelegate
. Conforming to this delegate allows you to listen for view controller-specific events, such as the following:
- Fullscreen state
- Related and Recommended item state and choices
- Player size changes
- Screen taps
Updated about 1 year ago