The top level object for the Hyperbeam API. This is responsible for calling into the Hyperbeam JSLib and controlling the browser. It is not recommended to instantiate this directly, instead it is preferable to call HyperbeamController.StartHyperbeamStream and then access these methods using it’s Instance property.

Properties

Volume
float

Sets the stream’s volume in a range of [0, 1]

Methods


GetHyperbeamTexture

IEnumerator GetHyperbeamTexture(Action<Texture2D> callback)

A coroutine to be invoked by MonoBehaviour.StartCoroutine it will check once every frame for a texture to be available. When one is found, or if one already exists, calls callback

Method Params

callback
Action<Texture2D>
A callback to be invoked that takes a Texture2D parameter

GetTexttureWidth

int GetTextureWidth()

Gets the virtual browser’s width in pixels.


GetTextureHeight

int GetTextureHeight()

Gets the virtual browser’s height in pixels.


SendKeyDown

void SendKeyDown(char Key, bool Ctrl, bool Meta)

Sends a keydown event to the virtual browser.

Method Params

Key
char
The Key to send this event for.
Ctrl
bool
Whether or not ctrl should be sent with the key.
Alt
bool
Whether or not alt should be sent with the key.

SendKeyUp

void SendKeyUp(char Key, bool Ctrl, bool Meta)

Sends a keyup event to the virtual browser.

Method Params

Key
char
The Key to send this event for.
Ctrl
bool
Whether or not ctrl should be sent with the key.
Alt
bool
Whether or not alt should be sent with the key.

SendMouseDown

void SendMouseDown(float X, float Y, PointerEventData.InputButton button)

Sends a mousedown event to the virtual browser.

Method Params

x
float
The X coordinate in the range [0, 1] where 0 is the left edge.
y
float
The Y coordinate in the range [0, 1] where 0 is the top edge.
button
PointerEventData.InputButton
Which mouse button to send the event for.

SendMouseUp

void SendMouseUp(float X, float Y, PointerEventData.InputButton button)

Sends a mouseup event to the virtual browser.

Method Params

x
float
The X coordinate in the range [0, 1] where 0 is the left edge.
y
float
The Y coordinate in the range [0, 1] where 0 is the top edge.
button
PointerEventData.InputButton
Which mouse button to send the event for.

SendMouseMove

void SendMouseMove(float X, float Y)

Sends a mousemove event to the virtual browser.

Method Params

x
float
The X coordinate in the range [0, 1] where 0 is the left edge.
y
float
The Y coordinate in the range [0, 1] where 0 is the top edge.

SendWheel

void SendWheel(float DeltaY)

Sends a mouse wheel event to the virtual browser.

Method Params

DeltaY
float
The scroll wheel’s delta

SetVideoPause

void SetVideoPause(bool pause)

Pauses or unpauses the video stream. While the video stream is paused it is not sending any data, saving on CPU and Bandwidth. Prefer to use HyperbeamController.Paused where you can as it can be queried easier.

Method Params

pause
bool
Whether to pause or unpause the video stream.

GiveHyperbeamControl

void GiveHyperbeamControl(string closeKey, bool ctrl, bool meta, bool alt, bool shift)

This will inform hyperbeam it has ‘control’ of the browser and make it register event listeners for keypresses. Prefer to use HyperbeamController.PassControlToBrowser because it first tells unity to stop listening and will avoid registering multiple listeners.

Method Parameters

closeKey
string
The Keydown that will trigger unity regaining control
ctrl
bool
Whether or not the ctrl key must be held down to regain control
meta
bool
Whether or not the meta key must be held down to regain control
alt
bool
Whether or not the alt key must be held down to regain control
shift
bool
Whether or not the shift key must be held down to regain control

TakeBackControl

void TakeBackControl()

Forcibly takes control back from the browser and unregisters any event listeners that may have been registered by Hyperbeam.