Integration API Documents > HTML 5 API

Integration API Documents

HTML 5 API

The HTML 5 API ia a JavaScript solution to overlay content created by SubPLY


This API is a JSONP based integration where the content is a JSON static file.

SubPLY will automatically publish this JSON file for HTML 5 integrated customers.

JSONP Example:

var dynamicScriptTag = document.createElement('script');
var source = "http://subply.plymedia.com.s3.amazonaws.com/scripts/Html5_" + language + ".js";
dynamicScriptTag.type = 'text/javascript';
dynamicScriptTag.src = source;
dynamicScriptTag.setAttribute("id", "subPLYScript");
document.getElementsByTagName('body')[0].appendChild(dynamicScriptTag);

To generate a static JSON file please use the Transcript API with "html5" as the requested format:

Example:

http://api.subply.com/content/html5/eng?url=http%3a%2f%2fwww.youtube.com%2fwatch%3fv%3dhrixBl5PgNg

Result:

A Text result in the requested format. Following is the result from the above example:

var captionData = [{"TotalRows":13,"rows":[{"start":49.89,"end":58.6,"text":"I heard he sang a good song\nI heard he had a style"},{"start":59.739999999999995,"end":68.55,"text":"And so I came to see him\nand listen for a while"},{"start":68.83,"end":78.71,"text":"And there he was, this young boy\na stranger to my eyes"},{"start":79.149999999999991,"end":88.88,"text":"Strumming my pain with his fingers\nSinging my life with his words"},{"start":89.55,"end":97.81,"text":"Killing me softly with his song\nKilling me softly.. with his song"},{"start":98.429999999999993,"end":103.08999999999999,"text":"Telling my whole life\n with his words"},{"start":103.5,"end":113.83,"text":"Killing me softly... \nwith his song"},{"start":115.88,"end":125.33999999999999,"text":"I felt all flushed with fever\nembarrassed by the crowd"},{"start":125.78,"end":134.85,"text":"I felt he found my letters\nand read each one out loud"},{"start":135.63,"end":144.94,"text":"I prayed that he would finish\nbut he just kept right on, yeah.."},{"start":145.66,"end":155.26,"text":"Strumming my pain with his fingers\nYes, he was singing my life with his words, yeah"},{"start":155.95,"end":164.32,"text":"Killing me softly with his song\nKilling me softly.. with his song"},{"start":164.73,"end":179.36999999999998,"text":"Telling my whole life with his words\nKilling me softly... with his song"}]}];

function syncCaptions(currentTime, divObject) {
try {
  for (var i = 0; i < captionData.length; i++) {
   var line = captionData[i];
   if (currentTime >= line.From && currentTime <= (line.From + line.Duration)) {
    document.getElementById(divObject).innerHTML=line.Text;
    break;
   }
  }
}
  catch (err) { }
}

About SubPLY
With billions of video being viewed online across the globe, with viewers increasing their demand for quality content in their local language, with websites trying to improve their SEO results and with new regulations requiring online video to be hearing-impaired accessible (section 508), the creation of quality transcripts, captions and subtitles has become a must.

SubPLY is the leader in the creation, management and service in providing transcripts, captions and subtitles for both on-demand and live streaming videos.
Professional Services
SubPLY specializes in the provision of professionally-created content, tools and services for your online content.
Live Captions
Live, professionally created captions by certified stenographers in 6 languages: English, Spanish, French, German, Swedish and Mandarin
Online service
Order online - Transcripts, Captions and Subtitles for your videos in 3 easy steps.

Learn more on linking/upload a file to SubPLY and SubPLY’s standard of service.








PLYmedia Inc. 2006-2012 All Rights Reserved - Terms | Policy