Inherits from NSObject
Declared in MSFKMediaMetadata.h
MSFKMediaMetadata.m

Overview

Container class 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 a NSString containing an ISO-8601 representation of a date and time. Attempting to store a value of an incorrect type in a field will assert.

Note that the Flint 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 Flint 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.

Instance Methods

JSONObject

Create a JSON object which can serialized with NSJSONSerialization to pass to the receiver.

- (id)JSONObject

Discussion

Create a JSON object which can serialized with NSJSONSerialization to pass to the receiver.

Declared In

MSFKMediaMetadata.h

addImage:

Adds an image to the list of images.

- (void)addImage:(MSFKImage *)image

Discussion

Adds an image to the list of images.

Declared In

MSFKMediaMetadata.h

allKeys

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

- (NSArray *)allKeys

Discussion

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

Declared In

MSFKMediaMetadata.h

containsKey:

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

- (BOOL)containsKey:(NSString *)key

Discussion

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

Declared In

MSFKMediaMetadata.h

dateAsStringForKey:

Reads the value of a date field, as a string. Asserts if the key refers to a predefined field which is not a date field.

- (NSString *)dateAsStringForKey:(NSString *)key

Parameters

key

The field name.

Return Value

The date, as a {@code String} containing the restricted ISO-8601 representation of the date, or {@code null} if this field has not been set. @throw IllegalArgumentException If the specified field’s predefined type is not a date.

Discussion

Reads the value of a date field, as a string. Asserts if the key refers to a predefined field which is not a date field.

Declared In

MSFKMediaMetadata.h

dateForKey:

Reads the value of a date field from the restricted ISO-8601 representation of the date. Asserts if the key refers to a predefined field which is not a date field.

- (NSDate *)dateForKey:(NSString *)key

Parameters

key

The field name.

Return Value

The date, or {@code nil} if this field has not been set.

Discussion

Reads the value of a date field from the restricted ISO-8601 representation of the date. Asserts if the key refers to a predefined field which is not a date field.

Declared In

MSFKMediaMetadata.h

doubleForKey:

Reads the value of a {@code double} field. Asserts if the key refers to a predefined field which is not a {@code double} field.

- (double)doubleForKey:(NSString *)key

Return Value

The value of the field, or 0 if the field has not been set.

Discussion

Reads the value of a {@code double} field. Asserts if the key refers to a predefined field which is not a {@code double} field.

Declared In

MSFKMediaMetadata.h

doubleForKey:defaultValue:

Reads the value of a {@code double} field. Asserts if the key refers to a predefined field which is not a {@code double} field.

- (double)doubleForKey:(NSString *)key defaultValue:(double)defaultValue

Parameters

defaultValue

The value to return if the field has not been set.

Return Value

The value of the field, or the given default value if the field has not been set.

Discussion

Reads the value of a {@code double} field. Asserts if the key refers to a predefined field which is not a {@code double} field.

Declared In

MSFKMediaMetadata.h

images

Gets the list of images.

- (NSArray *)images

Discussion

Gets the list of images.

Declared In

MSFKMediaMetadata.h

init

Initialize with the generic metadata type.

- (id)init

Discussion

Initialize with the generic metadata type.

Declared In

MSFKMediaMetadata.h

initWithJSONObject:

Initialize this object with its JSON representation.

- (id)initWithJSONObject:(id)jsonObject

Discussion

Initialize this object with its JSON representation.

Declared In

MSFKMediaMetadata.h

initWithMetadataType:

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

- (id)initWithMetadataType:(MSFKMediaMetadataType)metadataType

Parameters

metadataType

The media type; one of the {@code MEDIA_TYPE_*} constants, or a value greater than or equal to {@link MEDIA_TYPE_USER} for custom media types.

Discussion

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

Declared In

MSFKMediaMetadata.h

integerForKey:

Reads the value of an integer field. Asserts if the key refers to a predefined field which is not an {@code NSInteger} field.

- (NSInteger)integerForKey:(NSString *)key

Return Value

The value of the field, or 0 if the field has not been set.

Discussion

Reads the value of an integer field. Asserts if the key refers to a predefined field which is not an {@code NSInteger} field.

Declared In

MSFKMediaMetadata.h

integerForKey:defaultValue:

Reads the value of an integer field. Asserts if the key refers to a predefined field which is not an {@code NSInteger} field.

- (NSInteger)integerForKey:(NSString *)key defaultValue:(NSInteger)defaultValue

Parameters

defaultValue

The value to return if the field has not been set.

Return Value

The value of the field, or the given default value if the field has not been set.

Discussion

Reads the value of an integer field. Asserts if the key refers to a predefined field which is not an {@code NSInteger} field.

Declared In

MSFKMediaMetadata.h

metadataType

The metadata type.

- (MSFKMediaMetadataType)metadataType

Discussion

The metadata type.

Declared In

MSFKMediaMetadata.h

removeAllMediaImages

Removes all the current images.

- (void)removeAllMediaImages

Discussion

Removes all the current images.

Declared In

MSFKMediaMetadata.h

setDate:forKey:

Stores a value in a date field as a restricted ISO-8601 representation of the date. Asserts if the key refers to a predefined field which is not a date field.

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

Parameters

key

The key for the field.

value

The new value for the field.

Discussion

Stores a value in a date field as a restricted ISO-8601 representation of the date. Asserts if the key refers to a predefined field which is not a date field.

Declared In

MSFKMediaMetadata.h

setDouble:forKey:

Stores a value in a {@code double} field. Asserts if the key refers to a predefined field which is not a {@code double} field.

- (void)setDouble:(double)value forKey:(NSString *)key

Parameters

value

The new value for the field.

key

The key for the field.

Discussion

Stores a value in a {@code double} field. Asserts if the key refers to a predefined field which is not a {@code double} field.

Declared In

MSFKMediaMetadata.h

setInteger:forKey:

Stores a value in an integer field. Asserts if the key refers to a predefined field which is not an {@code NSInteger} field.

- (void)setInteger:(NSInteger)value forKey:(NSString *)key

Parameters

value

The new value for the field.

key

The key for the field.

Discussion

Stores a value in an integer field. Asserts if the key refers to a predefined field which is not an {@code NSInteger} field.

Declared In

MSFKMediaMetadata.h

setString:forKey:

Stores a value in a string field. Asserts if the key refers to a predefined field which is not a {@code NSString} field.

- (void)setString:(NSString *)value forKey:(NSString *)key

Parameters

value

The new value for the field.

key

The key for the field.

Discussion

Stores a value in a string field. Asserts if the key refers to a predefined field which is not a {@code NSString} field.

Declared In

MSFKMediaMetadata.h

stringForKey:

Reads the value of a string field. Asserts if the key refers to a predefined field which is not a {@code NSString} field.

- (NSString *)stringForKey:(NSString *)key

Return Value

The value of the field, or {@code nil} if the field has not been set.

Discussion

Reads the value of a string field. Asserts if the key refers to a predefined field which is not a {@code NSString} field.

Declared In

MSFKMediaMetadata.h