Mac Developer Library

Developer

MediaLibrary Framework Reference MLMediaObject Class Reference

Options
Deployment Target:

On This Page
Language:

MLMediaObject

The MLMediaObject class describes a single media file, such as a photo, song, or movie. Each media object contains basic metadata including a name, media type, URL, and so on. Additional information about each object is stored in its list of attributes. For a list of possible object attribute keys, see Media Object Attribute Keys. More...

Inheritance


Conforms To


Import Statement


import MediaLibrary @import MediaLibrary;

Availability


Available in OS X v10.9 and later.
  • An identifier for the media object. (read-only)

    Declaration

    Swift

    var identifier: String! { get }

    Objective-C

    @property(readonly, copy) NSString *identifier

    Discussion

    Each object’s identifier is unique within a media source.

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • An identifier for the source that loaded the media object. (read-only)

    Declaration

    Swift

    var mediaSourceIdentifier: String! { get }

    Objective-C

    @property(readonly, copy) NSString *mediaSourceIdentifier

    Discussion

    For a list of possible media source identifiers, see MLMediaLibrary Class Reference.

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • A pointer to the media library instance that loaded the media object’s source. (read-only)

    Declaration

    Swift

    unowned(unsafe) var mediaLibrary: MLMediaLibrary! { get }

    Objective-C

    @property(readonly, assign) MLMediaLibrary *mediaLibrary

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • A dictionary of attributes describing the media object. (read-only)

    Declaration

    Swift

    var attributes: [NSObject : AnyObject]! { get }

    Objective-C

    @property(readonly, copy) NSDictionary *attributes

    Discussion

    For a list of possible object attribute keys, see Media Object Attribute Keys.

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • mediaType mediaType Property

    The media object’s type of media (image, audio, or movie). (read-only)

    Declaration

    Swift

    var mediaType: MLMediaType { get }

    Objective-C

    @property(readonly, assign) MLMediaType mediaType

    Discussion

    For a list of possible media types, see Media Types.

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • The UTI associated with the media object. (read-only)

    Declaration

    Swift

    var contentType: String! { get }

    Objective-C

    @property(readonly, copy) NSString *contentType

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • name name Property

    The name of the media object. (read-only)

    Declaration

    Swift

    var name: String! { get }

    Objective-C

    @property(readonly, copy) NSString *name

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • URL URL Property

    The location of the media object. (read-only)

    Declaration

    Swift

    @NSCopying var URL: NSURL! { get }

    Objective-C

    @property(readonly, copy) NSURL *URL

    Discussion

    This property is provided as a security-scoped URL. In order to gain access to the file that this URL refers to, the caller must call startAccessingSecurityScopedResource before and stopAccessingSecurityScopedResource after using the URL to access the file. For more information about security-scoped URLs, see NSURL Class Reference.

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • The location of the original media object, if URL is not the original (master). (read-only)

    Declaration

    Swift

    @NSCopying var originalURL: NSURL! { get }

    Objective-C

    @property(readonly, copy) NSURL *originalURL

    Discussion

    This property is provided as a security-scoped URL. In order to gain access to the file that this URL refers to, the caller must call startAccessingSecurityScopedResource before and stopAccessingSecurityScopedResource after using the URL to access the file. For more information about security-scoped URLs, see NSURL Class Reference.

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • fileSize fileSize Property

    The size, in bytes, of the media object. (read-only)

    Declaration

    Swift

    var fileSize: Int { get }

    Objective-C

    @property(readonly, assign) NSUInteger fileSize

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • The date and time when the media object was last altered. (read-only)

    Declaration

    Swift

    @NSCopying var modificationDate: NSDate! { get }

    Objective-C

    @property(readonly, copy) NSDate *modificationDate

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • The location of the media object’s thumbnail image. (read-only)

    Declaration

    Swift

    @NSCopying var thumbnailURL: NSURL! { get }

    Objective-C

    @property(readonly, copy) NSURL *thumbnailURL

    Discussion

    This property is provided as a security-scoped URL. In order to gain access to the file that this URL refers to, the caller must call startAccessingSecurityScopedResource before and stopAccessingSecurityScopedResource after using the URL to access the file. For more information about security-scoped URLs, see NSURL Class Reference.

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.

  • Album artwork associated with the media object. (read-only)

    Declaration

    Swift

    @NSCopying var artworkImage: NSImage! { get }

    Objective-C

    @property(readonly, copy) NSImage *artworkImage

    Discussion

    Applies to iTunes media only. Returns nil if not applicable or not available.

    Import Statement

    import MediaLibrary

    Availability

    Available in OS X v10.9 and later.