Insights with THEOPlayer
Options
All
  • Public
  • Public/Protected
  • All
Menu

THEOPlayer Hive Plugin

Usage:

<div id="theo-hls" class="is-closeable"></div>

<script>
    var element = document.getElementById('theo-hls');

    // Setup the player
    var player = new THEOplayer.Player(element, {
        libraryLocation : 'js',
        ui : {
            width : '100%',
            fluid : true
        }
    });
    player.autoplay = true;

    // Setup Hive Plugin
    THEOplayer.initHiveSDN(player, <TICKET_URL>, {
      debugLevel: "debug",
      // hiveTechOrder: Array of Techs. Tehcs available: "HiveJava", "StatsJS", "HiveJS"
    }).then(function (hiveSession) {
        // When Hive Init Succed, just set the retrieved source
        console.log('Session Activated', hiveSession);
        player.source = {
            sources : [{
                src : hiveSession.manifest,
                type : 'application/x-mpegurl'
            }]
        };
    }).fail(function (reason) {
        // Here it is possilbe to handle failed initialization
        console.log('Failed initializing Hive', reason);
    })
</script>

Notes:

The basic usage is illustrated above. The hive plugin is called while the player is being initialized, and currently supports three types of distributions (techs):

  • HiveJava tech: distributes the video through the Java proxy client, works on every browser but supports only one video at the time.
  • HiveJS tech: distributes the video between browsers using WebRTC, works only on WebRTC Datachannel enabled browsers, supports one video per page.
  • StatsJS tech: no video distribution, only sends telemetry data for Insights analysis but works in every browser.

We currently have three different plugin packages with the following tech order combinations:

  • [HiveJava + StatsJS]: attempts video distribution using the Hive Java client if installed and ready, falls back to only telemetries otherwise.
  • [HiveJS + StatsJS]: attempts video distribution through the browser is supported, falls back to only telemetries otherwise.
  • [StatsJS]: only telemetries

The hiveTechOder option defines the order in which the above techs within a particular plugin package should be attempted.

Other combination packages can be built on demand depending on the player support.

Index

Modules

HiveComm

HiveComm:

API of Hive Comm player integration

Options

Options:

HiveJavaOptions

HiveJavaOptions:

Configurable Options valid only for the HiveJava Tech Usage:


 options: {
     HiveJava: {
         minVersion: "2015.1.100"
     }
 }
 

initTimeout

initTimeout: number

The Hive Java tech will fail if will not initiate a session before the timeout (in millisecond)

type

{number}

default

60000

minVersion

minVersion: string

minimum version of Hive Java allowed to run

type

{string}

default

{2013.1.1}

warnSlowRespTimeout

warnSlowRespTimeout: number

send a warning to atatus if the session request takes more than the specified time

type

{number}

onActiveSession

onError

  • define a callback in case a specific tech could NOT initialize a session

    Parameters

    Returns boolean

    whether you want the plugin to try to initialize the session through the next techs

HiveTechOptions

HiveTechOptions:

Options specific for each tech
Usage:


 options: {
      StatsJS: {
          onError:function (error) {
              console.log(error)
              // return whether you want the plugin to try to
              // initialize the session through another tech
              return true
          },
          onActiveSession:function (session) {
              console.log("active hive session ", session)
          }
      }
 }

initTimeout

initTimeout: number

The tech will fail if will not initiate a session before the timeout (in millisecond)

type

{number}

default

30000

onActiveSession

onError

  • define a callback in case a specific tech could NOT initialize a session

    Parameters

    Returns boolean

    whether you want the plugin to try to initialize the session through the next techs

Options

Options:

General configurable options

constructor

debugLevel

debugLevel: string

configure the debug level for the Hive Player Plugin. The allowed levels are:

  • error
  • warn
  • notice
  • info
  • debug

default

notice

feedbackPeriod

feedbackPeriod: number

the feedback interval of statistic forwarding in millisecond.

type

{number}

default

2000

hiveTechOrder

hiveTechOrder: Array<string>

order in which the hive techs ({@link HiveComm.Tech.Techs}) will try to resolve a ticket Usually the default tech order depends on the plugin license:

  • [player].stats.hive.min.js default tech order is: ['StatsJS']
  • [player].hive.min.js default tech order is: ['HiveJava', 'StatsJS']
  • [player].hivejs.hive.min.js default tech order is: ['HiveJS', 'StatsJS']

it is possible to override the default tech order for example to disable HiveJava proxy and use directly only the StatsJS telemetry pack

type

{string[]}

loggerTimestamp

loggerTimestamp: boolean

if true dinamically appends a timestamp to the console logs

