Developers ยป Player API

Player API Overview

The official.fm Player API provides a simple way to create Flash and HTML5 players for tracks and playlists.

You can listen to player events such as play, pause, endOfTracklist, etc.

Getting started

In your HTML document's head, reference the API's JavaScript file:

<script src="http://play.official.fm/player_api.js" type="text/javascript"></script>

Then you can create a simple player like this:
var player = OfficialFM.Player.create({
  container_id: 'player_container',
  type: 'track',
  id: 7137
});

The call above uses a number of defaults: this will create a Flash small player, but you can tune a lot of things in the options hash.

Once created, the player object can be controlled by calling various methods.