iframe demo

A manual for the running Eagle 3D Streaming iframe demo. No account, no key, nothing to download — open the page and every control described here is in front of you. When you want the code, there is one link at the bottom.

Open the demo on your own app

Add ?src= and your stream link to the demo’s address. The demo then streams your application instead of our sample, with every control on this page — nothing to download or edit:

https://e3ds.github.io/E3DS-Iframe-Demo/?src=https://connector.eagle3dstreaming.com/v5/<owner>/<app>/<config>
PartWhat it is
https://e3ds.github.io/E3DS-Iframe-Demo/ The demo page itself.
?src= “Put this link in the iframe.” It is the same address you would write in your own page’s <iframe src="...">.
https://connector.eagle3dstreaming.com/v5/ Our streaming address. Copy it from your Control Panel together with the rest of the link.
<owner> Your username.
<app> The name of your uploaded application.
<config> The configuration to stream it with, for example default.

Without ?src= the demo opens our Pixel Streaming sample. If the address has a ?src= and you switch app or load another stream URL in the control panel, the ?src= in the address follows, so you can copy it from the browser and send it to someone else. Without ?src= the address does not change; your choice is remembered in your browser only.

The iframe demo on a desktop: the Pixel Streaming sample in the middle, the Log panel on the left showing connection stats, the control panel on the right with Session, Connection and Your app buttons The iframe demo on a phone: the stream fills the screen, with Iframe controls and Log buttons at the top
The iframe demo streaming the Pixel Streaming sample. Desktop: the Log on the left, the controls on the right. Phone: the same panels open from the two buttons at the top.

It is the same panel as the Web SDK demo

Deliberately. The two demos show the same controls over two different transports, so you can open them side by side and see that the difference is the wiring, not the features. Everything below has a counterpart in the Web SDK demo manual, usually with the same label.

In this demoIn the SDK demo
a message posted at the framea JavaScript call on e3ds_controller
{ cmd: "setVolume", value: 0.5 }e3ds_controller.setVolume(0.5)
an event arrives as a messagea callback you assigned is called

Why the controls arrive at different times

The panel fills in rather than appearing complete. That is deliberate, and it is the first real thing this demo teaches: a control that cannot work yet is not shown yet.

AppearsNeedsWhich controls
Alwaysnothing Restart stream, the Stream URL field, the permission rows
Once the channel is opena two-way link to the application Show FPS, streaming graphs, the console command box, Device info, messages to your app
Once frames arrivea picture to act on quality, resolution, volume, mouse, keyboard, fullscreen, screenshot, Terminate

The log, which is the most useful thing here

The iframe demo waiting for a machine: the loading screen says Waiting in the queue, position 1, and the Log shows the session.queued and session.queuePositionChanged messages
When every demo machine is busy, the page waits in the queue - and the Log shows exactly why: session.queued, then session.queuePositionChanged as the position moves.

Everything this page sends into the stream, and everything that comes back, appears in the Log panel — newest first, with an arrow saying which direction it went.

The panel can be dragged by its handle and resized; Clear empties the log.

It answers the question every integration eventually asks: did that actually arrive? A message posted at a frame that nothing handles fails in complete silence, so watching the log while you press a control is the difference between debugging and guessing.

The panel, control by control

Picture

ControlWhat it does
Quality: Low / Medium / High / Ultra The four named levels, the same ones the viewer's own quality menu offers. A level is the portable unit — the platform resolves it to whichever encoder scale the running plugin uses.
1920 × 1080, 800 × 600, Custom resolution Pins the stream to a fixed size, whatever the frame is doing. 1280x720, 1280 720 and 1280, 720 all work.
Match window resolution Releases the pin and follows the frame again — the default, so it is also how you undo the three above.

Sound and window

ControlWhat it does
Volume Acts on the player inside the frame. Raising it from silent may be refused until the viewer has clicked something — browsers block audio that starts without a gesture, and that refusal is invisible from the parent page.
Fullscreen This one is done by the page, not the stream: the demo calls requestFullscreen() on the iframe element. Nothing is sent anywhere, which is why it keeps working when the session has ended.
Screenshot Captures the current frame inside the player and downloads it. The parent page cannot do this itself — a cross-origin frame's pixels are not readable from outside — so it is a command, not a browser call.

Input

ControlWhat it does
Mouse: Hovering / Locked How the mouse drives the camera. Locked captures the pointer, as a first-person game does.
Key + Press / Hold / Release Types into the application from your own buttons. Press is one tap; Hold and Release are the pair you need for anything held, such as movement. This is how you build a WASD pad for a phone.
Touch input: on / off Turn it off when your own buttons sit over the stream on a phone, so a tap on your control does not also reach the app underneath it.
Press play Presses the player's own play button, for a page with its own start screen that does not want the viewer to click twice.

Diagnostics

ControlWhat it does
Show FPS Sends the Unreal console command stat fps. The counter is drawn by the application, inside the picture — which is why it appears in a screenshot.
Show streaming graphs The transport's own numbers: bitrate, packet loss, latency. Useful when the picture looks wrong and you want to know whether the network or the application is at fault.
Unreal console command Any command the app accepts at its own console — stat unit, r.ScreenPercentage 50. See the warning below before putting a box like this in a public page.
Device info Asks the platform what device the viewer is on, and the answer arrives as takeUserDeviceInfo — the same message an Unreal app gets when it asks.

Your app

Character and Skin appear only when the demo is streaming an application known to understand them, and that gating is worth understanding: those buttons send a message that means nothing to any other app, and a message that means nothing produces no error — just a button that appears broken.

