GCKMediaMetadata Class Reference

A container for media metadata. More...

#import <GCKMediaMetadata.h>

+ Inheritance diagram for GCKMediaMetadata:

Instance Methods

(instancetype) - initWithMetadataType:
 Initializes a new, empty, MediaMetadata with the given media type. More...
 
(instancetype) - init
 Initialize with the generic metadata type. More...
 
(GCKMediaMetadataType) - metadataType
 The metadata type. More...
 
(NSArray *) - images
 Gets the list of images. More...
 
(void) - removeAllMediaImages
 Removes all the current images. More...
 
(void) - addImage:
 Adds an image to the list of images. More...
 
(BOOL) - containsKey:
 Tests if the object contains a field with the given key. More...
 
(NSArray< NSString * > *) - allKeys
 Returns a set of keys for all fields that are present in the object. More...
 
(id GCK_NULLABLE_TYPE) - objectForKey:
 Reads the value of a field. More...
 
(void) - setString:forKey:
 Stores a value in a string field. More...
 
(NSString *GCK_NULLABLE_TYPE) - stringForKey:
 Reads the value of a string field. More...
 
(void) - setInteger:forKey:
 Stores a value in an integer field. More...
 
(NSInteger) - integerForKey:
 Reads the value of an integer field. More...
 
(NSInteger) - integerForKey:defaultValue:
 Reads the value of an integer field. More...
 
(void) - setDouble:forKey:
 Stores a value in a double field. More...
 
(double) - doubleForKey:
 Reads the value of a double field. More...
 
(double) - doubleForKey:defaultValue:
 Reads the value of a double field. More...
 
(void) - setDate:forKey:
 Stores a value in a date field as a restricted ISO-8601 representation of the date. More...
 
(NSDate *GCK_NULLABLE_TYPE) - dateForKey:
 Reads the value of a date field from the restricted ISO-8601 representation of the date. More...
 
(NSString *GCK_NULLABLE_TYPE) - dateAsStringForKey:
 Reads the value of a date field, as a string. More...
 

Public Attributes

GCK_EXTERN NSString *const kGCKMetadataKeyCreationDate
 String key: Creation date. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyReleaseDate
 String key: Release date. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyBroadcastDate
 String key: Broadcast date. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyTitle
 String key: Title. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeySubtitle
 String key: Subtitle. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyArtist
 String key: Artist. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyAlbumArtist
 String key: Album artist. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyAlbumTitle
 String key: Album title. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyComposer
 String key: Composer. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyDiscNumber
 Integer key: Disc number. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyTrackNumber
 Integer key: Track number. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeySeasonNumber
 Integer key: Season number. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyEpisodeNumber
 Integer key: Episode number. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeySeriesTitle
 String key: Series title. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyStudio
 String key: Studio. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyWidth
 Integer key: Width. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyHeight
 Integer key: Height. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyLocationName
 String key: Location name. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyLocationLatitude
 Double key: Location latitude. More...
 
GCK_EXTERN NSString *const kGCKMetadataKeyLocationLongitude
 Double key: Location longitude. More...
 

Properties

GCKMediaMetadataType metadataType
 The metadata type. More...
 

Detailed Description

A container for media metadata.

Metadata has a media type, an optional list of images, and a collection of metadata fields. Keys for common metadata fields are predefined as constants, but the application is free to define and use additional fields of its own.

The values of the predefined fields have predefined types. For example, a track number is an NSInteger and a creation date is an NSString containing an ISO-8601 representation of a date and time. Attempting to store a value of an incorrect type in a field will raise an NSInvalidArgumentException.

Note that the Cast protocol limits which metadata fields can be used for a given media type. When a MediaMetadata object is serialized to JSON for delivery to a Cast receiver, any predefined fields which are not supported for a given media type will not be included in the serialized form, but any application-defined fields will always be included. The complete list of predefined fields is as follows:

