Simple playback
Using the sources api for adding a source is straight forward. And for this we can use the default behaviour of the player - where when ever the source is added, it is automatically attached and is the active one.
const player = bitmovin.playerx.Player({
key: 'YOUR-PLAYER-KEY',
defaultContainer: document.getElementById("player-container")
});
const firstSourceConfig = {
resources: [{
url: 'https://cdn.bitmovin.com/content/assets/streams-sample-video/tos/m3u8/index.m3u8',
}]
}
const firstSourceApi = player.sources.add(firstSourceConfig);
firstSourceApi.play();
We are now able to use firstSourceApi
(source/playback api) to control that source. Read more about available methods in SourceAPI in here.
If you want to learn how to add multiple sources, and control their load control, please checkout page about adding multiple sources.
Updated 3 months ago