Control panel with the Pixel Streaming sample: Your app shows Character: Crunch, Character: Aurora and Skin 1 to 3 Control panel with the Car configurator: Your app shows a Car colour list Control panel with the E3DS Features Template: Your app says No app controls available for this app
The same panel with three apps loaded. Left: Pixel Streaming sample - Character and Skin. Middle: Car configurator - Car colour. Right: E3DS Features Template - no app buttons, only the free message box.

Message to your app + Send to app sends whatever you type: JSON if it parses, a plain string if it does not. That is the one to use the moment you point this demo at your own application — and what arrives at the other end needs something waiting for it, which is the Unreal side of sending and receiving data.

Session and connection

ControlWhat it does
Restart stream Reloads the frame, which starts a fresh session. Available even before there is a stream, because it is also how you recover from one that never started.
Terminate stream Ends the session deliberately and releases the machine. Nothing reconnects on its own.
App list Switches between our sample apps (Pixel Streaming sample, Car configurator, E3DS Features Template); the Your app buttons change with it.
Stream URL + Load URL Points the demo at a different application — paste your own stream link — without editing a file. What you type is remembered in your browser only. A ?src= link in the page address (see Open the demo on your own app) comes first.

For developers: every command and every event

Everything the demo does goes through one browser feature, postMessage, in two directions. Your page posts a command at the iframe; the Eagle 3D page inside it posts events back to your page. The demo’s own code for this is in two files: js/iframe-commands.js (commands) and js/iframe-events.js (events). The tables below are taken from the Eagle 3D page’s own handler, so they list what the player accepts today.

Sending a command

A command is a JSON string with cmd and, for most commands, value:

const frame = document.getElementById("streamFrame");   // your <iframe>
frame.contentWindow.postMessage(
  JSON.stringify({ cmd: "sendMessageToStreamingBuild", value: { colour: "red" } }),
  "*"
);

A command name the player does not know is ignored without any reply, so a typo looks exactly like “nothing happened”. Check the spelling against this table first.

cmdvalue / fieldsWhat the Eagle 3D page does
sendMessageToStreamingBuildvalue: text or an object Passes the value to your app (Pixel Streaming’s UI interaction). This is the command an integration uses most; your app decides what the value means.
sendCommandToUEvalue: object Sends a Pixel Streaming command (resolution, encoder and similar). It does not reach your app’s own message handler.
sendConsoleCommandToUEvalue: text, e.g. "stat fps" Runs an Unreal console command, when the app allows console commands.
EmulatePlayButtonPressed- Presses the play button for the viewer, for a page with its own play button.
setVideoDetailLevelvalue: "low", "medium", "high" or "ultra" Sets the picture quality, the same as the quality menu.
setQualityPointvalue: a number (encoder QP) The older way to set quality with a raw number. Prefer setVideoDetailLevel.
freezeResolutionAtx, y (no value) Keeps the stream at that resolution whatever the window size.
useViewportResolution- Undoes freezeResolutionAt: the window size drives the resolution again.
switchMouseControlSchemeTovalue: "Hovering" or "LockedMouse" How the mouse drives the app: a free pointer, or locked to the stream.
setTouchInputEnabledvalue: "true" or "false" Turns touch input to the app on or off - useful when your own controls sit over the stream.
emulateKeyboardKeyPressvalue: a key, e.g. "M" or "Space" The app sees the key pressed and released.
emulateKeyboardKeyDown / emulateKeyboardKeyUpvalue: a key Holds a key down / lets it go - for movement keys.
setVolumevalue: 0 to 1, or a percentage (50 = half) Sets the stream’s sound volume.
toggleFullscreen-Full screen on or off.
captureScreenShot- Takes a picture of the stream and sends it back as a screenshot event.
sendDeviceInfo- Replies with a takeUserDeviceInfo event (the viewer’s device).
getAppInfo- Replies with an appInfo event: which app, version and configuration is streaming.
getMicDevices-Replies with a micDevices event.
setMicDevicevalue or deviceId Switches the microphone; replies with micDeviceChanged.
setConnectionStatsIntervalseconds How often connection statistics are reported.
ForceEndSession- Ends the session and frees the machine. A commandReceived event is sent first, so your page knows the command arrived.
any object with a Type field(the whole object) Passed to your app unchanged, like sendMessageToStreamingBuild.

Receiving events

window.addEventListener("message", (event) => {
  const e = event.data;                 // an object, not a string
  if (!e || !e.type) return;
  if (e.type === "stream.playing") { /* the viewer sees the stream */ }
});

Where the session is - queued, machine found, app starting, stream ready, playing, ended - arrives as the session events (session.queued, stream.ready, stream.playing, session.ending and the rest), each with phase, sequence and its old name in legacyType. The full list, in order, is on your own screens. The other events:

typeFieldsWhen
appInfoowner, appName, appVersion, configName, ueVersion Answer to getAppInfo.
takeUserDeviceInfouserDeviceInfoAnswer to sendDeviceInfo.
screenshotok, width, height, dataUrl (or error) Answer to captureScreenShot.
micDevicesok, devices (or error)Answer to getMicDevices.
micDeviceChangedok, deviceId, label (or error)Answer to setMicDevice.
commandReceivedcommandJust before ForceEndSession acts.
streamFocusGained / streamFocusLostfocused The stream got or lost the keyboard focus.
your app’s own messageswhatever your app sends Every message your app sends to the browser is passed on to your page as it is.

The same commands and events work on a Web SDK page: commands become calls on e3ds_controller, and events arrive at e3ds_controller.callbacks.onEvent instead of the message listener. See iframe or Web SDK.

The microphone is a separate demo

e3ds.github.io/E3DS-Iframe-Demo/microphone/ is this same demo with the microphone built in: asking for the permission, choosing an input device, and the reasons both are harder than they look.

It is separate on purpose. A page that asks for a microphone costs every visitor a browser prompt, and most integrations do not need one. See choosing the microphone.

Like what you see?

Related

Last updated