Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@glomex/content-sdk-js

Package Overview
Dependencies
Maintainers
18
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glomex/content-sdk-js

SDK that offers easy access for developers to video sources and glomex tracking events

  • 1.1.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
18
Created
Source

content-sdk-js

An SDK that offers easy access for developers to video sources and to transfer tracking events to glomex.

Demo

To run the example project, clone the repo, and run npm install from the root directory first.

Installation

Using npm:

npm install @glomex/content-sdk-js

Using yarn:

yarn add @glomex/content-sdk-js

In a browser:

<script src="//player.glomex.com/content-sdk/1/glomex.content-sdk.js"></script>

Note:
This SDK module uses ES6 syntax and requires the consumer to use babel compiler and to provide a proper Promise polyfill.

Usage

const GlomexContentSdk = require('@glomex/content-sdk-js');

// Fill your config here
const config = {
    integrationId: '[INTEGRATION_ID]',
    contentId: '[CONTENT_ID]'
};

// GlomexContentSdk is asynchronous
// so there is no need to wait for loading in your code
const glomexContentSdk = new GlomexContentSdk(config);
const videoSourcesLoaded = glomexContentSdk.getSources();

// ... other preparations ...

videoSourcesLoaded.then(function(sources) {
    const videoPlayer = createOwnVideoPlayer(sources);
    
    // tracking is asyncronous too, so you don't wait here
    glomexContentSdk.trackContentBegin();
    
    // before your video begin
    videoPlayer.addEventListener('loadeddata', function() {
      // asynchronous operation
      glomexContentSdk.trackAdBegin('preroll'); 
    });
    
    // after your video ended
    videoPlayer.addEventListener('ended', function() {
      // asynchronous operation
      glomexContentSdk.trackAdBegin('postroll');
    });
    
    // play your video
    videoPlayer.play();
}, function(error) { // rare you can get an error 'no video'
  console.log(error);
});

In case you don't have any video player on the page, use our script for creating HTML5 video player and getting this example working. Otherwise the createOwnVideoPlayer function should return a video player object.

<script src="//player.glomex.com/content-sdk/1/create-video-player.js"></script>

More

To learn more about content-sdk visit our Content SDK Integration Guide


Made with ♥ by glomex

FAQs

Package last updated on 04 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc