Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Getting started

peter-majeed edited this page Dec 21, 2012 · 8 revisions

#Getting Started

Download the dll for use with your project

  1. 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.
  2. Add a reference to your project for the dll.
  3. Add "using" statements to your code for the following namespaces:
    using BrightcoveMapiWrapper.Api;
    using BrightcoveMapiWrapper.Model;
    using BrightcoveMapiWrapper.Model.Containers;
    using BrightcoveMapiWrapper.Model.Items;
  1. Create a BrightcoveApi object and make API calls!

Working with the BrightcoveApi object

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";

Making API Calls

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()

Customizing HTTP Request Properties

See Customizing Request Properties.

Important Note

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.

More Examples

See the Examples page for more code samples.