Description

Annoto Player Adaptor API

Hierarchy

  • IPlayerAdaptorApi

Properties

sidePanelSupported?: boolean

Description

Feature support flag. If set to true, indicates that the player has support for side panel layout, including for full screen. Player that supports side panel layout, must reserve space for the widget, if requested by the widget. The widget applies number of classes and css variables to the player element:

  • 'nn-side-panel' - class added when side panel is open
  • 'nn-side-panel-left' - class added if the side panel should be on the left.
  • '--nn-side-panel-width' - css variable indicating the required side panel width.

Methods

  • Returns boolean | Promise<boolean>

    Description

    (OPTIONAL) Get player autoplay configuration option (if player configured to play on page load)

  • Returns IControlsDescriptor

    controls descriptor object

    Description

    (OPTIONAL) Get player controls description parameters. The parameters describe behavior of the player controls.

  • Returns Element

    Description

    (OPTIONAL) Get player controls Element for embedding annoto timeline for overlay and full screen mode. NOTE: Although this method is optional it's highly recomended and will make the integration much simpler, imrove performance and provide better User experience. NOTE: if not supported the function must be undefined.

  • Returns string | number

    if string, may contain 'px'

    Description

    (OPTIONAL) Get player controls height in pixels. If supported it will be used instead of controlsDescriptor values. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect height of the player.

  • Returns boolean

    Description

    (OPTIONAL) Get player controls hidden state. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect controls state.

  • Returns number | Promise<number>

    • in seconds. Preferred Floating point precision.

    Description

    Get time of current playback position.

  • Returns number | Promise<number>

    • in seconds

    Description

    Get the total media track duration in seconds 0 or NaN or 'undefined' values may be returned until media is ready. Note: For live video for best experience return the latest known duration of the stream. (for DVR enabled live stream, it can defer from currentTime)

  • Returns Element

    Description

    (OPTIONAL) Get player Element for embedding annoto application for full screen state. If not provided the main player Element would be used (the element provided at init()). NOTE: if not supported the function must be undefined.

  • Returns boolean

    Description

    (OPTIONAL) By default Annoto will try applying a fix To enable Annoto to work when player enters Full screen. The fix is moving annoto-app container as a child of the player element or embeddableElement() annoto-app will be moved only if the player element allows it (is NOT an IFRAME). annoto-app will be moved when player enters full screen, and moved back to the original parent of annoto-app obtained at Annoto.boot() call. NOTE: In rare case when this must be disabled, return false from the function.

  • Returns boolean

    Description

    (OPTIONAL) Get player full screen state. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect full screen.

  • Returns string | number

    if string, may contain 'px'

    Description

    (OPTIONAL) Get player height in pixels. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect height of the player.

  • Parameters

    • element: Element

      html DOM element of the player (as configured by Annoto API)

    • Optional params: any

      player.params of API configuration

    Returns boolean | Promise<boolean>

    Description

    This method is called by Annoto as the first method. Use it to configure the player interface object. If the method returns false, Annoto will retry a number of times with fixed period of time between the retries. This is useful if your player needs to load some resources, or wait for some condition. Notice: For Advanced use cases, the method can return a Promise. If a Promise is returned, No retries shall be performed. Annoto will wait for Promise resolve/reject.

  • Returns boolean | Promise<boolean>

    Description

    (OPTIONAL) Return if the media is a live stream or a VOD. NOTE: if the method is not implemented VOD is assumed.

  • Returns string | Promise<string>

    Description

    Get currently played media source. The returned value, identifies the current video and must be unique. It can be a full URL or an unique identifier. Notice: this value can be overriden by player.mediaSrc widget configuration.

  • Parameters

    Returns void

    Description

    (OPTIONAL) cb should be called when click event captured on player progress bar or keydown event captured on player. Implementation of this callback may improve interactions and fast forwarding limit functionality NOTE: if not supported the function must be undefined.

  • Parameters

    Returns void

    Description

    (DEPRECATED) cb should be called when mouse enters player controls. If implemented the onControlsLeave() method must be implemented as well. NOTE: In most cases this event is not required. NOTE: if not supported the function must be undefined. If defined the main usage of this event is to hide Annoto Timeline when user hovers mouse over the players controls, for example for players where Annoto Timeline interfers with some hover functionality of the player. The function is required only for Iframe players for other players Annoto can detect the event by itself.

  • Parameters

    Returns void

    Description

    (OPTIONAL) cb should be called when player controls are hidden. If implemented the onControlsShow() method must be implemented as well. If implemented those events will be used instead of mouse tracking and controlsDescriptor.mouse parameters. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect controls state.

  • Parameters

    Returns void

    Description

    (DEPRECATED) cb should be called when mouse leaves player controls. If implemented the onControlsEnter() method must be implemented as well. NOTE: In most cases this event is not required. NOTE: if not supported the function must be undefined. If defined the main usage of this event is to hide Annoto Timeline when user hovers mouse over the players controls, for example for players where Annoto Timeline interfers with some hover functionality of the player. The function is required only for Iframe players for other players Annoto can detect the event by itself.

  • Parameters

    Returns void

    Description

    (OPTIONAL) cb should be called when player controls are shown. If implemented the onControlsHide() method must be implemented as well. If implemented those events will be used instead of mouse tracking and controlsDescriptor.mouse parameters. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect controls state.

  • Parameters

    Returns void

    Description

    (OPTIONAL) cb should be called when media is ended NOTE: if not supported the function must be undefined. Annoto will use other methods to detect media end.

  • Parameters

    • cb: ((isFullScreen?) => void)

      the callback may pass non mandatory new full screen state as boolean.

        • (isFullScreen?): void
        • Parameters

          • Optional isFullScreen: boolean

          Returns void

    Returns void

    Description

    (OPTIONAL) cb should be called when full screen state of the player changes. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect full screen changes.

  • Parameters

    Returns void

    Description

    cb should be called when the player is setup and the media metadata is loaded. Note: This method MUST be called as the first event. If your player does not support this event, simulate it by calling the cb manually.

  • Parameters

    Returns void

    Description

    (OPTIONAL) cb should be called when the media element/player is taken off of a page. Useful for dynamic websites.

  • Parameters

    Returns void

    Description

    (OPTIONAL) cb should be called when player size changes. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect size change.

  • Parameters

    Returns void

    Description

    cb should be called when the media playback current time is updated. Or when the media duration is changed. can be frequent. 200 msec is a good choice for period.

  • Returns boolean | Promise<boolean>

    • true if pause, false if playing

    Description

    Get player playback state (playing or paused)

  • Returns void | Promise<void>

    Description

    Start playing the media

  • Returns void | Promise<void>

    Description

    (OPTIONAL) called by Annoto to release resources when the widget is closing. NOTICE: Although optional this method is highly recommended if you use Annoto API to dynamically load and close the widget. The adaptor implementation should discard the events that were regsitered using the onReady, onPlay, etc. when remove() is called.

  • Parameters

    • time: number

      in seconds

    Returns void | Promise<void>

    Description

    Set the media current time of track (skip/seek to time of the track)

  • Returns string | number

    if string, may contain 'px'

    Description

    (OPTIONAL) Get player controls track (progress bar) left margin in pixels. If supported it will be used instead of controlsDescriptor values. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect height of the player.

  • Returns string | number

    if string, may contain 'px'

    Description

    (OPTIONAL) Get player player controls track (progress bar) right margin in pixels. If supported it will be used instead of controlsDescriptor values. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect height of the player.

  • Parameters

    • isPhone: boolean
    • isFullScreen: boolean

    Returns void

    Description

    (OPTIONAL) If defined will be called at view refreshes of the widget. Allows the player to perform optional adjustments to the controls descriptor. NOTE: may be called frequently, so no heavy operations should be performed.

  • Returns number

    Description

    (OPTIONAL) Get the ration of width / height of the video frame itself. Note: the ratio shold be of the video frame, not of the player element (it can be differnt). Note: In most cases this method is not required. It is required only if the controls size depends on the video frame size and not on the player element size, for example this is the case in Vimeo player.

  • Returns string | number

    if string, may contain 'px'

    Description

    (OPTIONAL) Get player width in pixels. NOTE: if not supported the function must be undefined. Annoto will use other methods to detect width of the player.