Beam Manager
The Beam Manager is one half of the core Beam logic, tied closely to the Beam Camera. Everything to do with authentication, starting and stopping streams, and controlling recordings happens through the manager.
You can easily hook into events in the Beam lifecycle by using our Beam Unity Events component, which is pre-attached to the Beam Manager.
You will need to obtain a Experience Key and Secret from the Beam Developer Portal before you attempt to start any streams or recordings. Instructions can be found here.
Accessing the Beam Manager
The Beam manager is available directly in your scene via standard Unity find commands, or by using the BeamManager.Instance
call.
It will automatically be moved to the DontDestoryOnLoad
section of your Unity scene when play mode begins.
Authentication
You will need to authenticate the user before starting any streams. Users will not need to authenticate to locally record or take photos. This process is normally started automatically when leaving the Authenticate On Awake
checkbox active. Otherwise you will have to call Authenticate
and wait for the process to complete.
A quick set of re-implementation steps can be found in our FAQ.
Resolution and Aspect Ration
The resolution and aspect ratio controls are found on the Beam Manager.
Resolution is specified for both local and cloud types of capture. This is done to allow users on lower speed connections reduce or adjust their streaming resolution, without impacting their local recording settings.
Aspect ratio can be changed to either landscape or portrait.
If the user is already capturing content, either streaming or recording, then neither of these options will be respected until a new capturing session starts.
Streaming and Recording
Streaming is as simple as calling StartStreaming
, and stopping is just the same by calling StopStreaming
. Note that you will not be able to start or stop streaming unless you have specified your Experience key and secret.
You can start and stop recording by calling StartRecording
and StopRecording
respectively. When the user is not streaming, the recording will be stored to the user's device. When streaming, the recording will be stored to the user's Beam account. You do not need to be logged in to record locally, but the Experience key and secret will need to be set in your Beam Settings.
Taking Photos
Photos can be captured by simply call SavePhoto
. You can specify a delay on this call, if you want to have a countdown timer coinciding with a button press. Calling the function while a previous photo is being captured will stop the previous capture.
You can easily access the output of the photo by binding to the Beam Unity Event's OnPhotoCaptured
event. The result of the photo capture (whether it succeeded or not) can be bound in a similar fashion with the OnPhotoCapturedResult
.
Streaming To Other Platforms
For more information please see our Streaming Platforms docs