Sound and autoplay
A stream starts muted. Browsers only allow sound after the viewer has clicked or tapped. Give the viewer a sound button.Add a button
Switch the sound in its click handler
true when the sound is now on. Note the direction: it is the opposite of muted.stream.muted each time the state becomes streaming, as the example does. When the SDK rebuilds a connection it creates a new video element, and a new video element starts muted.When the browser blocks autoplay
Some browsers refuse to start even a muted video without a click. The stream is then up, and nothing plays.stream.play():
container, a press anywhere on it also starts playback. The state becomes streaming when the video really plays.
Resolution and quality
How the video fits its container
The resolution mode decides the size of the stream and how it sits in your container. It is the project’s dashboard setting, or theresolution.mode option.
Change the resolution
List the sizes the project allows
stream.allowedResolutions holds the sizes up to the project’s maximum, for example "720p (1280x720)".Ask for one
stream.setResolution(width, height) asks the application to render at that size.Read what was applied
null when nothing was sent.setResolution() does with your numbers:
Set quality at the start
These options apply from the first frame. Each defaults to the project’s dashboard setting.stats event: frame rate, bitrate, resolution, codec. See StreamStats and the stats readout recipe.
Fullscreen
The SDK has no fullscreen method. Use the browser’s own Fullscreen API on the element that holds the stream.- Make the wrapper fullscreen, not the stream container: your own buttons inside the wrapper then stay visible.
- In
dynamicandcropmodes the stream follows the container, so it is rendered at the new size after a moment. Infixedmode the picture is scaled.
Mouse, keyboard, touch and gamepad
Input goes to your application as soon as the video is up. Each kind follows the project’s dashboard setting (Input and UI controls) unless you pass an option.What the SDK does with input for you
What the SDK does with input for you
Hover mouse
With hover mouse on, mouse movement reaches the application without a pressed button. Whether your application wants that depends on how it shows its cursor: see Mouse settings. Three things can switch it:streaming.VR and XR
Text input on phones
A phone has no keyboard until a text field on the page has focus. When a text field in your application gets focus, the application asks the page for one. The Unreal side is on Virtual keyboard for text input.Add a text field to your page
Show it on osk, answer with sendTextboxEntry()
- Keys typed into your field are not sent to the application as key presses. Only
sendTextboxEntry()sends the text. - Some phones open the keyboard only when the viewer taps your field. Place the field where it is easy to tap.
- The event fires on every device, not only on phones.
Microphone and camera
The viewer’s microphone or camera can be sent to your application, for example for voice commands. This is not voice chat between people: for that, see Voice and text chat.Allow it at the start
media. This must be decided before the stream starts.Switch it while streaming
setMicrophone(true) does: it resolves to true only when the microphone is live.false in these cases:
Idle viewers and background tabs
Input also tells the platform that the viewer is still there.Troubleshooting
There is no sound
There is no sound
stream.setMuted(false) or stream.toggleAudio() from a click or tap. Outside a click the browser may refuse.The sound went away after a reconnect
The sound went away after a reconnect
stream.muted when the state becomes streaming and update your button.The video is a black box until I click
The video is a black box until I click
awaitingPlay. Show a button that calls stream.play().setResolution() returns null
setResolution() returns null
The stream has the wrong size for its container
The stream has the wrong size for its container
dynamic and crop modes the stream is sized to the container. Check that the container has a width and a height. Without them the SDK measures the browser window.Keys I type in my own form reach the application
Keys I type in my own form reach the application
<input>, <textarea>, <select> and contenteditable elements are held back. A custom widget built from other elements is not recognised.setMicrophone(true) resolves to false
setMicrophone(true) resolves to false
media: { mic: true } to create() or switch it on in the dashboard, then start a new stream.The first click does something unexpected in my application
The first click does something unexpected in my application
Next steps
Talk to your Unreal app
Events and states
Options reference
create(), with types and defaults.