Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

It is possible to implement a callback function, which executes code as soon as a player is loaded. You can hand over define the function name containing several actions that is called when loading the public API of the respective player is loaded.

The property 'success' must be set as value to the player property object.

Sample

In the code example, the respective player will be loaded when the user is clicking on a button. If loading is completed, the following functions are executed: the player is started, the video is forwarded to the set time point and the sound is turned off.

Note

Please note that you need to specify necessary IDs and URLs.

 

Panel
bgColor#DCDCDC
<!DOCTYPE html>
<html>
<head>
<script src="//video-cdn.net/v2/embed.js"></script>
</head>
<body>

<div id="1234"></div>

<script type="text/javascript">

	var playerProps = {
		success: function(playerApi){
			playerApi.play();
			playerApi.forward(20000);
			playerApi.toggleMute();
		
		}
	};

	loadPlayer = function () {
            var element = document.getElementById('1234');
            var player = document.createElement('div');
            player.setAttribute('mi24-video-player', '');
            player.setAttribute('config-type', 'vmpro');
            player.setAttribute('player-id', '<PlayerID>');
            player.setAttribute('video-id', '<VideoId>');
            player.setAttribute('api-url', '//video-cdn.net/play');
            player.setAttribute('flash-path', '//video-cdn.net/v2/');
            element.appendChild(player);
            VideoPlayer.Collection.addPlayerById('1234', playerProps);
        };
</script>

<button onclick="loadPlayer()">load</button

<div mi24-video-player video-id="<VideoId>" player-id="<PlayerId>" config-type="vmpro" 
flash-path="//video-cdn.net/v2/" api-url="//video-cdn.net/play"></div><script
src="//video-cdn.net/v2/embed.js"></script> </body> </html>