Javascripts library for EcoCDN
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>
General steps are:
- Include EcoCDN scripts.
- Create a player instance.
- Call init function for the player.
Use window.Trscker
to init ... :
-
initHlsJsPlayer
- hls.js player integration -
initClapprPlayer
- Clappr player integration -
initJwPlayer
- JW Player integration -
initVideoJsHlsJsPlugin
- another Video.js player integration
We support 4 popular players.
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);
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});
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,
});
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,
})
Support Teams - support@ecocdn.net