The Player SDK is a JavaScript module that allows developers to interact with movingimage embedded videos, allowing for further customization and automation of the player.
To use the Player SDK in your application, follow these steps:
Add the iframe embed from VMPro to your HTML page. Example:
<iframe
id="mi-embedded-video"
src="//e.video-cdn.net/watch?video-id=123&player-id=123&channel-id=123"
allow="fullscreen"
allow="autoplay"
frameborder="0"
></iframe>
Import the SDK and initialize the Player:
<script type="module">
import { Player } from 'https://e.video-cdn.net/mi-player-sdk/mi-player-sdk.js';
const player = new Player('mi-embedded-video');
// Now you can use the player object to interact with the embedded video player
</script>
Now you can use the player object to interact with the embedded video player. For example:
// Add event handler to know when video is playing
player.on('play', () => {
console.log('Video play requested!');
});
// Play the video
player.play().then(() => {
console.log('Video is now playing!');
});