Ejemplo n.º 1
0
    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();
    }
Ejemplo n.º 2
0
        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.");
        }
Ejemplo n.º 3
0
    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");
            }
        }
    }
Ejemplo n.º 4
0
        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.");
        }