master is not a stable branch, you may want to see the latest tag
A high performance RTMP live streaming application framework
Program.cs
using Harmonic.Hosting;
using System;
using System.Net;
namespace demo
{
class Program
{
static void Main(string[] args)
{
RtmpServer server = new RtmpServerBuilder()
.UseStartup<Startup>()
.Build();
var tsk = server.StartAsync();
tsk.Wait();
}
}
}
StartUp.cs
using Autofac;
using Harmonic.Hosting;
namespace demo
{
class Startup : IStartup
{
public void ConfigureServices(ContainerBuilder builder)
{
}
}
}
Build a server like this to support websocket-flv transmission
RtmpServer server = new RtmpServerBuilder()
.UseStartup<Startup>()
.UseWebSocket(c =>
{
c.BindEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 8080);
})
.Build();
ffmpeg -i test.mp4 -f flv -vcodec h264 -acodec aac "rtmp://127.0.0.1/living/streamName"
ffplay "rtmp://127.0.0.1/living/streamName"
<video id="player"></video>
<script>
if (flvjs.isSupported()) {
var player = document.getElementById('player');
var flvPlayer = flvjs.createPlayer({
type: 'flv',
url: "ws://127.0.0.1/websocketplay/streamName"
});
flvPlayer.attachMediaElement(player);
flvPlayer.load();
flvPlayer.play();
}
</script>
You can view docs here