Archive for August, 2012

Universal Subtitles C# API Wrapper

This is available on GitHub here: https://github.com/joelmartinez/universalsubtitles-csharp

C# 5.0 API Wrapper for the Universal Subtitles service, which is what the Khan Academy uses as their provider. I’m building this to add subtitles to the Khan Academy for Windows RT app.

Usage is simple:

using UniversalSubtitles;
...
var api = new UniversalSubtitles.v1.Api();

string video_url = "http://www.youtube.com/watch?v=W0VWO4asgmk&feature=youtube_gdata_player";

SubtitleLine[] subtitles = await api.SubtitlesAsync(video_url);
// returns the subtitles in the video's spoken language

You can also give the user a list of available languages that are available for this video

Language[] languages = await api.LanguagesAsync(video_url);
// display the list of available languages

SubtitleLine[] subtitles = await api.SubtitlesAsync(video_url, "it"); 
// or you can pass an instance of Language

Hope it’s useful for someone out there :)

Comments