VLCKit

Instance Methods | Public Attributes | Properties | List of all members
VLCMediaPlayer Class Reference

`#import <VLCMediaPlayer.h>`

Inheritance diagram for VLCMediaPlayer:

## Instance Methods
(instancetype) | - initWithVideoView:
(instancetype) | - initWithVideoLayer:
(instancetype) | - initWithOptions:
(instancetype) | - initWithLibVLCInstance:andLibrary:
(void) | - setVideoView:
(void) | - setVideoLayer:
(void) | - saveVideoSnapshotAt:withWidth:andHeight:
(void) | - setDeinterlaceFilter:
(float framesPerSecond) | - __attribute__
(BOOL) | - openVideoSubTitlesFromFile:
(typedef) | - NS_ENUM
(int) | - addPlaybackSlave:type:enforce:
(void) | - previousChapter
(void) | - nextChapter
(int) | - numberOfChaptersForTitle:
(NSArray *) | - chaptersForTitleIndex:
(NSArray *) | - chapterDescriptionsOfTitle:
(NSUInteger countOfTitles) | - __attribute__
(NSArray *titles) | - __attribute__
(void) | - resetEqualizerFromProfile:
(CGFloat) | - frequencyOfBandAtIndex:
(void) | - setAmplification:forBand:
(CGFloat) | - amplificationOfBand:
(void) | - play
(void) | - pause
(void) | - stop
(void) | - gotoNextFrame
(void) | - fastForward
(void) | - fastForwardAtRate:
(void) | - rewind
(void) | - rewindAtRate:
(void) | - jumpBackward:
(void) | - jumpForward:
(void) | - extraShortJumpBackward
(void) | - extraShortJumpForward
(void) | - shortJumpBackward
(void) | - shortJumpForward
(void) | - mediumJumpBackward
(void) | - mediumJumpForward
(void) | - longJumpBackward
(void) | - longJumpForward
(void) | - performNavigationAction:
(BOOL) | - updateViewpoint:pitch:roll:fov:absolute:

## Public Attributes
NSString *const | VLCChapterDescriptionName
NSString *const | VLCChapterDescriptionTimeOffset
NSString *const | VLCChapterDescriptionDuration
NSString *const | VLCTitleDescriptionDuration
NSString *const | VLCTitleDescriptionIsMenu

## Properties
VLCLibrary * | libraryInstance
id< VLCMediaPlayerDelegate > | delegate
id | drawable
char * | videoAspectRatio
char * | videoCropGeometry
float | scaleFactor
BOOL | adjustFilterEnabled
float | contrast
float | brightness
float | hue
float | saturation
float | gamma
float | rate
VLCAudio * | audio
CGSize | videoSize
BOOL | hasVideoOut
VLCTime * | time
VLCTime * | remainingTime
int | currentVideoTrackIndex
NSArray * | videoTrackNames
NSArray * | videoTrackIndexes
int | numberOfVideoTracks
int | currentVideoSubTitleIndex
NSArray * | videoSubTitlesNames
NSArray * | videoSubTitlesIndexes
int | numberOfSubtitlesTracks
NSInteger | currentVideoSubTitleDelay
int | currentChapterIndex
int | currentTitleIndex
int | numberOfTitles
NSString *const | VLCTitleDescriptionName
NSArray * | titleDescriptions
int | indexOfLongestTitle
int | currentAudioTrackIndex
NSArray * | audioTrackNames
NSArray * | audioTrackIndexes
int | numberOfAudioTracks
int | audioChannel
NSInteger | currentAudioPlaybackDelay
NSArray * | equalizerProfiles
BOOL | equalizerEnabled
CGFloat | preAmplification
unsigned | numberOfBands
VLCMedia * | media
BOOL | playing
BOOL | willPlay
VLCMediaPlayerState | state
float | position
BOOL | seekable
BOOL | canPause

## Detailed Description

The player base class needed to do any playback

## Method Documentation

## ◆ __attribute__() [1/3]

- (float framesPerSecond) __attribute__ |  | ((deprecated)) |  |

