TMSNativeAVPlayerViewController displays the video content of an
AVPlayer object along with system-supplied playback controls. When you use a player view controller, the system makes its media content available for the user to play on the screen of the playback device or on a second screen such as Apple TV. Starting in iOS 9, supported iPad models also provide Picture in Picture playback from a player view controller.
|InitializePlayback||Initializes audio, airplay and picture in picture (iOS 9) support.|
|Pause||Pauses the audio or video.|
|Play||Plays the audio or video.|
|Player||Returns a native reference to the
|PlayerViewController||Returns a native reference to the
|ReadyForDisplay: Boolean;||Returns a
|Stop||Stops playing the audio or video.|
|VideoBounds: TRectF;||Returns the current video rectangle used inside the
|Location||The location of the local video / audio file.|
|ShowInView||Shows the player in the view controller (default). When set to False, the player can be shown full screen when using the
|URL||The URL of the remove video / audio file.|
|VideoGravity||The aspect ratio of the video inside the view controller.|
|OnDidStartPictureInPicture||Event called when picture in picture is started.|
|OnDidStopPictureInPicture||Event called when picture in picture is stopped.|
|OnRestoreUserInterfaceForPictureInPictureStop||Event called when picture in picture is stopping and is restored to the original user interface.|
|OnShouldAutomaticallyDismissAtPictureAndPictureStart||Event called when picture in picture is starting and asks if the player view controller should automatically dismiss.|
|OnWillStartPictureInPicture||Event called when picture in picture will start.|
|OnWillStopPictureInPicture||Event called when picture in picture will stop.|
Picture in Picture (iOS 9)
To support picture in picture, there are 2 additional steps that need to be taken.
An additional entry is needed inside the plist. The
UIBackgroundModesproperty in the Project Options -> Version Info needs to contain the audio entry.
When building the application, the audio entry will be added and the application will then be able to support picture in picture playback mode.
Additionally, the audio/video session needs to be initialized with the playback category, needed to support picture in picture. The
TTMSFMXNativeAVPlayerViewControllerexposes a class function that needs to be called in the constructor of the form:
When these steps are successfully executed, the button in the right corner will allow you to display the video outside of the application as demonstrated in the following sample:
When closing the application, the player will remain on top. The left button in the picture in picture view will allow you to return to the application.