Field Value Type Valid Metadata Types
kGCKMetadataKeyCreationDate NSDate GCKMediaMetadataTypePhoto
kGCKMetadataKeyReleaseDate NSDate GCKMediaMetadataTypeGeneric, GCKMediaMetadataTypeMovie, GCKMediaMetadataTypeTVShow, GCKMediaMetadataTypeMusicTrack
kGCKMetadataKeyBroadcastDate NSDate GCKMediaMetadataTypeTVShow
kGCKMetadataKeyTitle NSString GCKMediaMetadataTypeGeneric, GCKMediaMetadataTypeMovie, GCKMediaMetadataTypeTVShow, GCKMediaMetadataTypeMusicTrack, GCKMediaMetadataTypePhoto
kGCKMetadataKeySubtitle NSString GCKMediaMetadataTypeGeneric, GCKMediaMetadataTypeMovie
kGCKMetadataKeyArtist NSString GCKMediaMetadataTypeGeneric, GCKMediaMetadataTypeMusicTrack, GCKMediaMetadataTypePhoto
kGCKMetadataKeyAlbumArtist NSString GCKMediaMetadataTypeMusicTrack
kGCKMetadataKeyAlbumTitle NSString GCKMediaMetadataTypeMusicTrack
kGCKMetadataKeyComposer NSString GCKMediaMetadataTypeMusicTrack
kGCKMetadataKeyDiscNumber NSInteger GCKMediaMetadataTypeMusicTrack
kGCKMetadataKeyTrackNumber NSInteger GCKMediaMetadataTypeMusicTrack
kGCKMetadataKeySeasonNumber NSInteger GCKMediaMetadataTypeTVShow
kGCKMetadataKeyEpisodeNumber NSInteger GCKMediaMetadataTypeTVShow
kGCKMetadataKeySeriesTitle NSString GCKMediaMetadataTypeTVShow
kGCKMetadataKeyStudio NSString GCKMediaMetadataTypeMovie
kGCKMetadataKeyWidth NSInteger GCKMediaMetadataTypePhoto
kGCKMetadataKeyHeight NSInteger GCKMediaMetadataTypePhoto
kGCKMetadataKeyLocationName NSString GCKMediaMetadataTypePhoto
kGCKMetadataKeyLocationLatitude double GCKMediaMetadataTypePhoto
kGCKMetadataKeyLocationLongitude double GCKMediaMetadataTypePhoto

Method Documentation

- (void) addImage: (GCKImage *)  image

Adds an image to the list of images.

Parameters
imageThe image to add.
- (NSArray<NSString *> *) allKeys

Returns a set of keys for all fields that are present in the object.

- (BOOL) containsKey: (NSString *)  key

Tests if the object contains a field with the given key.

Parameters
keyThe key.
Returns
YES if the field exists, NO otherwise.
- (NSString *GCK_NULLABLE_TYPE) dateAsStringForKey: (NSString *)  key

Reads the value of a date field, as a string.

Parameters
keyThe field name.
Returns
The date as a string containing the restricted ISO-8601 representation of the date, or nil if this field has not been set.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not a date field.
- (NSDate *GCK_NULLABLE_TYPE) dateForKey: (NSString *)  key

Reads the value of a date field from the restricted ISO-8601 representation of the date.

Parameters
keyThe field name.
Returns
The date, or nil if this field has not been set.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not a date field.
- (double) doubleForKey: (NSString *)  key

Reads the value of a double field.

Parameters
keyThe key for the field.
Returns
The value of the field, or 0 if the field has not been set.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not a double field.
- (double) doubleForKey: (NSString *)  key
defaultValue: (double)  defaultValue 

Reads the value of a double field.

Parameters
defaultValueThe value to return if the field has not been set.
keyThe key for the field.
Returns
The value of the field, or the given default value if the field has not been set.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not a double field.
- (NSArray *) images

Gets the list of images.

- (instancetype) init

Initialize with the generic metadata type.

- (instancetype) initWithMetadataType: (GCKMediaMetadataType)  metadataType

Initializes a new, empty, MediaMetadata with the given media type.

Designated initializer.

Parameters
metadataTypeThe media type; one of the GCKMediaMetadataType constants, or a value greater than or equal to GCKMediaMetadataTypeUser for custom media types.
- (NSInteger) integerForKey: (NSString *)  key

Reads the value of an integer field.

Parameters
keyThe key for the field.
Returns
The value of the field, or 0 if the field has not been set.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not an integer field.
- (NSInteger) integerForKey: (NSString *)  key
defaultValue: (NSInteger)  defaultValue 

Reads the value of an integer field.

Parameters
keyThe key for the field.
defaultValueThe value to return if the field has not been set.
Returns
The value of the field, or the given default value if the field has not been set.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not an integer field.
- (GCKMediaMetadataType) metadataType

The metadata type.

- (id GCK_NULLABLE_TYPE) objectForKey: (NSString *)  key

Reads the value of a field.

Parameters
keyThe key for the field.
Returns
The value of the field, or nil if the field has not been set.
- (void) removeAllMediaImages

Removes all the current images.

- (void) setDate: (NSDate *)  date
forKey: (NSString *)  key 

Stores a value in a date field as a restricted ISO-8601 representation of the date.

