Skip to content

Single-point install for the Anvato video player.

Notifications You must be signed in to change notification settings

coxmediagroup/cm-anvato

Repository files navigation

cm-anvato

v3.1.10

Dependencies Dependencies Dependencies

Single-point install for the Anvato video player.

npm i coxmediagroup/cm-anvato --save

This module is also exposed as global variable cmanvato in dist/cmanvato.min.js.

This JavaScript module is intended for use with this Methode tag:

/PortalConfig/common/video/<version>/player.jpt

If you building your own playlist you may optionally override the video id set:

<p:include url="/PortalConfig/common/video/<version>/player.jpt">
    <p:param name="videoIdOverride" value="234455,3340289" />
</p:include>

This module includes support for metrics and ads.

Requires ad tags version 3.8.0 or higher.

This project adheres to Semantic Versioning. All notable changes will be documented in the changelog.

JavaScript SDK

anvato.get([id])

Safely fetch a player regardless of Anvato load state. Requests for players that don't exist yet are cached until the player exists. Returns a Promise that provides the player instance. See Anvato's documentation for more information on the player SDK.

var anvato = require('cm-anvato');
anvato.get('p0').then(function (player) {
    player.on('METADATA_LOADED', function () {});
});
// Calling without a player id will return all players.
anvato.get().then(function (players) {
    players.forEach(function (player) {});
});

anvato.set(name, value)

Update the anvp.common.config object.

anvato.set('recom', false);

anvato.setup()

Begin loading of all players in the page.

anvato.setup();

anvato.on(name, callback)

Hook into the global event handler for all Anvato players in the page. See Anvato's documentation for more information about player events.

anvato.on('METADATA_LOADED', function (event) {
    var playerId = event.sender;
});

anvato.loadPlayers()

Load additional players separate from the normal in page players. This is an option for players loaded through events such as ajax or clicks.

anvato.loadPlayers();

anvato.pauseAll()

Pauses all players in the page.

anvato.pauseAll();

Contributing

  1. Install grunt $ npm -g i grunt-cli
  2. Install the project tools $ npm i
  3. Make your code changes.
  4. Run $ grunt.
  5. Update the changelog.md to describe your changes.
  6. Commit your changes.
  7. Run $ grunt version:<major|minor|patch> --buildtask=default. This repository uses strict semver - meaning:
    • major ONLY if you introduced a breaking change to an existing public method.
    • minor If you added a new public method or enhanced an existing method in a non-breaking way.
    • patch Internal (non-public) changes - bug fixes, performance improvements, etc.
  8. Push to origin with tags. Ex) $ git push origin my-branch --tags

Building and Publishing

If your changes include template changes, you will want to build your new version to Methode. This project uses the methode-publishing toolkit for pushing and publishing to WebDav.