-
Notifications
You must be signed in to change notification settings - Fork 29
Getting started
#Getting Started
- Download the latest release. Extract the archive and place BrightcoveOS.NET-MAPI-Wrapper.dll in an appropriate place for inclusion in your project.
- Choose the debug dll while developing, since it is compiled with debug symbols, and will print raw information about the API calls to the .NET debug trace listener as they are made.
- For production environments, use the release version of the dll.
- Add a reference to your project for the dll.
- Add "using" statements to your code for the following namespaces:
using BrightcoveMapiWrapper.Api;
using BrightcoveMapiWrapper.Model;
using BrightcoveMapiWrapper.Model.Containers;
using BrightcoveMapiWrapper.Model.Items;
- Create a BrightcoveApi object and make API calls!
The BrightcoveApi class is the single object that contains all of the available API calls. Although it's possible to construct the BrightcoveApi object manually, it's much easier to use the provided factory. In its simplest form, you may create the API object with read-only access like so:
BrightcoveApi api = BrightcoveApiFactory.CreateApi("my API read token");
If you need write access as well, include your API write token as a second parameter:
BrightcoveApi api = BrightcoveApiFactory.CreateApi("my API read token", "my API write token");
The factory can also take a 3rd parameter to specify the "media delivery" option. If you need to retrieve regular "http" links to your media assets (as opposed to the "rtmp" links that are normally returned for streaming purposes), you may specify the "http" media delivery like so:
BrightcoveApi api = BrightcoveApiFactory.CreateApi("my API read token", "my API write token", "http");
It can also take an optional 4th parameter to specify the top level domain of the general service URL. If you are working with Brightcove KK, Brightcove's Japanese joint venture, you may specify the BrightcoveRegion enum parameter as below. If omitted, the generic .com URL is used.
BrightcoveApi api = BrightcoveApiFactory.CreateApi("my API read token", "my API write token", "http", BrightcoveRegion.Japan);
Or you may reconfigure the BrightcoveApi object after its initial creation:
BrightcoveApi api = BrightcoveApiFactory.CreateApi("my API read token");
api.Configuration.WriteToken = "my API write token";
api.Configuration.MediaDelivery = "http";
api.Configuration.ReadUrl = "http://api.brightcove.co.jp/services/library";
api.Configuration.WriteUrl = "http://api.brightcove.co.jp/services/post";
After instantiating and configuring your BrightcoveApi object, all of Brightcove's Media API read and write calls will be available. For any given API call, expect to find a same-named method on the BrightcoveApi object, but one that follows C# naming conventions; for instance, if the API call is "find_all_videos" then you may expect a method in BrightcoveApi called FindAllVideos(). A few more examples:
API call | BrightcoveApi method name |
---|---|
find_all_videos | FindAllVideos() |
find_playlists_by_reference_ids | FindPlaylistsByReferenceIds() |
create_video | CreateVideo() |
update_audiotrack | UpdateAudioTrack() |
See Customizing Request Properties.
API calls are subject to the whims of internet connectivity, and may throw an exception. To ensure that your app is as robust as possible, make sure to try/catch all API calls.
See the Examples page for more code samples.