Frames per second

Deprecated:
  provided for API compatibility only, to retrieve a media's FPS, use VLCMediaTracksInformationFrameRate.

Returns
  0

Implemented in VLCStreamSession, VLCStreamSession, and VLCStreamSession.

## ◆ __attribute__() [2/3]

- (NSUInteger countOfTitles) __attribute__ |  | ((deprecated)) |  |

count of titles

Deprecated:
  Use numberOfTitles instead

Implemented in VLCStreamSession, VLCStreamSession, and VLCStreamSession.

## ◆ __attribute__() [3/3]

- (NSArray* titles) __attribute__ |  | ((deprecated)) |  |

array of available titles

Deprecated:
  Use titleDescriptions instead

Implemented in VLCStreamSession, VLCStreamSession, and VLCStreamSession.

## ◆ addPlaybackSlave:type:enforce:()

- (int) addPlaybackSlave: |  | (NSURL *) | slaveURL
type: |  | (VLCMediaPlaybackSlaveType) | slaveType
enforce: |  | (BOOL) | enforceSelection

Add additional input sources to a playing media item This way, you can add subtitles or audio files to an existing input stream For the user, it will appear as if they were part of the existing stream

Parameters

  slaveURL | of the content to be added
  slaveType | content type
  enforceSelection | switch to the added accessory content

## ◆ amplificationOfBand:()

- (CGFloat) amplificationOfBand: |  | (unsigned) | index |

amplification of band

Parameters

  index | of the band

Returns
  current amplification value (clamped to the -20.0 to +20.0 range)

## ◆ chapterDescriptionsOfTitle:()

- (NSArray *) chapterDescriptionsOfTitle: |  | (int) | titleIndex |

chapter descriptions an array of all chapters of the given title including information about chapter name, time offset and duration

Note
  if no title value is provided, information about the chapters of the current title is returned

Returns
  array describing the titles in details

See also
  VLCChapterDescriptionName
  VLCChapterDescriptionTimeOffset
  VLCChapterDescriptionDuration

## ◆ chaptersForTitleIndex:()

- (NSArray *) chaptersForTitleIndex: |  | ((deprecated)) | __attribute__ |

Chapters of a given title index

Deprecated:
  Use chapterDescriptionsOfTitle instead

## ◆ extraShortJumpBackward()

- (void) extraShortJumpBackward |  |  |

Jumps shortly backward in current stream if seeking is supported.

## ◆ extraShortJumpForward()

- (void) extraShortJumpForward |  |  |

Jumps shortly forward in current stream if seeking is supported.

## ◆ fastForward()

- (void) fastForward |  |  |

Fast forwards through the feed at the standard 1x rate.

## ◆ fastForwardAtRate:()

- (void) fastForwardAtRate: |  | (float) | rate |

Fast forwards through the feed at the rate specified.

Parameters

  rate | Rate at which the feed should be fast forwarded.

## ◆ frequencyOfBandAtIndex:()

- (CGFloat) frequencyOfBandAtIndex: |  | (unsigned) | index |

frequency of equalizer band

Parameters

  index | the band index

Returns
  frequency of the requested equalizer band

## ◆ gotoNextFrame()

- (void) gotoNextFrame |  |  |

Advance one frame.

## ◆ initWithLibVLCInstance:andLibrary:()

- (instancetype) initWithLibVLCInstance: |  | (void *) | playerInstance
andLibrary: |  | (VLCLibrary *) | library

initialize player with a certain libvlc instance and VLCLibrary

Parameters

  playerInstance | the libvlc instance
  library | the library instance

Note
  This is an advanced initializer for very specialized environments

## ◆ initWithOptions:()

- (instancetype) initWithOptions: |  | (NSArray *) | options |

initialize player with a given set of options

Parameters

  options | an array of private options

Note
  This will allocate a new libvlc and VLCLibrary instance, which will have a memory impact

## ◆ initWithVideoLayer:()

- (instancetype) initWithVideoLayer: |  | (VLCVideoLayer *) | aVideoLayer |

initialize player with a given video layer

