HyperbeamController.cs
This is the main point of control for the Hyperbeam API in WebGL. It provides important methods to the JSLib and is REQUIRED in order for the API to function properly. Attach this script directly to a game object and call StartHyperbeamStream to use.
Events
OnHyperbeamStart
UnityEvent OnHyperbeamStart
Will notify any registered handlers when the Instance property is usable. It is eventually called by StartHyperbeamStream usually before OnTextureReady is invoked.
OnTextureReady
Action<Texture2D> OnTextureReady
Will notify any registered handlers when the Hyperbeam Stream’s texture is ready. It is eventually called after StartHyperbeamStream
OnControlReturned
UnityEvent OnControlReturned
Will notify any registered handlers when control is returned to unity after being handed off by PassControlToBrowser
Properties
The instance of the core Hyperbeam object associated with this controller. Allows access to many of the control methods for interacting with the virtual browser. See Hyperbeam for more info
Sets the stream’s volume. A convience accessor for Instance.Volume
Pauses the video stream, but not the audio stream. A convience accessor for Instance.SetVideoPause(value)
Methods
StartHyperbeamStream
void StartHyperbeamStream(string embedUrl)
Bootstraps the hyperbeam browser. This will hand off execution the web browsers Javascript runtime in order to setup the stream.
Method Parameters
PassControlToBrowser
void PassControlToBrowser(string closeKey, bool ctrl, bool meta, bool alt, bool shift)
Stops unity from intercepting keyboard events and will start sending them to the virtual browser. It will listen for the closeKey along with any modifiers and when pressed will return control back to unity, which can be detected via OnControlReturned
Method Parameters
TakeBackControlFromBrowser
void TakeBackControlFromBrowser()
Forcibly takes control back from the attached Hyperbeam Instance if PassControlToBrowser was called on it. It will unregister any event handlers currently registered.