VLCKit

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

`#import <VLCMedia.h>`

Inheritance diagram for VLCMedia:

## Public Types
enum | { VLCMediaParseLocal = 0x00, VLCMediaParseNetwork = 0x01, VLCMediaFetchLocal = 0x02, VLCMediaFetchNetwork = 0x04, VLCMediaDoInteract = 0x08 }
typedef int | VLCMediaParsingOptions

## Instance Methods
(instancetype) | - initWithURL:
(instancetype) | - initWithPath:
(instancetype) | - initWithStream:
(instancetype) | - initAsNodeWithName:
(typedef) | - NS_ENUM
(typedef) | - NS_ENUM
(typedef) | - NS_ENUM
(NSComparisonResult) | - compare:
(VLCTime *) | - lengthWaitUntilDate:
(BOOL isParsed) | - __attribute__
(typedef) | - NS_ENUM
(NSString *) | - metadataForKey:
(void) | - setMetadata:forKey:
((deprecated) | - __attribute__
((deprecated) | - __attribute__
(int) | - parseWithOptions:
(int) | - parseWithOptions:timeout:
(void) | - parseStop
(void) | - addOption:
(void) | - addOptions:
(int) | - storeCookie:forHost:path:
(void) | - clearStoredCookies

## Class Methods
(instancetype) | + mediaWithURL:
(instancetype) | + mediaWithPath:
(NSString *) | + codecNameForFourCC:trackType:
(instancetype) | + mediaAsNodeWithName:

## Public Attributes
NSString *const | VLCMediaTracksInformationCodec
NSString *const | VLCMediaTracksInformationId
NSString *const | VLCMediaTracksInformationType
NSString *const | VLCMediaTracksInformationCodecProfile
NSString *const | VLCMediaTracksInformationCodecLevel
NSString *const | VLCMediaTracksInformationBitrate
NSString *const | VLCMediaTracksInformationLanguage
NSString *const | VLCMediaTracksInformationDescription
NSString *const | VLCMediaTracksInformationAudioChannelsNumber
NSString *const | VLCMediaTracksInformationAudioRate
NSString *const | VLCMediaTracksInformationVideoHeight
NSString *const | VLCMediaTracksInformationVideoWidth
NSString *const | VLCMediaTracksInformationVideoOrientation
NSString *const | VLCMediaTracksInformationVideoProjection
NSString *const | VLCMediaTracksInformationSourceAspectRatio
NSString *const | VLCMediaTracksInformationSourceAspectRatioDenominator
NSString *const | VLCMediaTracksInformationFrameRate
NSString *const | VLCMediaTracksInformationFrameRateDenominator
NSString *const | VLCMediaTracksInformationTextEncoding
NSString *const | VLCMediaTracksInformationTypeAudio
NSString *const | VLCMediaTracksInformationTypeVideo
NSString *const | VLCMediaTracksInformationTypeText
NSString *const | VLCMediaTracksInformationTypeUnknown

## Properties
VLCMediaType | mediaType
id< VLCMediaDelegate > | delegate
VLCTime * | length
VLCMediaParsedStatus | parsedStatus
NSURL * | url
VLCMediaList * | subitems
BOOL | saveMetadata
NSDictionary * | metaDictionary
VLCMediaState | state
BOOL | mediaSizeSuitableForDevice
NSArray * | tracksInformation
NSDictionary * | stats
NSInteger | numberOfReadBytesOnInput
float | inputBitrate
NSInteger | numberOfReadBytesOnDemux
float | demuxBitrate
NSInteger | numberOfDecodedVideoBlocks
NSInteger | numberOfDecodedAudioBlocks
NSInteger | numberOfDisplayedPictures
NSInteger | numberOfLostPictures
NSInteger | numberOfPlayedAudioBuffers
NSInteger | numberOfLostAudioBuffers
NSInteger | numberOfSentPackets
NSInteger | numberOfSentBytes
float | streamOutputBitrate
NSInteger | numberOfCorruptedDataPackets
NSInteger | numberOfDiscontinuties

## Detailed Description

Defines files and streams as a managed object. Each media object can be administered seperately. VLCMediaPlayer or VLCMediaList must be used to execute the appropriate playback functions.

See also
  VLCMediaPlayer
  VLCMediaList

## Member Typedef Documentation

## ◆ VLCMediaParsingOptions

- (typedef int) VLCMediaParsingOptions

enum of available options for use with parseWithOptions

Note
  you may pipe multiple values for the single parameter

## Member Enumeration Documentation

## ◆ anonymous enum

- (anonymous) enum

Enumerator
VLCMediaParseLocal | Parse media if it's a local file.
VLCMediaParseNetwork | Parse media even if it's a network file.
VLCMediaFetchLocal | Fetch meta and covert art using local resources.
VLCMediaFetchNetwork | Fetch meta and covert art using network resources.
VLCMediaDoInteract | Interact with the user when preparsing this item (and not its sub items). Set this flag in order to receive a callback when the input is asking for credentials.

## Method Documentation

## ◆ __attribute__ [1/3]

- (BOOL isParsed) __attribute__ |  | ((deprecated)) |  |

Determines if the media has already been preparsed.

Deprecated:
  use parseStatus instead

## ◆ __attribute__ [2/3]

- ((deprecated) __attribute__ |  |  |

Start asynchronously to parse the media. This will attempt to fetch the meta data and tracks information.

This is automatically done when an accessor requiring parsing is called.

See also
  -[VLCMediaDelegate mediaDidFinishParsing:]

Deprecated:
  Use parseWithOptions: instead

## ◆ __attribute__ [3/3]

- ((deprecated) __attribute__ |  |  |

Trigger a synchronous parsing of the media the selector won't return until parsing finished

Deprecated:
  Use parseWithOptions: instead

## ◆ addOption:

- (void) addOption: |  | (NSString *) | option |

Add options to the media, that will be used to determine how VLCMediaPlayer will read the media. This allow to use VLC advanced reading/streaming options in a per-media basis

The options are detailed in vlc –long-help, for instance "--sout-all" And on the web: http://wiki.videolan.org/VLC_command-line_help

## ◆ clearStoredCookies

- (void) clearStoredCookies |  |  |

Clear the stored cookies of a media.

Note
  must be called before the first call of play() to take effect. The cookie jar is only used for http/https.

Warning
  This method will never succeed on macOS, but requires iOS or tvOS

## ◆ codecNameForFourCC:trackType:

+ (NSString *) codecNameForFourCC: |  | (uint32_t) | fourcc
trackType: |  | (NSString *) | trackType

convienience method to return a user-readable codec name for the given FourCC

Parameters

  fourcc | the FourCC to process
  trackType | a VLC track type if known to speed-up the name search

Returns
  a NSString containing the codec name if recognized, else an empty string

## ◆ compare:

- (NSComparisonResult) compare: |  | (VLCMedia *) | media |

Returns an NSComparisonResult value that indicates the lexical ordering of the receiver and a given meda.

Parameters

  media | The media with which to compare with the receiver.

Returns
  NSOrderedAscending if the URL of the receiver precedes media in lexical ordering, NSOrderedSame if the URL of the receiver and media are equivalent in lexical value, and NSOrderedDescending if the URL of the receiver follows media. If media is nil, returns NSOrderedDescending.

## ◆ initAsNodeWithName:

- (instancetype) initAsNodeWithName: |  | (NSString *) | aName |

TODO

Parameters

  aName | TODO

Returns
  A new VLCMedia object, only if there were no errors.

## ◆ initWithPath:

- (instancetype) initWithPath: |  | (NSString *) | aPath |

Initializes a new VLCMedia object to use the specified path.

Parameters

  aPath | Path to media to be accessed.

Returns
  A new VLCMedia object, only if there were no errors.

## ◆ initWithStream:

- (instancetype) initWithStream: |  | (NSInputStream *) | stream |

Initializes a new VLCMedia object to use an input stream.

Note
  By default, NSStream instances that are not file-based are non-seekable, you may subclass NSInputStream whose instances are capable of seeking through a stream. This subclass must allow setting NSStreamFileCurrentOffsetKey property.
  VLCMedia will open stream if it is not already opened, and will close eventually. You can't pass an already closed input stream.

Parameters

  stream | Input stream for media to be accessed.

Returns
  A new VLCMedia object, only if there were no errors.

## ◆ initWithURL:

- (instancetype) initWithURL: |  | (NSURL *) | anURL |

Initializes a new VLCMedia object to use the specified URL.

Parameters

  anURL | the URL to media to be accessed.

Returns
  A new VLCMedia object, only if there were no errors.

## ◆ lengthWaitUntilDate:

- (VLCTime *) lengthWaitUntilDate: |  | (NSDate *) | aDate |

Returns a VLCTime object describing the length of the media resource, however, this is a blocking operation and will wait until the preparsing is completed before returning anything.

Parameters

  aDate | Time for operation to wait until, if there are no results before specified date then nil is returned.

Returns
  The length of the media resource, nil if it couldn't wait for it.

## ◆ mediaAsNodeWithName:

+ (instancetype) mediaAsNodeWithName: |  | (NSString *) | aName |

TODO

Parameters

  aName | TODO

Returns
  a new VLCMedia object, only if there were no errors. This object will be automatically released.

See also
  initAsNodeWithName

## ◆ mediaWithPath:

+ (instancetype) mediaWithPath: |  | (NSString *) | aPath |

Manufactures a new VLCMedia object using the path specified.

Parameters

  aPath | Path to the media to be accessed.

Returns
  A new VLCMedia object, only if there were no errors. This object will be automatically released.

See also
  initWithPath

## ◆ mediaWithURL:

+ (instancetype) mediaWithURL: |  | (NSURL *) | anURL |

Manufactures a new VLCMedia object using the URL specified.

Parameters

  anURL | URL to media to be accessed.

Returns
  A new VLCMedia object, only if there were no errors. This object will be automatically released.

See also
  initWithMediaURL

## ◆ metadataForKey:

- (NSString *) metadataForKey: |  | (NSString *) | key |

get meta property for key

Note
  for performance reasons, fetching the metaDictionary will be faster!

See also
  metaDictionary
  dictionary keys above

## ◆ NS_ENUM [1/4]

- (typedef) NS_ENUM |  | (NSUInteger) |
|  | (VLCMediaOrientation) |

list of possible media orientation.

## ◆ NS_ENUM [2/4]

- (typedef) NS_ENUM |  | (NSUInteger) |
|  | (VLCMediaProjection) |

list of possible media projection.

## ◆ NS_ENUM [3/4]

- (typedef) NS_ENUM |  | (NSUInteger) |
|  | (VLCMediaType) |

list of possible media types that could be returned by "mediaType"

## ◆ NS_ENUM [4/4]

- (typedef) NS_ENUM |  | (unsigned) |
|  | (VLCMediaParsedStatus) |

list of possible parsed states returnable by parsedStatus

## ◆ parseStop

- (void) parseStop |  |  |

Stop the parsing of the media

When the media parsing is stopped, the mediaDidFinishParsing will be sent with the VLCMediaParsedStatusTimeout status.

## ◆ parseWithOptions:

- (int) parseWithOptions: |  | (VLCMediaParsingOptions) | options |

triggers an asynchronous parse of the media item using the given options

Parameters

  options | the option mask based on VLCMediaParsingOptions

See also
  VLCMediaParsingOptions

Returns
  an int. 0 on success, -1 in case of error

Note
  listen to the "parsed" key value or the mediaDidFinishParsing: delegate method to be notified about parsing results. Those triggers will NOT be raised if parsing fails and this method returns an error.

## ◆ parseWithOptions:timeout:

- (int) parseWithOptions: |  | (VLCMediaParsingOptions) | options
timeout: |  | (int) | timeoutValue

triggers an asynchronous parse of the media item using the given options

Parameters

  options | the option mask based on VLCMediaParsingOptions
  timeoutValue | a time-out value in milliseconds (-1 for default, 0 for infinite)

See also
  VLCMediaParsingOptions

Returns
  an int. 0 on success, -1 in case of error

Note
  listen to the "parsed" key value or the mediaDidFinishParsing: delegate method to be notified about parsing results. Those triggers will NOT be raised if parsing fails and this method returns an error.

## ◆ setMetadata:forKey:

- (void) setMetadata: |  | (NSString *) | data
forKey: |  | (NSString *) | key

set meta property for key

Parameters

  data | the metadata to set as NSString
  key | the metadata key

See also
  dictionary keys above

## ◆ storeCookie:forHost:path:

- (int) storeCookie: |  | (NSString *_Nonnull) | cookie
forHost: |  | (NSString *_Nonnull) | host
path: |  | (NSString *_Nonnull) | path

Parse a value of an incoming Set-Cookie header (see RFC 6265) and append the cookie to the stored cookies if appropriate. The "secure" attribute can be added to cookie to limit the scope of the cookie to secured channels (https).

Note
  must be called before the first call of play() to take effect. The cookie storage is only used for http/https.

Warning
  This method will never succeed on macOS, but requires iOS or tvOS

Parameters

  cookie | header field value of Set-Cookie: "name=value<;attributes>"
  host | host to which the cookie will be sent
  path | scope of the cookie

Returns
  0 on success, -1 on error.

## Member Data Documentation

## ◆ VLCMediaTracksInformationAudioChannelsNumber

- (NSString* const) VLCMediaTracksInformationAudioChannelsNumber

number of audio channels of a given track

Note
  returns the audio channel number as NSNumber

## ◆ VLCMediaTracksInformationAudioRate

- (NSString* const) VLCMediaTracksInformationAudioRate

audio rate

Note
  returns the audio rate as NSNumber

## ◆ VLCMediaTracksInformationBitrate

- (NSString* const) VLCMediaTracksInformationBitrate

track bitrate

Note
  returns the bitrate as NSNumber

## ◆ VLCMediaTracksInformationCodec

- (NSString* const) VLCMediaTracksInformationCodec

Tracks information NSDictionary Possible Keys Codec information

Note
  returns a NSNumber

## ◆ VLCMediaTracksInformationCodecLevel

- (NSString* const) VLCMediaTracksInformationCodecLevel

codec level

Note
  returns a NSNumber

## ◆ VLCMediaTracksInformationCodecProfile

- (NSString* const) VLCMediaTracksInformationCodecProfile

codec profile

Note
  returns a NSNumber

## ◆ VLCMediaTracksInformationDescription

- (NSString* const) VLCMediaTracksInformationDescription

track description

Note
  returns the description as NSString

## ◆ VLCMediaTracksInformationFrameRate

- (NSString* const) VLCMediaTracksInformationFrameRate

frame rate

Note
  returns the frame rate as NSNumber

## ◆ VLCMediaTracksInformationFrameRateDenominator

- (NSString* const) VLCMediaTracksInformationFrameRateDenominator

frame rate denominator

Note
  returns the frame rate denominator as NSNumber

## ◆ VLCMediaTracksInformationId

- (NSString* const) VLCMediaTracksInformationId

tracks information ID

Note
  returns a NSNumber

## ◆ VLCMediaTracksInformationLanguage

- (NSString* const) VLCMediaTracksInformationLanguage

track language

Note
  returns the language as NSString

## ◆ VLCMediaTracksInformationSourceAspectRatio

- (NSString* const) VLCMediaTracksInformationSourceAspectRatio

source aspect ratio

Note
  returns the source aspect ratio as NSNumber

## ◆ VLCMediaTracksInformationSourceAspectRatioDenominator

- (NSString* const) VLCMediaTracksInformationSourceAspectRatioDenominator

source aspect ratio denominator

Note
  returns the source aspect ratio denominator as NSNumber

## ◆ VLCMediaTracksInformationTextEncoding

- (NSString* const) VLCMediaTracksInformationTextEncoding

text encoding

Note
  returns the text encoding as NSString

## ◆ VLCMediaTracksInformationType

- (NSString* const) VLCMediaTracksInformationType

track information type

Note
  returns a NSString

See also
  VLCMediaTracksInformationTypeAudio
  VLCMediaTracksInformationTypeVideo
  VLCMediaTracksInformationTypeText
  VLCMediaTracksInformationTypeUnknown

## ◆ VLCMediaTracksInformationTypeAudio

- (NSString* const) VLCMediaTracksInformationTypeAudio

audio track information NSDictionary value for VLCMediaTracksInformationType

## ◆ VLCMediaTracksInformationTypeText

- (NSString* const) VLCMediaTracksInformationTypeText

text / subtitles track information NSDictionary value for VLCMediaTracksInformationType

## ◆ VLCMediaTracksInformationTypeUnknown

- (NSString* const) VLCMediaTracksInformationTypeUnknown

unknown track information NSDictionary value for VLCMediaTracksInformationType

## ◆ VLCMediaTracksInformationTypeVideo

- (NSString* const) VLCMediaTracksInformationTypeVideo

video track information NSDictionary value for VLCMediaTracksInformationType

## ◆ VLCMediaTracksInformationVideoHeight

- (NSString* const) VLCMediaTracksInformationVideoHeight

video track height

Note
  returns the height as NSNumber

## ◆ VLCMediaTracksInformationVideoOrientation

- (NSString* const) VLCMediaTracksInformationVideoOrientation

video track orientation

Note
  returns the orientation as NSNumber

## ◆ VLCMediaTracksInformationVideoProjection

- (NSString* const) VLCMediaTracksInformationVideoProjection

video track projection

Note
  the projection as NSNumber

## ◆ VLCMediaTracksInformationVideoWidth

- (NSString* const) VLCMediaTracksInformationVideoWidth

video track width

Note
  the width as NSNumber

## Property Documentation

## ◆ delegate

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

Receiver's delegate.

## ◆ demuxBitrate

- (float) demuxBitrate
| read atomic assign

returns the current demux bitrate. may be 0 if the buffer is empty

Returns
  a float of the current demux bitrate

## ◆ inputBitrate

- (float) inputBitrate
| read atomic assign

returns the current input bitrate. may be 0 if the buffer is full

Returns
  a float of the current input bitrate

## ◆ length

- (VLCTime*) length
| read write nonatomic strong

A VLCTime object describing the length of the media resource, only if it is available. Use lengthWaitUntilDate: to wait for a specified length of time.

See also
  lengthWaitUntilDate

## ◆ mediaSizeSuitableForDevice

- (BOOL) mediaSizeSuitableForDevice
| read atomic assign

returns a bool whether is the media is expected to play fluently on this device or not. It always returns YES on a Mac.

## ◆ mediaType

- (VLCMediaType) mediaType
| read atomic assign

media type

Returns
  returns the type of a media (VLCMediaType)

## ◆ metaDictionary

- (NSDictionary*) metaDictionary
| read nonatomic copy

The receiver's meta data as a NSDictionary object.

## ◆ numberOfCorruptedDataPackets

- (NSInteger) numberOfCorruptedDataPackets
| read atomic assign

returns the total number of corrupted data packets during current sout session

Note
  value is 0 on non-stream-output operations

Returns
  a NSInteger with the total number of corrupted data packets

## ◆ numberOfDecodedAudioBlocks

- (NSInteger) numberOfDecodedAudioBlocks
| read atomic assign

returns the total number of decoded audio blocks in the current media session

Returns
  a NSInteger with the total number of decoded blocks

## ◆ numberOfDecodedVideoBlocks

- (NSInteger) numberOfDecodedVideoBlocks
| read atomic assign

returns the total number of decoded video blocks in the current media session

Returns
  a NSInteger with the total number of decoded blocks

## ◆ numberOfDiscontinuties

- (NSInteger) numberOfDiscontinuties
| read atomic assign

returns the total number of discontinuties during current sout session

Note
  value is 0 on non-stream-output operations

Returns
  a NSInteger with the total number of discontinuties

## ◆ numberOfDisplayedPictures

- (NSInteger) numberOfDisplayedPictures
| read atomic assign

returns the total number of displayed pictures during the current media session

Returns
  a NSInteger with the total number of displayed pictures

## ◆ numberOfLostAudioBuffers

- (NSInteger) numberOfLostAudioBuffers
| read atomic assign

returns the total number of audio buffers lost during the current media session

Returns
  a NSInteger with the total number of displayed pictures

## ◆ numberOfLostPictures

- (NSInteger) numberOfLostPictures
| read atomic assign

returns the total number of pictures lost during the current media session

Returns
  a NSInteger with the total number of lost pictures

## ◆ numberOfPlayedAudioBuffers

- (NSInteger) numberOfPlayedAudioBuffers
| read atomic assign

returns the total number of played audio buffers during the current media session

Returns
  a NSInteger with the total number of played audio buffers

## ◆ numberOfReadBytesOnDemux

- (NSInteger) numberOfReadBytesOnDemux
| read atomic assign

returns the number of bytes read by the current demux module

Returns
  a NSInteger with the raw number of bytes

## ◆ numberOfReadBytesOnInput

- (NSInteger) numberOfReadBytesOnInput
| read atomic assign

returns the number of bytes read by the current input module

Returns
  a NSInteger with the raw number of bytes

## ◆ numberOfSentBytes

- (NSInteger) numberOfSentBytes
| read atomic assign

returns the total number of raw bytes sent during the current media session

Returns
  a NSInteger with the total number of sent bytes

## ◆ numberOfSentPackets

- (NSInteger) numberOfSentPackets
| read atomic assign

returns the total number of packets sent during the current media session

Returns
  a NSInteger with the total number of sent packets

## ◆ parsedStatus

- (VLCMediaParsedStatus) parsedStatus
| read nonatomic assign

Returns
  Returns the parse status of the media

## ◆ saveMetadata

- (BOOL) saveMetadata
| read atomic assign

Save the previously changed metadata

Returns
  true if saving was successful

## ◆ state

- (VLCMediaState) state
| read nonatomic assign

The receiver's state, such as Playing, Error, NothingSpecial, Buffering.

## ◆ stats

- (NSDictionary*) stats
| read atomic copy

Getter for statistics information Returns a NSDictionary with NSNumbers for values.

## ◆ streamOutputBitrate

- (float) streamOutputBitrate
| read atomic assign

returns the current bitrate of sent bytes

Returns
  a float of the current bitrate of sent bits

## ◆ subitems

- (VLCMediaList*) subitems
| read nonatomic strong

The receiver's sub list.

## ◆ tracksInformation

- (NSArray*) tracksInformation
| read atomic copy

Returns the tracks information.

This is an array of NSDictionary representing each track. It can contain the following keys:

See also
  VLCMediaTracksInformationCodec
  VLCMediaTracksInformationId
  VLCMediaTracksInformationType
  VLCMediaTracksInformationCodecProfile
  VLCMediaTracksInformationCodecLevel
  VLCMediaTracksInformationBitrate
  VLCMediaTracksInformationLanguage
  VLCMediaTracksInformationDescription
  VLCMediaTracksInformationAudioChannelsNumber
  VLCMediaTracksInformationAudioRate
  VLCMediaTracksInformationVideoHeight
  VLCMediaTracksInformationVideoWidth
  VLCMediaTracksInformationVideoOrientation
  VLCMediaTracksInformationVideoProjection
  VLCMediaTracksInformationSourceAspectRatio
  VLCMediaTracksInformationSourceAspectRatioDenominator
  VLCMediaTracksInformationFrameRate
  VLCMediaTracksInformationFrameRateDenominator
  VLCMediaTracksInformationTextEncoding

## ◆ url

- (NSURL*) url
| read nonatomic strong

The URL for the receiver's media resource.

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

- Headers/Public/VLCMedia.h