Close
Menu

Switch between two channels without destroying the player and speeding up the process

Experience the Bitmovin Player's ability to switch between streams without having to run setup twice. This improves the speed immensely

Click a button to show switch time.

One setup call for multiple sources

Call the setup function only for the initial player setup. The Bitmovin Player can load new sources without being destroyed and having to set up all the components again. This saves time for your customers and gives your page a more responsive feeling.

const conf = {
  key: '<YOUR PLAYER KEY>',
  playback: {
    muted: true,
    autoplay: true
  }
};

var playerContainer = document.getElementById('player-container');
var player = new bitmovin.player.Player(playerContainer, conf);

Load a source dynamically

Respond to the user's input and load a different source without having to run the setup again:

This functionality is especially valuable if you plan to create some kind of tv-station.

function switchChannel(channelID) {
  var source;
  if (channelID === '1') {
    source = {
      title: 'Art of Motion',
      description: 'What is this event... Parcour?',
      dash: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
      hls: 'https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8'
    }
  } else if (channelID === '2') {
    source = {
      title: 'Big Buck Bunny',
      description: 'A day in the life of Big Buck Bunny.',
      dash: 'https://bitmovin-a.akamaihd.net/content/bbb/stream.mpd',
      hls: 'https://bitmovin-a.akamaihd.net/content/bbb/stream.m3u8'
    };
  } else {
    source = {
      title: 'Sintel',
      description: 'The main character, Sintel, is attacked while traveling through a wintry mountainside.',
      dash: 'https://bitmovin-a.akamaihd.net/content/sintel/sintel.mpd',
      hls: 'https://bitmovin-a.akamaihd.net/content/sintel/hls/playlist.m3u8'
    }
  }

  player.load(source);
}

Create an account to get started!

No credit card required.