Parameters
dateThe new value for the field.
keyThe key for the field.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not a date field.
- (void) setDouble: (double)  value
forKey: (NSString *)  key 

Stores a value in a double field.

Parameters
valueThe new value for the field.
keyThe key for the field.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not a double field.
- (void) setInteger: (NSInteger)  value
forKey: (NSString *)  key 

Stores a value in an integer field.

Parameters
valueThe new value for the field.
keyThe key for the field.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not an integer field.
- (void) setString: (NSString *)  value
forKey: (NSString *)  key 

Stores a value in a string field.

Parameters
valueThe new value for the field.
keyThe key for the field.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not a string field.
- (NSString *GCK_NULLABLE_TYPE) stringForKey: (NSString *)  key

Reads the value of a string field.

Parameters
keyThe key for the field.
Returns
The value of the field, or nil if the field has not been set.
Exceptions
NSInvalidArgumentExceptionif the key refers to a predefined field which is not a string field.

Member Data Documentation

- (GCK_EXTERN NSString* const) kGCKMetadataKeyAlbumArtist

String key: Album artist.

The name of the artist who produced an album. For example, in compilation albums such as DJ mixes, the album artist is not necessarily the same as the artist(s) of the individual songs on the album. This value is suitable for display purposes.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyAlbumTitle

String key: Album title.

The title of the album that a music track belongs to. This value is suitable for display purposes.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyArtist

String key: Artist.

The name of the artist who created the media. For example, this could be the name of a musician, performer, or photographer. This value is suitable for display purposes.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyBroadcastDate

String key: Broadcast date.

The value is the date and/or time at which the media was first broadcast, in ISO-8601 format. For example, this could be the date that a TV show episode was first aired.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyComposer

String key: Composer.

The name of the composer of a music track. This value is suitable for display purposes.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyCreationDate

String key: Creation date.

The value is the date and/or time at which the media was created, in ISO-8601 format. For example, this could be the date and time at which a photograph was taken or a piece of music was recorded.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyDiscNumber

Integer key: Disc number.

The disc number (counting from 1) that a music track belongs to in a multi-disc album.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyEpisodeNumber

Integer key: Episode number.

The number of an episode in a given season of a TV show. Typically episode numbers are counted starting from 1, however this value may be 0 if it is a "pilot" episode that is not considered to be an official episode of the first season.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyHeight

Integer key: Height.

The height of a piece of media, in pixels. This would typically be used for providing the dimensions of a photograph.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyLocationLatitude

Double key: Location latitude.

The latitude component of the geographical location where a piece of media was created. For example, this could be the location of a photograph or the principal filming location of a movie.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyLocationLongitude

Double key: Location longitude.

The longitude component of the geographical location where a piece of media was created. For example, this could be the location of a photograph or the principal filming location of a movie.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyLocationName

String key: Location name.

The name of a location where a piece of media was created. For example, this could be the location of a photograph or the principal filming location of a movie. This value is suitable for display purposes.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyReleaseDate

String key: Release date.

The value is the date and/or time at which the media was released, in ISO-8601 format. For example, this could be the date that a movie or music album was released.

- (GCK_EXTERN NSString* const) kGCKMetadataKeySeasonNumber

Integer key: Season number.

The season number that a TV show episode belongs to. Typically season numbers are counted starting from 1, however this value may be 0 if it is a "pilot" episode that predates the official start of a TV series.

- (GCK_EXTERN NSString* const) kGCKMetadataKeySeriesTitle

String key: Series title.

The name of a series. For example, this could be the name of a TV show or series of related music albums. This value is suitable for display purposes.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyStudio

String key: Studio.

The name of a recording studio that produced a piece of media. For example, this could be the name of a movie studio or music label. This value is suitable for display purposes.

- (GCK_EXTERN NSString* const) kGCKMetadataKeySubtitle

String key: Subtitle.

The subtitle of the media. This value is suitable for display purposes.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyTitle

String key: Title.

The title of the media. For example, this could be the title of a song, movie, or TV show episode. This value is suitable for display purposes.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyTrackNumber

Integer key: Track number.

The track number of a music track on an album disc. Typically track numbers are counted starting from 1, however this value may be 0 if it is a "hidden track" at the beginning of an album.

- (GCK_EXTERN NSString* const) kGCKMetadataKeyWidth

Integer key: Width.

The width of a piece of media, in pixels. This would typically be used for providing the dimensions of a photograph.

Property Documentation

- (GCKMediaMetadataType) metadataType
readnonatomicassign

The metadata type.


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