type

{boolean}

default

true

monitorPort

monitorPort: number

Hive Java monitor port

type

{number}

default

8899 for http, 8898 for https

playerPort

playerPort: number

Hive Java player port

type

{number}

default

8999 for http, 8998 for https

silent

silent: boolean

if true activate the Hive-Tester Driver feedback to monitor the player status

type

{boolean}

default

false

telemetryId

telemetryId: string

Customer-defined userId. This information will be added to the Insights Peer Report.

useSessionCheck

useSessionCheck: boolean

enable or disable the check for other active sessions on Hive Java. Default off;

type

{boolean}

onLoadingCompleted

  • define a callback that will be called when the hive setup completes. The argument will be a special reference to the HivePlugin with special APIs. See: HivePluginReference

    Parameters

    Returns void

onSourceSetCompleted

  • onSourceSetCompleted(statusCode: number): void
  • define a callback to be called when the hive setup completes. This will give the status code generated by the Plugin Status Code Generator See: comm.hive.ts

    Status Codes Table

    Status Description Status Code (Hexadecimal) Status Code (Decimal)
    Success - Plugin Started with StatsJs Tech 0x00010000 65536
    Success - Plugin Started with Hive Java Tech 0x00100000 1048576
    Success - Plugin Started with HiveJS Tech 0x01000000 16777216
    Error - Hive Plugin not Allowed (amp only) 0x10000000 268435456
    Error - Ticket Not Resolved 0x20000000 536870912
    Error - Plugin Initialization Timeout 0x30000000 805306368

    Parameters

    • statusCode: number

    Returns void

UrlConfigurableOptions

UrlConfigurableOptions:

List of parameter names that can be passed to the page URL to setup correspondent plugin options.

hiveDebugLevel

hiveDebugLevel: string

hiveDebugLevel accepts a string value to initialize the debug console level. The valid values are the same as "debugLevel"

type

{string}

hiveDebugTimestamp

hiveDebugTimestamp: string

hiveLoggerTimestamp accepts a boolean value to activate or deactivate appending a timestamp in our console logs

type

{boolean}

hiveJavaTimeout

hiveJavaTimeout: string

configure the timeout in millisecond for the java tech to resolve the ticket

type

{number}

hiveMonitorPort

hiveMonitorPort: string

hiveMonitorPort url parameter accepts a numeric value for the monitor port binded by Hive Java client

type

{number}

hivePlayerPort

hivePlayerPort: string

hivePlayerPort url parameter accepts a numeric value for the player port binded by Hive Java client

type

{number}

hiveSetupTimeout

hiveSetupTimeout: string

configure the timeout in millisecond for the plugin ticket initSession

type

{number}

hiveSilent

hiveSilent: string

hiveSilent url parameter accepts a boolean value to initialize a session as a silent test one. If true, HiveComm will start a periodic ping back to the local Hive Tester instance

type

{boolean}

hiveWarnJavaTimeout

hiveWarnJavaTimeout: string

configure the timeout in milliseconds for the java tech to resolve the session request

type

{number}

HiveSessionErrorCode

HiveSessionErrorCode:

Error codes for failure in initializing Hive Sessions

GENERIC_ERROR

GENERIC_ERROR:

Generic Undefined Error

NO_TECH_AVAILABLE

NO_TECH_AVAILABLE:

No Tech available to resolve the ticket

NO_TECH_RESOLVED

NO_TECH_RESOLVED:

No available Tech could resolved the ticket

TECH_ERROR

TECH_ERROR:

Stopped resolving session on last tech onError

TICKET_ERROR

TICKET_ERROR:

The ticket could not be resolved

HiveSessionErrorString

HiveSessionErrorString:

Error messages corresponding to the HiveSessionErrorCode

Generic Undefined Error

Generic Undefined Error:

No Tech available to resolve the ticket

No Tech available to resolve the ticket:

No available Tech could resolved the ticket

No available Tech could resolved the ticket:

Stopped resolving session on last tech onError

Stopped resolving session on last tech onError:

The ticket could not be resolved

The ticket could not be resolved:

HiveTechErrorCode

HiveTechErrorCode:

Internal code of the Hive Tech Error

NOT_READY

NOT_READY:

the tech is not ready to resolve the ticket or initialize a HiveSession

PLUGIN_ERROR

PLUGIN_ERROR:

generic unspecified plugin error

SESSION_ERROR

SESSION_ERROR:

an error happened while initializing the HiveSession

TICKET_ERROR

TICKET_ERROR:

an error happened while resolving/verifying the ticket

TIMEOUT_ERROR

TIMEOUT_ERROR:

