The entry point to the Bitmovin Player is the static API that can be used to create player instances. The static API is either available as a global namespace on the window
object when including bitmovinplayer.js
via <script>
tag into a HTML page, or as a local object when used as NPM package or loaded through RequireJS.
A player instance from the global namespace is created like this, where id
is an ID if a DOM element where the player will be loaded into:
var player = bitmovin.player('id'); // OR window.bitmovin.player('id');
A player instance from the NPM package is created like this:
var bitmovinPlayer = require('bitmovin-player');
var player = bitmovinPlayer('id');
The created player
exposes the Player API that can be used to specify the source and configure and control the player:
player.setup({
key: 'MY-PLAYER-KEY',
source: {
dash: 'https://path/to/mpd/file.mpd',
hls: 'https://path/to/hls/playlist/file.m3u8',
smooth: 'https://path/to/manifest/file/Manifest'
}
}).then(function() {
player.play();
});
Specifying a key in the player config is mandatory on all domains except localhost
. The personal key can be found in
the Bitmovin Dashboard and should be specified as string. Do not forget to add all your
domains (subdomains are included) to your account.
The Player API is ready when the setup or load Promise resolved, or when the ON_READY event was fired.
The API is not available anymore after destroy.
Generated using TypeDoc