// ---------------------------------------------------
// 1. Generate the player with the Hive plugin as descibed here:
// https://support.brightcove.com/en/video-cloud/docs/getting-started-hive-streaming-and-video-cloud
// ---------------------------------------------------
<video data-account="<ACCOUNT_ID>"
data-player="<DATA_PLAYER>"
data-embed="default"
data-application-id
class="video-js"
controls></video>
<script src="//players.brightcove.net/<ACCOUNT_ID>/<DATA_PLAYER>-_default/index.min.js"></script>
<script>
// ---------------------------------------------------
// 2. Retrieve the player
// ---------------------------------------------------
var myPlayer = videojs.players.<PLAYER_NAME>;
// ---------------------------------------------------
// 3. Retrieve the Hive Ticket url
// ---------------------------------------------------
var ticket = "https://api-test.hivestreaming.com/v1/events/9002/10001/9/SISUqbMihoqWlGBi";
// ---------------------------------------------------
// 4. Initialize Hive session with the Ticket URL
// ---------------------------------------------------
myPlayer.initSession(ticket, function (manifest, session) {
console.log("resolved manifest: " + manifest + " tech: " + session.tech);
myPlayer.src([{
src: manifest,
type: "application/x-mpegURL"
}]);
}, function () {
console.log("hive could not resolve the ticket");
});
myPlayer.play();
</script>
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):
We currently have three different plugin packages with the following tech order combinations:
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.
Configurable Options valid only for the HiveJava Tech Usage:
options: {
HiveJava: {
minVersion: "2015.1.100"
}
}
The Hive Java tech will fail if will not initiate a session before the timeout (in millisecond)
minimum version of Hive Java allowed to run
send a warning to atatus if the session request takes more than the specified time
define a callback in case a specific tech could initialize a session
define a callback in case a specific tech could NOT initialize a session
whether you want the plugin to try to initialize the session through the next techs
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)
}
}
}
The tech will fail if will not initiate a session before the timeout (in millisecond)
define a callback in case a specific tech could initialize a session
define a callback in case a specific tech could NOT initialize a session
whether you want the plugin to try to initialize the session through the next techs
General configurable options
configure the debug level for the Hive Player Plugin.
The allowed levels are:
the feedback interval of statistic forwarding in millisecond.
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:
it is possible to override the default tech order for example to disable HiveJava proxy and use directly only the StatsJS telemetry pack
time interval in which if the statistics forwarded are always identical, we assume the player is idle and the session over
if true dinamically appends a timestamp to the console logs
Hive Java monitor port
Hive Java player port
if true activate the Hive-Tester Driver feedback to monitor the player status
Customer-defined userId. This information will be added to the Insights Peer Report.
enable or disable the check for other active sessions on Hive Java. Default off;
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
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 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 |
List of parameter names that can be passed to the page URL to setup correspondent plugin options.
hiveDebugLevel accepts a string value to initialize the debug console level. The valid values are the same as "debugLevel"
hiveLoggerTimestamp accepts a boolean value to activate or deactivate appending a timestamp in our console logs
configure the timeout in millisecond for the java tech to resolve the ticket
hiveMonitorPort url parameter accepts a numeric value for the monitor port binded by Hive Java client
hivePlayerPort url parameter accepts a numeric value for the player port binded by Hive Java client
configure the timeout in millisecond for the plugin ticket initSession
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
configure the timeout in milliseconds for the java tech to resolve the session request
Error codes for failure in initializing Hive Sessions
Generic Undefined Error
No Tech available to resolve the ticket
No available Tech could resolved the ticket
Stopped resolving session on last tech onError
The ticket could not be resolved
Error messages corresponding to the HiveSessionErrorCode
Internal code of the Hive Tech Error
the tech is not ready to resolve the ticket or initialize a HiveSession
generic unspecified plugin error
an error happened while initializing the HiveSession
an error happened while resolving/verifying the ticket
the tech didn't initialized the ticket before the timeout
the tech doesn't satisfy the minimum version requirement
This is the main status code, which will be used to generate the first 4 bits of the plugin status code
The plugin is not allowed as SDN (only for AMP)
The plugin initialization completed without errors
It was not possible to resolve the ticket with the specified techs
The plugin initialization and ticket resolving process timed out
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'
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)
use the Java installed Hive client to retrieve the video from the CDN or the P2P Network
use the electron based installed HiveJS client to retrieve the video from the CDN or the P2P Network
use only the browser telemetry package for Hive Insights
Reference to the Hive Plugin
return the plugin status code generated by the Plugin Status Code Generator
Object containing information about the initialized Hive Session
the identifier of the session
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.
the Hive technology that initialize this session
the url of the ticket
Object containing information for failure in initializing Hive Session
Object containing information about the Hive Tech Error that prevented the initialization of a Hive Session
get the Hive Session Error Message corresponding to a certain error code
Module for Global Hive Configurations.
This configuration can be accessed directly, e.g.
HiveConfig.ErrorMonitor.enabled = false
Overriding configurations for the Error Monitoring component. The ErrorMonitoring component provides RUM (Real User Monitor) and error tracking. This configurations are global per page.
Upload Log Key Combination enabled. If true, pressing the combination CTRL + SHIFT + X will upload the last 10 logs
Error Monitor enabled.
enable a filter for JS errors. If true it will track only errors generated by the Hive plugin only.
Real User Monitor enabled. If true the component will monitor and send performance data of page and AJAX
ErrorMonitor user key
ErrorMonitor reporting version
appends a tech event record
special logic to filter progress events and detect playing:
reset and returns all the tech event records collected so far
returns the current status code of the plugin
returns the configured telemetryId passed in the Hive Plugin initialization options
initialize the status code of teh plugin to 0x00000000
true if the current watched manifest corresponds to the active HiveSession
Called after the initial metadata have been received from the player in order to activate the initialized Session
called when the player decided that the ticket resolve took too long and there is no need for it anymore
close the current active/initialized session, reset the active and initialized session values and reset the timers and stop the periodic stats
Attempt to resolve a ticket through any of the available techs
In a loop through all the tech, one at the time:
In case no tech can resolve the Session, an the Promise will fail with a HiveTechError
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.
(optional, used only when the MainStatusCode is OK)
Generated using TypeDoc
API of Hive Comm player integration