ecocdn

2.9.10 • Public • Published

npm version code style: prettier

EcoCDN SDK

Javascripts library for EcoCDN


Installation

You can get from nodejs and package manager npm :

$ npm install ecocdn

Or simply using CDN

<script source="https://cdn.jsdelivr.net/npm/ecocdn/vodjs.min.js"></script>

Basic usage

General steps are:

  1. Include EcoCDN scripts.
  2. Create a player instance.
  3. Call init function for the player.

API

Use window.Trscker to init ... :

  • initHlsJsPlayer - hls.js player integration
  • initClapprPlayer - Clappr player integration
  • initJwPlayer - JW Player integration
  • initVideoJsHlsJsPlugin - another Video.js player integration

Player Integrations

We support 4 popular players.

initHlsJsPlayer(player)

hls.js player integration.

player should be valid hls.js instance.

Example

var video_url = "https://example.com/path/to/your/playlist.m3u8";
var hls = new Hls({});

window.Tracker.initHls({player: hls, video_url: video_url});

hls.loadSource(video_url);

var video = document.getElementById("video");
hls.attachMedia(video);

initClapprPlayer(player)

Clappr player integration.

player should be valid Clappr player instance.

Example

var video_url = "https://example.com/path/to/your/playlist.m3u8";

var player = new Clappr.Player({
    parentId: "#video",
    source: video_url,
});

window.Tracker.initClappr({player: player, video_url: video_url});

initJwPlayer(player)

JW Player integration.

player should be valid JW Player instance.

Example

var video_url = "https://example.com/path/to/your/playlist.m3u8";

var player = jwplayer("video");
            
var callback = function(cb) {
    player.setup({
        file: video_url,
    });

    jwplayer_hls_provider.attach();

    if (typeof cb === "function") {
        cb();
    }
};

window.Tracker.init({
    player: player,
    video_url: video_url,
    cb: callback,
});

initVideoJsHlsJsPlugin()

Another Video.js player integration.

Example

var video_url = "https://example.com/path/to/your/playlist.m3u8";

var player = videojs("video");

var callback = function() {
    player.src({
        src: video_url,
        type: "application/x-mpegURL"
    });
}

window.Tracker.initVideojs({
    video_url: video_url,
    cb: callback,
})

Contact

Support Teams - support@ecocdn.net

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i ecocdn

Weekly Downloads

102

Version

2.9.10

License

MIT

Unpacked Size

3.05 MB

Total Files

11

Last publish

Collaborators

  • ecocdn