Parameters

  aVideoLayer | an instance of VLCVideoLayer

Note
  This initializer is for macOS only

## ◆ initWithVideoView:()

- (instancetype) initWithVideoView: |  | (VLCVideoView *) | aVideoView |

initialize player with a given video view

Parameters

  aVideoView | an instance of VLCVideoView

Note
  This initializer is for macOS only

## ◆ jumpBackward:()

- (void) jumpBackward: |  | (int) | interval |

Jumps shortly backward in current stream if seeking is supported.

Parameters

  interval | to skip, in sec.

## ◆ jumpForward:()

- (void) jumpForward: |  | (int) | interval |

Jumps shortly forward in current stream if seeking is supported.

Parameters

  interval | to skip, in sec.

## ◆ longJumpBackward()

- (void) longJumpBackward |  |  |

Jumps shortly backward in current stream if seeking is supported.

## ◆ longJumpForward()

- (void) longJumpForward |  |  |

Jumps shortly forward in current stream if seeking is supported.

## ◆ mediumJumpBackward()

- (void) mediumJumpBackward |  |  |

Jumps shortly backward in current stream if seeking is supported.

## ◆ mediumJumpForward()

- (void) mediumJumpForward |  |  |

Jumps shortly forward in current stream if seeking is supported.

## ◆ nextChapter()

- (void) nextChapter |  |  |

switch to the next chapter

## ◆ NS_ENUM()

- (typedef) NS_ENUM |  | (unsigned) |
|  | (VLCMediaPlaybackSlaveType) |

VLCMediaPlaybackNavigationAction describes actions which can be performed to navigate an interactive title

## ◆ numberOfChaptersForTitle:()

- (int) numberOfChaptersForTitle: |  | (int) | titleIndex |

returns the number of chapters for a given title

Parameters

  titleIndex | the index of the title you are requesting the chapters for

## ◆ openVideoSubTitlesFromFile:()

- (BOOL) openVideoSubTitlesFromFile: |  | ((deprecated)) | __attribute__ |

Load and set a specific video subtitle, from a file.

Deprecated:
  use addPlaybackSlave:type:enforce: instead

## ◆ pause()

- (void) pause |  |  |

Set the pause state of the feed. Do nothing if already paused.

## ◆ performNavigationAction:()

- (void) performNavigationAction: |  | (VLCMediaPlaybackNavigationAction) | action |

performs navigation actions on interactive titles

## ◆ play()

- (void) play |  |  |

