Step 1 — Detect mobile, don’t guess
User-agent sniffing is fragile, but for switching between desktop and phone config it’s good enough:bitrate. An iPad reports a Mac user agent by default, so this test treats it like a desktop.
Step 2 — Mobile-tuned SDK init
input.touch— translate browser touch events into Pixel Streaming touch input so Unreal sees taps as taps, not as mouse clicks at (0, 0). It follows the project’s dashboard setting (on by default) unless your code sets it.resolution.mobileStart: '480p (854x480)'— phones stream at 480p, which starts fast and uses little data. The size does not grow by itself: adaptive bitrate changes only the bitrate within this picture. In dynamic or crop mode it is the box the stream is fitted into, so a phone held upright gets about 280x480. Pick'720p (1280x720)'if that is too soft, or raise it later withstream.setResolution(), up to the project’s maximum stream quality (passresolution.maxon a project that has none). Tablets usetabletStart.codec.primary: 'H264'— every mobile decoder has H264 silicon. VP9 software-decodes on most phones and burns CPU.bitrate.max— cap the stream so an over-eager adaptive controller doesn’t try to push 12 Mbps over LTE. The value is in kilobits per second. The cap is held for the whole session, reconnects included; it is the lower of your value and the application’s own maximum.- No relay option — the SDK takes a direct path when the network allows one and falls back to the TURN relay by itself, so carrier NATs need no setting.
@streampixel/ui draws these screens for you.
Step 3 — Touch UI in Unreal
The browser-sideinput.touch option delivers touch events to Unreal. Whether your Unreal project does anything useful with them depends on what touch UI is built into the project itself.
For projects packaged with on-screen joysticks, on-screen buttons, or other touch HUD, see Hide / unhide touch controls for runtime control of those overlays. Show them on touch devices and hide them on desktop: the SDK tells your app which it is with the isTouchDevice message.
Step 4 — Bandwidth budget
Plan for the network the user actually has, not the network you wish they had:bitrate.max is in kilobits per second. The 4 Mbps cap above is 4_000. A max under 500 (it looks like megabits) or a value above 200,000 (it looks like bits per second) is not applied and logs a console warning. Adaptive bitrate will scale down further on bad networks.
Step 5 — Battery and thermals
A long mobile streaming session is a sustained workload: GPU decode, screen at full brightness, radio active. Phones throttle when they get hot, and a throttled phone produces a worse stream. Things you can do from your application:- Set a short idle time. Pass
afk: { timeoutSec: 30 }(it can only be shorter than the project’s setting). When the user puts the phone down, 30 seconds without input start a 10-second countdown (theafkWarningevent); then the session ends and the worker is freed. A touch on the stream during the countdown cancels it. After the end they start a new session when they pick the phone back up. See Idle viewers and background tabs. - Drop FPS targets if your UE project supports it. A console command via
stream.consoleCommand('t.MaxFPS 30')halves render work and saves battery on long-form, low-motion content (configurators, tours). - Honour
prefers-reduced-motionfor any spinner / loader animations on your page.
Step 6 — iOS Safari quirks
iOS has the most edge cases. The big ones:Audio requires a user gesture
iOS will not start playing audio until a tap, click, or other input event. The overlay in the example above asks for that tap once the stream is playing. Without it, the stream connects, video plays muted, and audio never starts.stream.muted turns true a moment after the video starts. That is why the example above looks again a second later, and shows “Tap for sound” again.
Autoplay policies
Even muted autoplay can fail in some Safari configurations, especially with PiP enabled. The Web SDK starts the video muted; when the browser still refuses to play it, the state becomesawaitingPlay, and a tap that calls stream.play() starts it, as in the example above.
Tab background
iOS pauses all media playback when the tab backgrounds. Streampixel disconnects after 60 seconds of background, on phones and tablets, iOS and Android alike; if the user returns sooner, the stream resumes. Beyond 60 seconds the session has ended: a Web SDK page gets theended event with endKind: 'afk', at the latest the moment the user returns (see Troubleshooting — mobile disconnects). The SDK does not reconnect after an end, so the page starts a new session: reload, or call Streampixel.create() again, as the example above does on a tap. advanced: { flags: { backgroundDisconnect: false } } turns the rule off.
Viewport units
100vh does not behave the same on iOS Safari as it does in desktop browsers — the URL bar takes a slice and 100vh doesn’t account for it. Use 100dvh (dynamic viewport height) for full-screen layouts:
Step 7 — Orientation
Most streamed UE projects are designed for landscape. Lock orientation if your project depends on it:lock() method works on Android Chrome but is not supported on iOS Safari, which is why a visual hint is the portable solution.
Gotchas
Pinch-zoom hijacks touch input
Pinch-zoom hijacks touch input
Without the
viewport meta tag pinning user-scalable=no and CSS touch-action: none on the stream container, browser pinch-zoom and double-tap-to-zoom intercept touches before they reach Unreal. The example above sets both.iOS PWA mode strips features
iOS PWA mode strips features
Streams launched from a saved-to-home-screen PWA on iOS run in a stripped-down WebView with stricter autoplay, no PiP, and quirky media handling. Test there explicitly if you support that install path.
Android Chrome address bar resizes the viewport
Android Chrome address bar resizes the viewport
Scrolling on Android Chrome shrinks/expands the URL bar, which resizes the viewport and can trigger video reflow. Using
100dvh and avoiding scroll on the stream page (overscroll-behavior: none) prevents this.Cellular networks often block UDP
Cellular networks often block UDP
Some carriers and corporate cellular gateways block UDP entirely, which kills direct WebRTC media. The SDK then relays the stream over TCP or TLS through TURN by itself, at lower quality, and fires the
relayFallback event. A network that blocks the relay as well ends the session with code 4100: about 8 seconds after the application’s offer when the network refuses the connection, and after 30 seconds when it drops the packets without an answer.Android keyboard pushes the layout
Android keyboard pushes the layout
If your stream UI includes a text input (chat, login), opening the soft keyboard reflows the page and can shift the video. Use
position: fixed on the stream container and let the keyboard overlay it instead of resizing.Next steps
Hide / unhide touch controls
Toggle the UE-side touch HUD from your web page.
Performance tuning
Bitrate and codec recipes for every device class.
Resolution settings
Set per-device opening resolution defaults.
Troubleshooting
Mobile disconnects, audio gating, and other common issues.