Using the Smart Player API

The Smart Player API allows you to create custom dynamic solutions in JavaScript that work with both Flash and HTML players. This API facilitates development of solutions for Video Cloud smart players, those players that detect their environment, and serve videos with Flash players where supported and installed, or otherwise serve videos with HTML players. Use the Smart Player API to create dynamic solutions and extend the functionality and behavior of players created from the standard templates in the Video Cloud Studio.

Note that the Smart Player API will not work when the page is opened as a local file (file://...etc.). In order to test files locally, you will need to serve them through a local web server like XAMPP, MAMP, or LAMP.

Brightcove developed the Smart Player API so that Video Cloud developers can code solutions that work consistently for Flash and HTML players. In doing so, rather than building new methods on top of the existing Player API, we decided to develop a new API from scratch. Building the new Smart Player API has the advantages of saving developers the burden of deciphering which methods are supported against HTML and which are not, and gives us the opportunity to implement an asynchronous communication structure more inline with JavaScript, as well as accommodate requests we’ve heard from developers for namespaced JavaScript classes.

Going forward, we’ve changed the name of the legacy Player API to the Flash-only Player API, when coding in JavaScript, and the Flash Player Plug-In API, when coding in ActionScript. While the new Smart Player API does supports common functionality, it does not support all the functions currently available through the Flash-only Player API. We plan to build features into the Smart Player API that get it to parity with the Flash-only Player API, and phase out building new features for the Flash-only Player API.

The Smart Player API exposes objects, methods, events, and types for coding additional functionality for your Video Cloud smart players and has the following characteristics:

  • A JavaScript API—All solutions written in JavaScript only embedded in the web page hosting the player, with optional references to external JavaScript files.
  • Smart Player support—Solutions work for players in both Flash and HTML mode.
  • In-progress—At this time, the Smart Player API does not have full parity with the existing Flash-only Player API.
  • Asynchronous communication–Coding requires asynchronous getters and call backs.

The Smart Player API Core Modules

The Smart Player API includes the following core modules:

Module Name General Functionality
Content Module Retrieves videos and playlists from the Video Cloud service for the player
Video Player Module Handles video playback interaction and fires events related to these interactions
Experience Module Parent module for all other API modules; handles the player template behavior and elements; use this module for listening for player load events, and for player resizing
Cue Point Module Manages cue points for videos; provides an interface for the player to send notifications at specific points during playback
Advertising Module Allows you to add listeners for ad start and complete events

For the list of contents for the core module objects, and for definitions and sample uses of the currently available classes, methods, events, and types of the API, see The Smart Player API Reference.

Getting started with the Smart Player API

  1. Determine if the Flash-only Player API, the Smart Player API, or a hybrid of both is right for your project, see the decision tree in:
  2. Begin using the Smart Player API by taking steps to prepare your player for Smart Player API coding:
  3. Once your player is ready, try creating a basic solution using one of the following examples: