Streaming
Streaming
Here's how to stream an interactive Windows desktop from one Peer to another.
Platform limitations on streaming
In its current beta state, the Rainway SDK only supports streams
- from a Windows desktop, using the Native Runtime,
- to a web browser, using the Web Runtime.
So make sure you have both of these set up if you want to try out streaming.
If you want to try streaming without writing any code yourself, you can install the C# demo on a Windows desktop, and use the web demo page to connect to it from a browser on another computer.
Before a stream is initiated, the peer-to-peer connection is symmetrical. Once streaming begins, this changes. The streaming Peer (native app) is referred to as the host, and the Peer consuming the stream (the host's web app) is the client.
A desktop stream may be initiated when a client requests it. Here's what that looks like.
Requested streams
Stream requests come in on the OnStreamRequest
handler passed into the host's RainwayConfig
.
The host specifies which input permissions to grant, and which processes to stream:
var config = new RainwayConfig
{
OnStreamRequest = (runtime, request) => {
// Accept every incoming request.
request.Accept(new RainwayStreamConfig() {
// Bitflags indicating which kinds of control over the desktop to grant.
InputLevel = RainwayInputLevel.None,
// List of process IDs to isolate. (Empty = stream the whole desktop.)
IsolateProcessIds = Array.Empty<uint>(), //
});
}
// additional config entries
};
Calling Accept
will start streaming media to the web app, which it can display in a container on the page.
Alternatively, the host can call Reject
with a human-readable reason string.
Updated over 2 years ago