Setting Up Support for JavaScript Embedding

Last updated on Dec 17, 2020

Support for a JavaScript version of HVC Premium player (Bitmovin) has been added to the player generator that is supported (optionally) for each account.

Important

Contact your representative or Sales to whitelist the JavaScript player on your domain(s).


To set up support for the JavaScript player:

  1. Once enabled, you can choose between the iFrame or JavaScript tabs to select the player embed code you want. 

  2. Click the Copy to Clipboard button at the bottom of the panel.

You can now paste the embed code in your desired website.

A deconstructed embed code example follows.

Javascript Version of the HVC Premium Player (Bitmovin)
// First line loads dynamically all player scripts and styles based upon player 
// settings, custom styles, and custom JavaScript.
//
<script src="http://beta.hvc.haivision.com/feeds/players/premiumjs/{AccountID}/{playerId}/js"></script>
//
// A DIV element is added in which to inject the player HTML (this can be anywhere on 
// the page).
//
<div id="hvcPlayerHolder" class="keep-aspect-16-9"></div>
//
// Then you initialize the player using the DIV ID (from above) as the first 
// parameter and the player settings as the second parameter.
//
<script>
	PremiumPlayer("hvcPlayerHolder",{
		pid:"MPX_PID"
	})
</script>
//
// A third parameter is also supported that calls a function with player and player 
// configuration after loading the page. The following shows how, once the player has been 
// loaded, the player config is logged and autoplay muted.
//
<script>
	PremiumPlayer("hvcPlayerHolder",{
		pid:"MeridianSD"
	}, function(player, config){
    console.log("Player loaded With Config:",config)
    player.mute()
    player.play()
})
</script>