---
title: MLMediaSource
framework: medialibrary
role: symbol
role_heading: Class
path: medialibrary/mlmediasource
---

# MLMediaSource

The MLMediaSource class identifies a specific provider of media. Conceptually, a media source respresents a single app, such as iTunes or Aperture. Each media source contains multiple groups of media objects—individual files containing a piece of media such as a photo, song, or movie.

## Declaration

```swift
class MLMediaSource
```

## Overview

Overview The structure of the group hierarchy is specific to each media source, but all sources have certain commonalities. For example, every source has a single root media group, which contains all groups and objects within that source. It is the highest-level parent group in the hierarchy and each of its descendant groups contains its own subgroups and their objects. All groups have a reference to their parent within the hierarchy. A group with no descendants contains only its own objects. If a media group does not contain any objects, it is not visible in the hierarchy. Every media source has a unique media source identifier within a single media library instance. For a list of possible media source identifiers, see Media Source Identifiers. All MLMediaSource properties are read-only, so this information can be accessed but not altered.

## Topics

### Identifying the Source

- [mediaSourceIdentifier](medialibrary/mlmediasource/mediasourceidentifier.md)
- [mediaLibrary](medialibrary/mlmediasource/medialibrary.md)

### Accessing Source Attributes

- [attributes](medialibrary/mlmediasource/attributes.md)

### Accessing the Root Media Group

- [rootMediaGroup](medialibrary/mlmediasource/rootmediagroup.md)

### Accessing Media

- [mediaGroup(forIdentifier:)](medialibrary/mlmediasource/mediagroup(foridentifier:).md)
- [mediaGroups(forIdentifiers:)](medialibrary/mlmediasource/mediagroups(foridentifiers:).md)
- [mediaObject(forIdentifier:)](medialibrary/mlmediasource/mediaobject(foridentifier:).md)
- [mediaObjects(forIdentifiers:)](medialibrary/mlmediasource/mediaobjects(foridentifiers:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Classes

- [MLMediaGroup](medialibrary/mlmediagroup.md)
- [MLMediaLibrary](medialibrary/mlmedialibrary.md)
- [MLMediaObject](medialibrary/mlmediaobject.md)
