@blendvision/link
v2.0.0-canary.17
Published
This project provided BlendVision Link SDK, and you can use `startPlaybackSession` from the `@blendvision/link` package.
Downloads
876
Readme
Note: This is the latest document to the project.
BlendVision Link SDK
This project provided BlendVision Link SDK, and you can use startPlaybackSession
from the @blendvision/link
package.
BlendVision Player Integration
This project demonstrates how to integrate the BlendVision Player with the BlendVision Link SDK using npm.
Getting Started
To use BlendVision's video playback features, you'll need two things:
- A valid BV Playback Token.
- A valid BV Player License Key.
Installation
To include the necessary libraries via npm, run:
npm install @blendvision/link @blendvision/player
Usage
Below is an example of how to integrate the BlendVision Player with the BlendVision Link SDK.
import { startPlaybackSession } from '@blendvision/link';
import { createPlayer } from '@blendvision/player';
// Replace with your BlendVision playback token and license key
const TOKEN = 'YOUR BV PLAYBACK TOKEN';
const LICENSE_KEY = 'YOUR BV PLAYER LICENSE KEY';
let player;
// Start the playback session using the token
startPlaybackSession({
token: TOKEN,
}).then((session) => {
// Create the BlendVision player
player = createPlayer('my-player', {
license: LICENSE_KEY,
modulesConfig: {
['analytics.resource_id']: session.content.id,
['analytics.resource_type']: session.content.type,
},
});
// Load the playback sources from the session
player.load(session.sources);
});
HTML Markup Example
Ensure that the player has a container in your HTML:
<!DOCTYPE html>
<html lang="en">
...rest code
<body>
<div id="my-player"></div>
<script type="module">
import 'https://unpkg.com/@blendvision/[email protected]';
import 'https://unpkg.com/@blendvision/[email protected]';
const TOKEN = 'YOUR BV PLAYBACK TOKEN';
const LICENSE_KEY = 'YOUR BV PLAYER LICENSE KEY';
let player;
BlendVisionLinkSDK.startPlaybackSession({
token: TOKEN,
}).then((session) => {
player = BlendVision.createPlayer('my-player', {
license: LICENSE_KEY,
modulesConfig: {
['analytics.resource_id']: session.content.id,
['analytics.resource_type']: session.content.type,
},
source: session.sources,
});
});
</script>
</body>
</html>
Configuration
token
: The playback token that authenticates the session.license
: The player license key required for player initialization.analytics.resource_id
: Configures analytics for tracking content.analytics.resource_type
: Specifies the type of content (e.g., video, event).
Cleanup
When you're done with the playback session, you can clean up resources as follows:
// Clean up resources when done
function onExit() {
player.unload();
session.end();
}
License
This project uses the BlendVision SDK, and you should have proper licenses and tokens to use their services.