Plays a media resource using the currently selected media controller (or default controller. If feed was paused then the feed resumes at the position it was paused in.

## ◆ previousChapter()

- (void) previousChapter |  |  |

switch to the previous chapter

## ◆ resetEqualizerFromProfile:()

- (void) resetEqualizerFromProfile: |  | (unsigned) | profile |

Re-set the equalizer to a profile retrieved from the list

Note
  This doesn't enable the Equalizer automagically

## ◆ rewind()

- (void) rewind |  |  |

Rewinds through the feed at the standard 1x rate.

## ◆ rewindAtRate:()

- (void) rewindAtRate: |  | (float) | rate |

Rewinds through the feed at the rate specified.

Parameters

  rate | Rate at which the feed should be fast rewound.

## ◆ saveVideoSnapshotAt:withWidth:andHeight:()

- (void) saveVideoSnapshotAt: |  | (NSString *) | path
withWidth: |  | (int) | width
andHeight: |  | (int) | height

Take a snapshot of the current video.

If width AND height is 0, original size is used. If width OR height is 0, original aspect-ratio is preserved.

Parameters

  path | the path where to save the screenshot to
  width | the snapshot's width
  height | the snapshot's height

## ◆ setAmplification:forBand:()

- (void) setAmplification: |  | (CGFloat) | amplification
forBand: |  | (unsigned) | index

set amplification for band

Parameters

  amplification | value (clamped to the -20.0 to +20.0 range)
  index | of the respective band

## ◆ setDeinterlaceFilter:()

- (void) setDeinterlaceFilter: |  | (NSString *) | name |

Enable or disable deinterlace filter

Parameters

  name | of deinterlace filter to use (availability depends on underlying VLC version), NULL to disable.

## ◆ setVideoLayer:()

- (void) setVideoLayer: |  | (VLCVideoLayer *) | aVideoLayer |

set a video layer for rendering

Parameters

  aVideoLayer | instance of VLCVideoLayer

Note
  This setter is macOS only

## ◆ setVideoView:()

- (void) setVideoView: |  | (VLCVideoView *) | aVideoView |

set a video view for rendering

Parameters

  aVideoView | instance of VLCVideoView

Note
  This setter is macOS only

## ◆ shortJumpBackward()

- (void) shortJumpBackward |  |  |

Jumps shortly backward in current stream if seeking is supported.

## ◆ shortJumpForward()

- (void) shortJumpForward |  |  |

Jumps shortly forward in current stream if seeking is supported.

## ◆ stop()

- (void) stop |  |  |

Stop the playing.

## ◆ updateViewpoint:pitch:roll:fov:absolute:()

- (BOOL) updateViewpoint: |  | (CGFloat) | yaw
pitch: |  | (CGFloat) | pitch
roll: |  | (CGFloat) | roll
fov: |  | (CGFloat) | fov
absolute: |  | (BOOL) | absolute

Updates viewpoint with given values.

Parameters

  yaw | new yaw.
  pitch | new pitch.
  roll | new roll.
  fov | new field of view.
  absolute | if true replace the old viewpoint with the new one. If false, increase/decrease it.

Note
  This will create a viewpoint instance if not present.

## Member Data Documentation

## ◆ VLCChapterDescriptionDuration

- (NSString* const) VLCChapterDescriptionDuration

dictionary value for the chapter's duration

## ◆ VLCChapterDescriptionName

- (NSString* const) VLCChapterDescriptionName

dictionary value for the user-facing chapter name

## ◆ VLCChapterDescriptionTimeOffset

- (NSString* const) VLCChapterDescriptionTimeOffset

dictionary value for the chapter's time offset

## ◆ VLCTitleDescriptionDuration

- (NSString* const) VLCTitleDescriptionDuration

dictionary value for the title's duration

## ◆ VLCTitleDescriptionIsMenu

- (NSString* const) VLCTitleDescriptionIsMenu

dictionary value whether the title is a menu or not

## Property Documentation

## ◆ adjustFilterEnabled

- (BOOL) adjustFilterEnabled
| read write nonatomic assign

Enable or disable adjust video filter (contrast, brightness, hue, saturation, gamma)

Returns
  bool value

## ◆ audio

- (VLCAudio*) audio
| read nonatomic weak

an audio controller object

Returns
  instance of VLCAudio

## ◆ audioChannel

- (int) audioChannel
| read write atomic assign

sets / returns the current audio channel

Returns
  the currently set audio channel

## ◆ audioTrackIndexes

- (NSArray*) audioTrackIndexes
| read atomic copy

Returns the audio track IDs those are needed to set the video index

## ◆ audioTrackNames

- (NSArray*) audioTrackNames
| read atomic copy

Returns the audio track names, usually a language name or a description It includes the "Disabled" fake track at index 0.

## ◆ brightness

- (float) brightness
| read write nonatomic assign

Set/Get the adjust filter's brightness value

Returns
  float value (range: 0-2, default: 1.0)

## ◆ canPause

- (BOOL) canPause
| read atomic assign

property whether the currently playing media can be paused (or not)

Returns
  BOOL value

## ◆ contrast

- (float) contrast
| read write nonatomic assign

Set/Get the adjust filter's contrast value

Returns
  float value (range: 0-2, default: 1.0)

## ◆ currentAudioPlaybackDelay

- (NSInteger) currentAudioPlaybackDelay
| read write atomic assign

Get the current audio delay. Positive values means audio is delayed further, negative values less.

Returns
  time (in microseconds) the audio playback is being delayed

## ◆ currentAudioTrackIndex

- (int) currentAudioTrackIndex
| read write atomic assign

Return the current audio track index

Returns
  0 if none is set.

Pass -1 to disable.

## ◆ currentChapterIndex

- (int) currentChapterIndex
| read write atomic assign

Chapter selection and enumeration, it is bound to a title option. Return the current chapter index, or

Returns
  NSNotFound if none is set.

## ◆ currentTitleIndex

- (int) currentTitleIndex
| read write atomic assign

Title selection and enumeration

Returns
  NSNotFound if none is set.

## ◆ currentVideoSubTitleDelay

- (NSInteger) currentVideoSubTitleDelay
| read write atomic assign

Get the current subtitle delay. Positive values means subtitles are being displayed later, negative values earlier.

Returns
  time (in microseconds) the display of subtitles is being delayed

## ◆ currentVideoSubTitleIndex

- (int) currentVideoSubTitleIndex
| read write atomic assign

Return the current video subtitle index

Returns
  0 if none is set.

Pass -1 to disable.

## ◆ currentVideoTrackIndex

- (int) currentVideoTrackIndex
| read write atomic assign

Return the current video track index

Returns
  0 if none is set.

Pass -1 to disable.

## ◆ delegate

- (id<VLCMediaPlayerDelegate>) delegate
| read write nonatomic weak

the delegate object implementing the optional protocol

## ◆ drawable

- (id) drawable
| read write atomic strong

set/retrieve a video view for rendering This can be any UIView or NSView or instances of VLCVideoView / VLCVideoLayer if running on macOS

## ◆ equalizerEnabled

- (BOOL) equalizerEnabled
| read write atomic assign

Toggle equalizer state param: bool value to enable/disable the equalizer

Returns
  current state

## ◆ equalizerProfiles

- (NSArray*) equalizerProfiles
| read atomic weak

Get a list of available equalizer profiles

Note
  Current versions do not allow the addition of further profiles so you need to handle this in your app.

Returns
  array of equalizer profiles

## ◆ gamma

- (float) gamma
| read write nonatomic assign

Set/Get the adjust filter's gamma value

Returns
  float value (range: 0-10, default: 1.0)

## ◆ hasVideoOut

- (BOOL) hasVideoOut
| read atomic assign

Does the current media have a video output?

Note
  a false return value doesn't mean that the video doesn't have any video
  tracks. Those might just be disabled.

Returns
  current video output status

## ◆ hue

- (float) hue
| read write nonatomic assign

Set/Get the adjust filter's hue value

Returns
  float value (range: -180-180, default: 0.)

## ◆ indexOfLongestTitle

- (int) indexOfLongestTitle
| read atomic assign

the title with the longest duration

Returns
  int matching the title index

## ◆ libraryInstance

- (VLCLibrary*) libraryInstance
| read nonatomic assign

the library instance in use by the player instance

## ◆ media

- (VLCMedia*) media
| read write atomic strong

The currently media instance set to play

## ◆ numberOfAudioTracks

- (int) numberOfAudioTracks
| read atomic assign

returns the number of audio tracks available in the current media

Returns
  number of tracks

## ◆ numberOfBands

- (unsigned) numberOfBands
| read atomic assign

Number of equalizer bands

Returns
  the number of equalizer bands available in the current release

## ◆ numberOfSubtitlesTracks

- (int) numberOfSubtitlesTracks
| read atomic assign

returns the number of SPU tracks available in the current media

Returns
  number of tracks

## ◆ numberOfTitles

- (int) numberOfTitles
| read atomic assign

number of titles available for the current media

Returns
  the number of titles

## ◆ numberOfVideoTracks

- (int) numberOfVideoTracks
| read atomic assign

returns the number of video tracks available in the current media

Returns
  number of tracks

## ◆ playing

- (BOOL) playing
| read atomic assign

Playback state flag identifying that the stream is currently playing.

Returns
  TRUE if the feed is playing, FALSE if otherwise.

## ◆ position

- (float) position
| read write atomic assign

Returns the receiver's position in the reading.

Returns
  movie position as percentage between 0.0 and 1.0.

## ◆ preAmplification

- (CGFloat) preAmplification
| read write atomic assign

Set amplification level param: The supplied amplification value will be clamped to the -20.0 to +20.0 range.

Note
  this will create and enabled an Equalizer instance if not present

Returns
  current amplification level

## ◆ rate

- (float) rate
| read write nonatomic assign

Get the requested movie play rate.

Warning
  Depending on the underlying media, the requested rate may be different from the real playback rate. Due to limitations of some protocols this option may not be taken into account at all, if set.

Returns
  movie play rate

## ◆ remainingTime

- (VLCTime*) remainingTime
| read nonatomic weak

Returns the current position (or time) of the feed, inversed if a duration is available

Returns
  VLCTime object with requested time

Note
  VLCTime will be a nullTime if no duration can be calculated for the current input

## ◆ saturation

- (float) saturation
| read write nonatomic assign

Set/Get the adjust filter's saturation value

Returns
  float value (range: 0-3, default: 1.0)

## ◆ scaleFactor

- (float) scaleFactor
| read write nonatomic assign

Set/Get the current video scaling factor. That is the ratio of the number of pixels on screen to the number of pixels in the original decoded video in each dimension. Zero is a special value; it will adjust the video to the output window/drawable (in windowed mode) or the entire screen.

param: relative scale factor as float

## ◆ seekable

- (BOOL) seekable
| read atomic assign

Set movie position. This has no effect if playback is not enabled.

Note
  movie position as percentage between 0.0 and 1.0.

## ◆ state

- (VLCMediaPlayerState) state
| read atomic assign

Playback's current state.

See also
  VLCMediaState

## ◆ time

- (VLCTime*) time
| read write atomic strong

Sets the current position (or time) of the feed.

Parameters

  value | New time to set the current position to. If time is [VLCTime nullTime], 0 is assumed. Returns the current position (or time) of the feed.

Returns
  VLCTime object with current time.

## ◆ titleDescriptions

- (NSArray*) titleDescriptions
| read atomic copy

title descriptions an array of all titles of the current media including information of name, duration and potential menu state

Returns
  array describing the titles in details

See also
  VLCTitleDescriptionName
  VLCTitleDescriptionDuration
  VLCTitleDescriptionIsMenu

## ◆ videoAspectRatio

- (char*) videoAspectRatio
| read write atomic assign

Set/Get current video aspect ratio.

param: psz_aspect new video aspect-ratio or NULL to reset to default

Note
  Invalid aspect ratios are ignored.

Returns
  the video aspect ratio or NULL if unspecified (the result must be released with free()).

## ◆ videoCropGeometry

- (char*) videoCropGeometry
| read write atomic assign

Set/Get current crop filter geometry.

param: psz_geometry new crop filter geometry (NULL to unset)

Returns
  the crop filter geometry or NULL if unset

## ◆ videoSize

- (CGSize) videoSize
| read atomic assign

Get the current video size

Returns
  video size as CGSize

## ◆ videoSubTitlesIndexes

- (NSArray*) videoSubTitlesIndexes
| read atomic copy

Returns the video subtitle track IDs those are needed to set the video subtitle index

## ◆ videoSubTitlesNames

- (NSArray*) videoSubTitlesNames
| read atomic copy

Returns the video subtitle track names, usually a language name or a description It includes the "Disabled" fake track at index 0.

## ◆ videoTrackIndexes

- (NSArray*) videoTrackIndexes
| read atomic copy

Returns the video track IDs those are needed to set the video index

## ◆ videoTrackNames

- (NSArray*) videoTrackNames
| read atomic copy

Returns the video track names, usually a language name or a description It includes the "Disabled" fake track at index 0.

## ◆ VLCTitleDescriptionName

- (NSString* const) VLCTitleDescriptionName

dictionary value for the user-facing title name

## ◆ willPlay

- (BOOL) willPlay
| read atomic assign

Playback state flag identifying wheather the stream will play.

Returns
  TRUE if the feed is ready for playback, FALSE if otherwise.

The documentation for this class was generated from the following file:

- Headers/Public/VLCMediaPlayer.h