Support Center

Embed the Player

Last Updated: May 26, 2012 11:54PM BST

When you have included kenseiplayer.js in your page, you have the kensei.createPlayer() function available.

A player is created by calling kensei.createPlayer() with the required configuration data.

The configuration can be specified using a json object.


Required Configuration Properties

  • container: The ID of the element that will contain the player.
  • mediaItem:A mediaItem object from the kensei media api.
  • settings: A player settings object from the kensi media api.

Example showing only required config properties.


kensei.createPlayer({
  container: 'playerContainerId',
  mediaItem: mediaItemObject,
  settings: settingsObject
});

Optional Configuration Properties

  • playerURL: Specify the player swf URL.
  • skinURL: Specify the skin swf URL.
  • width: Width in pixels of the embedded player (default is 640).
  • height: Height in pixels of the embedded player (default is 360).
  • videoReady: Function which will be called when the video is ready to play.

Example showing all configuration properties.


kensei.createPlayer({
  container: 'playerContainerId',
  mediaItem: mediaItemObject,
  settings: settingsObject
  playerURL: '/player.swf',
  skinURL: '/skin.swf',
  videoReady: videoReadyHandler,
  width: 1024,
  height: 768
});

The Player Api

The kensei.createPlayer() method returns a kenseiplayer object which provides an interface to control playback.


kensiplayer object methods

  • play(): Start or resume playback of the current video.
  • pause(): Pause playback of the current video.
  • setMediaItem(): Set a new mediaItem (video or audio) for the player to load.
  • setSettings(): Set a new settings object. This will cause the player to re-rende

Example showing creating a player, playing the video when it is ready and then pausing the video after 3 seconds.


var player;

function onVideoReady() {
  player.play();

  setTimeout(function () {
    player.pause();
  }, 3000);
}

player = kensei.createPlayer({
  container: 'playerContainerId',
  mediaItem: mediaItemObject,
  settings: settingsObject,
  videoReady: onVideoReady
});

Contact Us

desk@kenseimedia.com
http://assets3.desk.com/
false
kenseimedia
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete