static async Task test_server() { var options = new RtmpServer.Options { // required parameters: Context = new SerializationContext(), }; using (var server = await RtmpServer.ConnectAsync(options, x => { })) server.Wait(); }
static async void BotServerAsync() { Console.WriteLine("Bot server starting."); var options = new RtmpServer.Options { Url = "rtmp://any:4000", }; using (botServer = await RtmpServer.ConnectAsync(options, client => { client.DispatchMessage = s => { Console.WriteLine("MSG: " + s.GetType().Name); }; })) botServer.Wait(); Console.WriteLine("Bot server stopped."); }
static async Task test_client_server() { var serverOptions = new RtmpServer.Options { Url = "rtmp://localhost:4000/key", Context = new SerializationContext(), }; using (var server = await RtmpServer.ConnectAsync(serverOptions, x => { })) { var clientOptions = new RtmpClient.Options { Url = "rtmp://localhost:4000/key", Context = new SerializationContext(), }; using (var client = await RtmpClient.ConnectAsync(clientOptions)) { Console.WriteLine("Connect"); } } }
static async void FrameServerAsync() { Console.WriteLine("Frame server starting."); var options = new RtmpServer.Options(); using (frameServer = await RtmpServer.ConnectAsync(options, client => { client.DispatchMessage = s => { if (botClient == null || !botClient.Connected) { return; } if (s is VideoData) { botClient.SendMessage(s); } }; })) frameServer.Wait(); Console.WriteLine("Frame server stopped."); }