Getting Started with the video player SDK for JavaScript
You can integrate a video player with content from Cloud Video into your JavaScript
Connecting a player on your page
To connect a player to a page, add the following code to it:
<script src="https://runtime.video.cloud.yandex.net/player/js/player-sdk.js"></script>
Initializing a player
To initialize a player, add the following code to the page:
var player = Ya.playerSdk.init({
/** @type {(string|HTMLElement)} where the player will be created */
element: 'video-player',
/** @type {string} playable content link */
source: 'https://runtime.video.cloud.yandex.net/player/...',
/** @type {boolean} autoplay when loading content */
autoplay: false
});
Where https://runtime.video.cloud.yandex.net/player/...
is a link to playable content, e.g., https://runtime.video.cloud.yandex.net/player/video/vplvmyqsxi7dlwndvb4y
. For more information, see Getting an embed code or link to a video and Getting an embed code or link to a broadcast.
For more information on initializing a player, see the following sections:
- Player initialization parameters
- Interface: PlayerSdkInitConfig API reference
- Interface: PlayerSdkSourceParams API reference
Player controls
For information on player control methods, see the following sections:
- Player methods
- Interface: PlayerSdkApi API reference
Player state
For information about an object containing player state parameters, see the following sections:
- Player state
- Interface: PlayerSdkState API reference
Player events
For information about player events, see the following sections:
- Player events
- Interface: PlayerSdkEventHandlers API reference