This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Playlist Read Examples
peter-majeed edited this page Dec 27, 2012
·
3 revisions
#Playlist Read calls All calls that are part of the Brightcove Playlist Read API are wrapped and available within the .NET-MAPI-Wrapper. You will find examples of some of the more common use cases below.
API calls are subject to the whims of internet connectivity, and may throw an exception for any number of reasons:
- The Brightcove API may be down or not functioning correctly.
- Network connectivity may be lost between your application and Brightcove.
- Invalid parameters passed to the API may result in an error message in the response JSON. The error message will be wrapped in a BrightcoveApiException and thrown so that it may be handled via normal .NET error handling mechanisms.
Although the examples shown here do not include try/catch blocks, in order to ensure that your app is as robust as possible make sure to try/catch all API calls.
See how to work with the BrightcoveApi object on the Getting Started page.
- Find all playlists in your account, 50 at a time
- Find a playlist by ID
- Find playlists by a list of reference IDs
// Perform the API call. 50 videos is the maximum number of playlists
// you can return per page.
BrightcoveItemCollection<BrightcovePlaylist> playlists = api.FindAllPlaylists(50, 0);
foreach (BrightcovePlaylist playlist in playlists)
{
// Process each playlist in the collection.
foreach (BrightcoveVideo video in playlist.Videos)
{
// Process each video in each playlist.
}
}
<a name="find-by-id" />
## Find a playlist by ID
```c#
// Instantiate an API object by using the provided factory
BrightcoveApi api = BrightcoveApiFactory.CreateApi("my API read token");
// Perform the API call
BrightcovePlaylist playlist = api.FindPlaylistById(1234567890);
foreach (BrightcoveVideo video in playlist.Videos)
{
// Process each video in the playlist.
}
string[] referenceIds = new[] { "reference-id-1", "reference-id-2", "...reference-id-500..." };
// Perform the API call
BrightcoveItemCollection<BrightcovePlaylist> playlists = api.FindPlaylistsByReferenceIds(referenceIds);
foreach (BrightcovePlaylist playlist in playlists)
{
// Process each playlist in the collection.
foreach (BrightcoveVideo video in playlist.Videos)
{
// Process each video in each playlist.
}
}
## See also
More [[Examples]]