MediaLibrary Constructor (MediaSource)
Initializes a new instance of the MediaLibrary class, using a specific media source to create the new media library.
Syntax
'Declaration
Public Sub New ( _
mediaSource As MediaSource _
)
public MediaLibrary (
MediaSource mediaSource
)
public:
MediaLibrary(
MediaSource mediaSource
)
Parameters
- mediaSource
Type: MediaSource
A media source that will be the source for the media library.
Example
The following example demonstrates creating a new MediaLibrary class using a MediaSource.
GraphicsDevice.Clear(Color.CornflowerBlue);
Vector2 pos = Vector2.Zero;
SpriteFont font = Content.Load<SpriteFont>("Font");
spriteBatch.Begin();
spriteBatch.DrawString(font, "media library stats:",
pos, Color.White);
ICollection<MediaSource> mediaSources =
MediaSource.GetAvailableMediaSources();
foreach (MediaSource source in mediaSources)
{
MediaLibrary ml = new MediaLibrary(source);
// display some data about this media library
pos.Y += font.LineSpacing;
spriteBatch.DrawString(font, "Album count: " + ml.Albums.Count,
pos, Color.White);
}
spriteBatch.End();
Requirements
Namespace: Microsoft.Xna.Framework.Media
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
See Also
Reference
MediaLibrary Class
MediaSource Class
MediaLibrary Members
Microsoft.Xna.Framework.Media Namespace
Platforms
Windows Phone