the tech didn't initialized the ticket before the timeout

VERSION_ERROR

VERSION_ERROR:

the tech doesn't satisfy the minimum version requirement

MainStatusCode

MainStatusCode:

This is the main status code, which will be used to generate the first 4 bits of the plugin status code

HIVE_NOT_ALLOWED

HIVE_NOT_ALLOWED:

The plugin is not allowed as SDN (only for AMP)

OK

OK:

The plugin initialization completed without errors

TICKET_NOT_RESOLVED

TICKET_NOT_RESOLVED:

It was not possible to resolve the ticket with the specified techs

TIMEOUT_RESOLVING_TICKET

TIMEOUT_RESOLVING_TICKET:

The plugin initialization and ticket resolving process timed out

Techs

Techs:

list of available Hive Techs

N.B. Please insert new techs just at the bottom of the list, in order to keep the status code for the plugins consistent, since it is dependent by the value of this enumeration Check test: 'when the hive plugin successfully starts, we get the code of the tech active'

HiveJS

HiveJS:

use the in-browser Hive client to retrieve the video from the CDN or the P2P Network HiveJS works only on browser that support WebRTC Datachannels (Chrome +38, Firefox +31 or Opera)

HiveJava

HiveJava:

use the Java installed Hive client to retrieve the video from the CDN or the P2P Network

HiveJsProxy

HiveJsProxy:

use the electron based installed HiveJS client to retrieve the video from the CDN or the P2P Network

StatsJS

StatsJS:

use only the browser telemetry package for Hive Insights

HivePluginReference

HivePluginReference:

Reference to the Hive Plugin

constructor

hivePlugin

hivePlugin: HivePlugin.Plugin

getPluginStatusCode

  • getPluginStatusCode(): number
  • return the plugin status code generated by the Plugin Status Code Generator

    Returns number

HiveSession

HiveSession:

Object containing information about the initialized Hive Session

id

id: string

the identifier of the session

manifest

manifest: string

the resolved manifest to be loaded by the player
It can either be the actual CDN manifest (Stats Pack/Hive.js) or the manifest proxied through Hive Java client.

tech

tech: string

the Hive technology that initialize this session

ticketUrl

ticketUrl: string

the url of the ticket

HiveSessionError

HiveSessionError:

Object containing information for failure in initializing Hive Session

code

detailedMessage

detailedMessage: string

message

message: string

ticketUrl

ticketUrl: string

HiveTechError

HiveTechError:

Object containing information about the Hive Tech Error that prevented the initialization of a Hive Session

constructor

code

message

message: string

ticketUrl

ticketUrl: string

getHiveSessionErrorMessage

HiveConfig

HiveConfig:

Module for Global Hive Configurations.

This configuration can be accessed directly, e.g.

HiveConfig.ErrorMonitor.enabled = false

ErrorMonitor

ErrorMonitor:

Overriding configurations for the Error Monitoring component. The ErrorMonitoring component provides RUM (Real User Monitor) and error tracking. This configurations are global per page.

enableKeyCombination

enableKeyCombination: boolean

Upload Log Key Combination enabled. If true, pressing the combination CTRL + SHIFT + X will upload the last 10 logs

default

true

enabled

enabled: boolean

Error Monitor enabled.

type

{boolean}

default

build-dependent

enabledErrorFilter

enabledErrorFilter: boolean

enable a filter for JS errors. If true it will track only errors generated by the Hive plugin only.

type

{boolean}

default

false

enabledRUM

enabledRUM: boolean

Real User Monitor enabled. If true the component will monitor and send performance data of page and AJAX

type

{boolean}

default

false

key

key: string

ErrorMonitor user key

type

string

version

version: string

ErrorMonitor reporting version

type

string

Classes

HiveTheo

HiveTheo:

constructor

  • new HiveTheo(player: any, options: any): HiveTheo

currentBitrate

currentBitrate: number

eventsRegistered

eventsRegistered: boolean

extendedStats

extendedStats: HivePlayerExtendedStats

lastEvent

lastEvent: any

loggerId

loggerId: string

options_

options_: Options

player

player: any

pluginName

pluginName: string

pluginReference

pluginReference: HivePluginReference

version

version: string

addTechEvent

  • addTechEvent(event: TechEventRecord): void
  • appends a tech event record

    Parameters

    • event: TechEventRecord

    Returns void

filterProgressEvent

  • filterProgressEvent(event: PlayerEvents): void

flushTechEvents

  • flushTechEvents(): Array<TechEventRecord>
  • reset and returns all the tech event records collected so far

    Returns Array<TechEventRecord>

getActiveSession

