Skip to content

Instantly share code, notes, and snippets.

@michael-riha
Created August 9, 2019 06:44
Show Gist options
  • Save michael-riha/2a58abc71222b7642af98ed5fea39fe0 to your computer and use it in GitHub Desktop.
Save michael-riha/2a58abc71222b7642af98ed5fea39fe0 to your computer and use it in GitHub Desktop.
const analyticsConfig = {
key: '<ANALYTICS-KEY>',
videoId: 'video-empty',
userId: 'xxx_01',
cdnProvider: 'some_cdn',
customData1: 'sport',
title: 'video title set without a source, yet',
debug: true
};
const player = videojs('my-player');
const analytics = new bitmovin.analytics.adapters.VideojsAdapter(analyticsConfig, player);
player.ready(function(event) {
console.log("player is ready");
let sourceConfig= {
title: 'the first video title set with first source',
videoId: 'video-1'
}
console.log("before change-> ", analytics.analytics.sample.videoId, analytics.analytics.sample);
analytics.sourceChange(sourceConfig);
console.log("after change-> ", analytics.analytics.sample.videoId, analytics.analytics.sample);
player.src({
src: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8',
type: 'application/x-mpegURL',
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment