Volume

How loud the stream plays in the viewer's browser, from 0 (silent) to 1 (full). It changes only what the viewer hears. Your app keeps playing its sound as before.

At a glance

Triggered fromWhat you callWorks on the production player today
iframeno message on the production playerNot available on the production player
Web SDKe3ds_controller.setVolume(0.5)Yes
UnrealSend Pixel Streaming Response {"cmd":"setVolume","value":0.5}Yes, with a value from 0 to 1

Sound starts muted

Browsers do not let a page play sound before the viewer has clicked, tapped or pressed a key, so the stream starts muted. Setting a volume above 0 unmutes it only after the viewer has done one of those; before that, the volume is stored and the stream stays muted.

How the calls travel

Volume never reaches the app. The player sets it on the video and audio in the viewer's page.

Demos

iframe

The iframe demo's Volume control is dimmed on production for this reason.

Web SDK

Web SDK demo: the Volume slider. Demo manual.

Unreal

A sample project with volume keys.

Demo coming soon

How to do it

iframe

There is no volume message on the production player yet; it arrives with the next platform release. Until then the viewer uses the player's own volume control. Your page cannot reach the sound inside the frame, because the frame is a different site.

If your app should control the volume, send your app a message from your page (Embedding › Page → Unreal) and let the app send the Unreal command in the Unreal tab.

Web SDK

document.getElementById("myVolume").addEventListener("input", function (e) {
  e3ds_controller.setVolume(e.target.value / 100);   // slider 0-100 -> 0-1
});

Values below 0 count as 0 and above 1 as 1. It returns true when it found the player's video or audio to set, and false when there was none yet.

It acts on your page, not on the app, so it keeps working after the session has ended.

Unreal

Add a PixelStreamingInput component to an actor and send this with Send Pixel Streaming Response:

{"cmd":"setVolume","value":0.5}

Use a value from 0 to 1. A value above 1 is meant to be read as 0–100, but on some player themes that conversion is missing and the command fails; it is being fixed.

Troubleshooting

What you seeWhyWhat to do
No sound, whatever the volumeThe viewer has not clicked, tapped or pressed a key yet; browsers keep the stream muted until then.Expected. Ask for one click, e.g. a Play or Start button.
Volume from the iframe does nothingThere is no volume message on the production player.Use the player's own control, or let the app send setVolume.
setVolume from Unreal does nothingThe value was above 1 on a player theme without the 0–100 conversion.Send 0 to 1, e.g. 0.5.
setVolume returns falseThe player had no video or audio yet.Call it after the stream has started.

Last updated