Instance Method

playerViewController(_:didSelect:in:)

Tells the delegate a user has selected a media option from a media selection group.

Declaration

optional func playerViewController(_ playerViewController: AVPlayerViewController, didSelect mediaSelectionOption: AVMediaSelectionOption?, in mediaSelectionGroup: AVMediaSelectionGroup)

Parameters

playerViewController

The player view controller to which this delegate is assigned.

mediaSelectionOption

The user’s selected media option. May be nil.

mediaSelectionGroup

The media selection group in which the mediaSelectionOption was selected.

Discussion

You can implement this delegate method to be notified when the user has selected a media option from a media selection group. The media selection option will be nil when subtitles are turned off.