Player functions

createPlayer

Creates a video player for the given video ID. Requires a context to be present to be able to distinguish for what video request this video was played.

The created player is an iframe that, other than having no frameborder, has no default styling. If you’re not using the UI functions built into the embed code, it is advised that you wrap the player in a responsive embed container.

createPlayer(ctx, videoId, [config]);

Arguments#

  • ctx (Object): A context object returned by Autheos.getVideos. Used to identify for what video request this event is relevant.
  • videoId (Integer) The video ID to create a videoplayer for. This video ID should be present in the context.
  • config (Object) A custom configuration object to supply to the videoplayer.

Returns#

Returns an iframe element representing the videoplayer.

Example#

Autheos.createPlayer(ctx, video.id, {
  autoplay: false,
  appname: 'default' // to change skin
});

embedPlayer

Embeds a video player into the given target(s). This is primarily a helper to make it easier to embed videos, as this fucntion is technically able to embed any sort of HTML element.

embedPlayer(ctx, player, [target]);

Arguments#

  • ctx (Object): A context object returned by Autheos.getVideos. Used to identify for what video request this event is relevant.
  • player (Element) A player iframe created by createPlayer.
  • target (Object) The node to embed a videoplayer into. This can be a HTML element, a CSS selector, or an array of either.

Returns#

Returns the HTML elements that now contain a videoplayer.