Table of Contents

Class MediaLibrary

Namespace
Microsoft.Xna.Framework.Media
Assembly
MonoGame.Framework.dll

Provides access to songs, playlists, and pictures in the device's media library.

public class MediaLibrary : IDisposable
Inheritance
MediaLibrary
Implements
Inherited Members

Remarks

MediaLibrary provides the following properties that return media collections: Albums, Songs. Each property returns a collection object that can be enumerated and indexed. The collection object represents all media of that type in the device's media library.

Constructors

MediaLibrary()

Creates a new instance of MediaLibrary.

public MediaLibrary()

MediaLibrary(MediaSource)

Creates a new instance of MediaLibrary from a supplie MediaSource.

public MediaLibrary(MediaSource mediaSource)

Parameters

mediaSource MediaSource

Remarks

Current implenetation will always throw NotSupportedException

Properties

Albums

Gets the AlbumCollection that contains all albums in the media library.

public AlbumCollection Albums { get; }

Property Value

AlbumCollection

IsDisposed

Gets a value indicating whether the object is disposed.

public bool IsDisposed { get; }

Property Value

bool

MediaSource

Gets the MediaSource with which this media library was constructed.

public MediaSource MediaSource { get; }

Property Value

MediaSource

Songs

Gets the SongCollection that contains all songs in the media library.

public SongCollection Songs { get; }

Property Value

SongCollection

Methods

Dispose()

Immediately releases the unmanaged resources used by this object.

public void Dispose()

Load(Action<int>)

Load the contents of MediaLibrary. This blocking call might take up to a few minutes depending on the platform and the size of the user's music library.

public void Load(Action<int> progressCallback = null)

Parameters

progressCallback Action<int>

Callback that reports back the progress of the music library loading in percents (0-100).