Brightcove Media API SDK for .NET Available

Written by Bob de Wit. Posted in .NET, Brightcove, Developer Blog

I’ve just created a Google Code project for Tanaris, a .NET software development kit (SDK) for the Brightcove 3 application programming interface (API) implemented in C#. Currently the SDK supports all of the video and playlist read methods, write is being implemented. All returned DTO (Data Transfer Objects) are strong typed and (if required) converted to native .NET formats (like DateTime). This SDK uses the NewtonSoft JSON library for .NET. Example usage:
using System;
using System.Collections.Generic;
using BrightcoveAPI;
using System.Text;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //First, you MUST configure your read and write tokens
            BCAPI.Configuration.ReadToken = "1234567890";
            BCAPI.Configuration.WriteToken = "0987654321";

            //Result variable for array of videos, implemented as a Dictionary for fast lookup by ID
            Dictionary videos;

            //Result variable for a single video
            BCVideo video;

            //Test the FindAllVideos API Call
            videos = BCAPI.FindAllVideos(-1, -1, BCSortByType.CREATION_DATE, BCSortOrderType.ASC, null, true);
            foreach (BCVideo v in videos.Values)
            {
                Console.WriteLine("FindAllVideos() - Found video: " + v.name);
            }

            //Test the FindByID API Call with an existing video.
            //You need to replace the video id with an asset id defined in your account!
            video = BCAPI.FindVideoById(1909882514);
            if (video != null)
            {
                Console.WriteLine("FindByID() - Found video: " + video.name);
            }
            else
            {
                Console.WriteLine("FindByID() for existing video returned null. Wrong id?");
            }

            //Test the FindByID API Call with an non-existing video (returns a null object)
            video = BCAPI.FindVideoById(9999999999, null);
            if (video == null)
            {
                Console.WriteLine("FindByID() for unexisting video returned null");
            }
            else
            {
                Console.WriteLine("FindByID() - A Miracle! - Found video: " + video.name);
            }

            //Test the FindRelatedVideos API Call
            //You need to replace the video id with an asset id defined in your account!
            videos = BCAPI.FindRelatedVideos(1631314667, -1, -1, null, true);
            foreach (BCVideo v in videos.Values)
            {
                Console.WriteLine("FindRelatedVideos() - Found video: " + v.name);
            }

            //Test the FindVideosByIds API Call
            List ids = new List();
            ids.Add(1459158571);
            ids.Add(1631314667);
            videos = BCAPI.FindVideosByIds(ids, null);
            foreach (BCVideo v in videos.Values)
            {
                Console.WriteLine("FindVideosByIds() - Found video: " + v.name);
            }
        }
    }
}
Tanaris is not officially supported by Brightcove. Please post all support questions to the Google Code forum, not in the Brightcove Developer Community.

Trackback from your site.

Leave a comment