Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcelbeumer/94bff44ee8cd6e4308c7062f221f05ac to your computer and use it in GitHub Desktop.
Save marcelbeumer/94bff44ee8cd6e4308c7062f221f05ac to your computer and use it in GitHub Desktop.
// video player api code
setContent(content: VideoContent) {
// ...
videoJsPlayer.src(sources)
// ...
tracker({ content, type: 'contentChanged' })
},
// our player tracker code that gets a contentChange event
switch (event.type) {
case 'contentChanged':
const { trackingProperties } = event.content
if (bitmovinAnalytics) {
const metadata = trackingProperties && trackingProperties.bitmovinAnalytics
// FIXME: using internal APIs to get things working but we shouldn't
const { analytics } = bitmovinAnalytics
analytics.sample = analytics.setupSample()
analytics.startupTime = 0
analytics.config = { ...analytics.config, ...metadata }
analytics.init()
}
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment