Content API and HTML Widgets

If you are developing your own custom HTML pages you may wish to interact with the Claro Course player. Using our standards based approach Claro has an API that allows you to send Javascript commands to the course player from your custom HTML pages.

The contentAPI object provides a façade to the objects and methods that make up the core of the player. Using this, widget developers can, via javascript, interact with the course player, query for course information, or set course completion.

The object is defined in /player/scripts/contentApi.js, located in a published course. The object is in the global scope of the course player window, and an HTML widget is loaded in a frameset, so developers must refer to the API as parent.contentApi

You can download several basics samples from the links provided at the bottom of this article.

BASIC USAGE EXAMPLE:

//Use the API to advance to the next page parent.contentApi.contentGoNext()

Some of the commands that are available in the API are:

Navigation Controls

contentGoBack ()

contentGoNext ()

exitCourse ()

hideBack ()

hideBoth ()

hideForward ()

hideGlossaryBrowser ()

hideMenu ()

hideResourceBrowser ()

hideTranscript ()

jumptoSubeo (subeoID)openModal (url)printPage ( )

resetPage ()

showBack ()

showBoth ()

showCorrectAnswers ()

showForward ()

showGlossaryBrowser ()

showMenu ()

showResourceBrowser ()

showTranscript ()

submitQuestion ()

takeTest ()

toggleGlossaryBrowser ()

toggleMenu ()

toggleResourseBrowser ()

toggleTranscript ()

tryAgain ()

Course Information

getCourseCompletion ()

getCourseLanguage ()

getCourseName ()

getCoursePageCount ()

getCourseScoreAvg ()

getCurrentModuleName ()

getDuration ()

getMaxTestAttempts ()

getModules ()

getModuleScore (moduleID)

getModuleTestCompleteCount ( )

getModuleTestCount ( )

getPassMark ( )

getStatus ( )

getStudentName (callback )

setObjectCompleted ()

Variables

getData ( label )

setData ( label, value )

Events

playerEvent.remove (name, handler )

playerEvent.on ( name, handler )

Note: For a complete API and more information please contact dominKnow support.