getBufferLen

  • getBufferLen(): number

getCommVersion

  • getCommVersion(): string
  • Returns string

getCurrentTime

  • getCurrentTime(): number

getExtendedStats

  • getExtendedStats(): HivePlayerExtendedStats

getPlayerSource

  • getPlayerSource(): any

getPlayerTech

  • getPlayerTech(): string

getPlayerVersion

  • getPlayerVersion(): any

getPluginId

  • getPluginId(): any

getPluginName

  • getPluginName(): string

getPluginVersion

  • getPluginVersion(): string

getStatusCode

  • getStatusCode(): number
  • returns the current status code of the plugin

    Returns number

getStreamProtocol

  • getStreamProtocol(): StreamProtocol

getTelemetryId

  • getTelemetryId(): string
  • returns the configured telemetryId passed in the Hive Plugin initialization options

    Returns string

getWindowSize

  • getWindowSize(): object

initSession

  • initSession(ticketUrl: string): Promise<HiveSession | any>

initStatusCode

  • initStatusCode(): void
  • initialize the status code of teh plugin to 0x00000000

    Returns void

isActive

  • isActive(): boolean

isFullscreen

  • isFullscreen(): boolean

isLive

  • isLive(): boolean

isSessionActive

  • isSessionActive(): boolean
  • true if the current watched manifest corresponds to the active HiveSession

    Returns boolean

logger

  • logger(): any

onActivateSession

  • onActivateSession(explicitPlayerSource?: string): boolean
  • Called after the initial metadata have been received from the player in order to activate the initialized Session

    Parameters

    • Optional explicitPlayerSource: string

    Returns boolean

onEndBuffering

  • onEndBuffering(): boolean
  • Returns boolean

onError

  • onError(errorCode: any, errorString?: string, closeSession?: boolean): void
  • Parameters

    • errorCode: any
    • Optional errorString: string
    • Default value closeSession: boolean = true

    Returns void

onEventFeedback

  • onEventFeedback(event: PlayerEvents, objEvent?: any): void
  • Parameters

    • event: PlayerEvents
    • Optional objEvent: any

    Returns void

onSetupTimeout

  • onSetupTimeout(): void
  • called when the player decided that the ticket resolve took too long and there is no need for it anymore

    Returns void

onStartBuffering

  • onStartBuffering(sendEvent?: boolean): void
  • Parameters

    • Optional sendEvent: boolean

    Returns void

options

registerEvents

  • registerEvents(): void

registerGenericEvents

  • registerGenericEvents(): void
  • Returns void

resetSession

  • resetSession(completeClose?: boolean): void
  • close the current active/initialized session, reset the active and initialized session values and reset the timers and stop the periodic stats

    Parameters

    • Optional completeClose: boolean

    Returns void

resolveTicketPromise

  • resolveTicketPromise(ticketUrl: string): Promise<HiveSessionInternal>
  • Attempt to resolve a ticket through any of the available techs

    In a loop through all the tech, one at the time:

    • First checks if the tech is available
    • Then checks if the tech needs a Reporting Instance (verified ticket)
    • Then tries to initialize a session with that tech
    • If successful, resolve the promise with the initialized HiveSession

    In case no tech can resolve the Session, an the Promise will fail with a HiveTechError

    Parameters

    • ticketUrl: string

    Returns Promise<HiveSessionInternal>

setStatusCode

  • setStatusCode(mainStatusCode: number, tech?: HiveTech): void
  • set the status code according to the MainStatusCode and the tech used the hexadecimal code is structured like this: 0x 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 The 7th position defines the overall status, specified by MainStatusCode The positions from the 6th to the 0th define which Tech is active. The Techs enumeration is used in order to calculate which position refers to which tech.

    Parameters

    • mainStatusCode: number
    • Optional tech: HiveTech

      (optional, used only when the MainStatusCode is OK)

    Returns void

startPeriodicFeedback

  • startPeriodicFeedback(): void
  • Returns void

stopPeriodicFeedback

  • stopPeriodicFeedback(): void
  • Returns void

updatePlayerInfo

  • updatePlayerInfo(ri: ReportingInstance): void
  • Parameters

    • ri: ReportingInstance

    Returns void

Variables

HIVE_COMM_JAVA

HIVE_COMM_JAVA: boolean

HIVE_COMM_JS

HIVE_COMM_JS: boolean

HIVE_PLUGIN_TIMEOUT

HIVE_PLUGIN_TIMEOUT: number

THEOplayer

THEOplayer: any

Functions

initHiveSDN

  • initHiveSDN(player: any, ticketUrl: string, options: any): Promise<HiveSession>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc