Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Significant code refactoring + Reorganizing project structure + Multiple streams support + RTMP client implementation #66

Merged
merged 83 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
71bae8a
refactor: networking
josephnhtam Aug 11, 2024
822cc40
feat: add Networking.Client
josephnhtam Sep 15, 2024
8a63e86
refactor: rtmp
josephnhtam Sep 16, 2024
021b5b4
feat: improve simple handshake
josephnhtam Sep 18, 2024
77b290a
feat: add rtmp client
josephnhtam Sep 20, 2024
c75e738
refactor: rename RtmpProtocolControlMessageSenderService to RtmpProto…
josephnhtam Sep 21, 2024
19764cc
feat: parameters should be optional
josephnhtam Sep 22, 2024
be7457d
refactor: rtmp
josephnhtam Sep 22, 2024
473b1a9
feat: ignore setPeerBandwidth protocol control
josephnhtam Sep 22, 2024
ecfaec8
feat: change AppName in RtmpClientSessionContext to nullable string
josephnhtam Sep 22, 2024
b3f930d
feat: add commander and message handlers
josephnhtam Sep 22, 2024
c3f9e21
feat: expose message stream id for commands
josephnhtam Sep 23, 2024
dbba8ad
feat: add multi-stream support
josephnhtam Sep 24, 2024
0fd87ad
refactor: more consistent variable naming
josephnhtam Sep 25, 2024
46b7f29
fix: stop publishing/subscribing should remove the corresponding context
josephnhtam Sep 27, 2024
d884732
fix: unit tests
josephnhtam Sep 27, 2024
e64e45b
refactor: move UpdateTimestamp to stream context
josephnhtam Sep 27, 2024
f65d3b5
refactor: use ConcurrentDictionary instead
josephnhtam Sep 27, 2024
8af9136
fix: exception messages
josephnhtam Sep 27, 2024
c31e1b2
refactor: RtmpStreamContext
josephnhtam Sep 27, 2024
02131a6
refactor: rename RtmpStream to RtmpStreamContext
josephnhtam Sep 28, 2024
8d10174
feat: use lock-free approach to update timestamp
josephnhtam Sep 28, 2024
6766886
refactor: rename RtmpStreamContextBase to RtmpMediaStreamContext
josephnhtam Sep 28, 2024
759b85b
refactor: change IRtmpClientSessionContext to IAsyncDisposable
josephnhtam Sep 28, 2024
72ad07a
refactor: change IRtmpClientSessionContext to IAsyncDisposable
josephnhtam Sep 28, 2024
e5f3cca
feat: support multiple streams
josephnhtam Sep 28, 2024
c60f5e1
feat: improve rtmp client
josephnhtam Sep 28, 2024
9deb674
fix: stream metadata message
josephnhtam Sep 28, 2024
cf1e975
feat: improve rtmp client
josephnhtam Sep 28, 2024
015bf20
refactor: remove unused logging messages
josephnhtam Sep 28, 2024
fa64ace
feat: improve logging
josephnhtam Sep 29, 2024
015d3d0
chore: cleanup
josephnhtam Sep 29, 2024
ffcbf37
feat: add video/audio data receiving
josephnhtam Sep 29, 2024
3e35ff8
feat: add rtmp client builder
josephnhtam Sep 29, 2024
e30ccbb
feat: add RtmpUserControlMessageHandler
josephnhtam Sep 29, 2024
5d01e1e
fix: MetaData object
josephnhtam Sep 29, 2024
aa948dd
fix: MetaData object
josephnhtam Sep 29, 2024
2b5ffd0
fix: timestamps should be rest when the stream is published
josephnhtam Sep 29, 2024
8fe3ea2
feat: improve stream publishing and subscribing
josephnhtam Sep 29, 2024
789d0c0
feat: separate closeStream and deleteStream
josephnhtam Sep 29, 2024
1f47e18
fix: closing subscribe stream should not send PlayUnpublishNotify status
josephnhtam Sep 29, 2024
e55b855
chore: cleanup
josephnhtam Sep 29, 2024
45a5127
refactor: rename UntilInitializationComplete to UntilInitializationCo…
josephnhtam Sep 29, 2024
e6978c9
feat: add closeStream and deleteStream
josephnhtam Sep 29, 2024
03dcbb9
fix: unit test
josephnhtam Sep 29, 2024
63a9a2b
refactor: rename OnStreamMetaDataUpdated to OnStreamMetaDataReceived
josephnhtam Sep 29, 2024
21e6245
refactor: rename UntilInitializationComplete to UntilInitializationCo…
josephnhtam Sep 29, 2024
a8ba5f4
fix: HostRtmpClient
josephnhtam Sep 29, 2024
28a3baa
feat: improve rtmp client events
josephnhtam Sep 29, 2024
6507aea
feat: expose services
josephnhtam Sep 29, 2024
0316945
feat: add rtmp client demo
josephnhtam Sep 29, 2024
5ec3114
refactor: rtmp client demo
josephnhtam Sep 29, 2024
c7910d1
refactor: rtmp client demo
josephnhtam Sep 29, 2024
3d35840
fix: avoid the first keyframe being skipped
josephnhtam Sep 29, 2024
575afa5
fix: unit tests
josephnhtam Sep 29, 2024
c44d78d
feat: improve command deserialization
josephnhtam Sep 30, 2024
fa5e917
fix: correct play unauthorized's status code
josephnhtam Sep 30, 2024
a17ef9f
fix: typo
josephnhtam Sep 30, 2024
66b662c
chore: revise project descriptions
josephnhtam Sep 30, 2024
9f7bec8
feat: add package icon and readme
josephnhtam Sep 30, 2024
b9526d8
chore: samples should not be packable
josephnhtam Sep 30, 2024
a461f3d
feat: improve user control messages
josephnhtam Sep 30, 2024
32a6a40
feat: expose command method to IRtmpClient, add user control message …
josephnhtam Sep 30, 2024
d572aa4
chore: update project description
josephnhtam Oct 1, 2024
899c310
refactor: improve the encapsulation for rtmp command
josephnhtam Oct 1, 2024
a9e8805
feat: different chunk stream ids for different logical streams
josephnhtam Oct 1, 2024
a1616b8
fix: unit tests
josephnhtam Oct 1, 2024
68c572b
fix: unit test
josephnhtam Oct 1, 2024
6690d32
chore: update docs
josephnhtam Oct 1, 2024
679a82d
feat: improve rtmp client
josephnhtam Oct 1, 2024
2b80c3e
feat: add publish support to rtmp client
josephnhtam Oct 1, 2024
03f8d01
feat: improve rtmp client status
josephnhtam Oct 1, 2024
1b106b9
refactor: remove RtmpStreamDeletedException
josephnhtam Oct 1, 2024
bc2cc7d
refactor: simplify status
josephnhtam Oct 1, 2024
1b903bc
feat: improve RtmpClientStatus
josephnhtam Oct 1, 2024
03d275e
refactor: improve encapsulation
josephnhtam Oct 1, 2024
6d1190b
feat: add RtmpUrlParser
josephnhtam Oct 1, 2024
a58f6ee
fix: flv tag header should support extended timestamp
josephnhtam Oct 1, 2024
0f2db0d
feat: add RtmpClient publish demo
josephnhtam Oct 1, 2024
d899e24
refactor: improve RtmpClientPublishDemo
josephnhtam Oct 1, 2024
1612eb0
fix: rtmp client should be disposed
josephnhtam Oct 1, 2024
d8222cb
fix: dont change the discarding state when non-discardable message is…
josephnhtam Oct 1, 2024
e3d2cb8
feat: add event for bandwidth limit update
josephnhtam Oct 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 17 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>
<PropertyGroup>
<Copyright>Copyright 2024 Joseph NH Tam</Copyright>
<Authors>Joseph NH Tam</Authors>

<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.NuGet.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageProjectUrl>https://josephnhtam.github.io/live-streaming-server-net</PackageProjectUrl>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" Visible="false" PackagePath="\" />
<None Include="$(MSBuildThisFileDirectory)README.NuGet.md" Pack="true" Visible="false" PackagePath="\" />
</ItemGroup>
</Project>
58 changes: 55 additions & 3 deletions LiveStreamingServerNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet", "src\LiveStreamingServerNet\LiveStreamingServerNet.csproj", "{8559A0E8-9315-4728-8BD8-B3C49E14DFB7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Networking", "src\LiveStreamingServerNet.Networking\LiveStreamingServerNet.Networking.csproj", "{15449DED-702C-4A69-BB75-CAFC7613565C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Networking.Server", "src\LiveStreamingServerNet.Networking.Server\LiveStreamingServerNet.Networking.Server.csproj", "{15449DED-702C-4A69-BB75-CAFC7613565C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Utilities", "src\LiveStreamingServerNet.Utilities\LiveStreamingServerNet.Utilities.csproj", "{CFCD9768-1EA2-4565-A6A7-30750D3D8F40}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Rtmp", "src\LiveStreamingServerNet.Rtmp\LiveStreamingServerNet.Rtmp.csproj", "{EBD91510-86A5-49A2-A97B-E2A0AACFB516}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Rtmp.Server", "src\LiveStreamingServerNet.Rtmp.Server\LiveStreamingServerNet.Rtmp.Server.csproj", "{EBD91510-86A5-49A2-A97B-E2A0AACFB516}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Flv", "src\LiveStreamingServerNet.Flv\LiveStreamingServerNet.Flv.csproj", "{1DB2249D-DEF5-4E2D-AED9-E5429C392C01}"
EndProject
Expand Down Expand Up @@ -39,7 +39,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{C85AC04A
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Networking.Test", "test\LiveStreamingServerNet.Networking.Test\LiveStreamingServerNet.Networking.Test.csproj", "{67DCDCEA-6E4F-476D-B993-FF5BA02ACA7F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Rtmp.Test", "test\LiveStreamingServerNet.Rtmp.Test\LiveStreamingServerNet.Rtmp.Test.csproj", "{91B1B8A8-A311-468B-B5E0-0B6DCBA20246}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Rtmp.Server.Test", "test\LiveStreamingServerNet.Rtmp.Server.Test\LiveStreamingServerNet.Rtmp.Server.Test.csproj", "{91B1B8A8-A311-468B-B5E0-0B6DCBA20246}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.AuthorizationDemo", "samples\LiveStreamingServerNet.AuthorizationDemo\LiveStreamingServerNet.AuthorizationDemo.csproj", "{F6C4B2F6-5913-4CCE-A9E8-32EA51247D51}"
EndProject
Expand Down Expand Up @@ -71,6 +71,22 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Stre
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.HlsAuthenticationDemo", "samples\LiveStreamingServerNet.HlsAuthenticationDemo\LiveStreamingServerNet.HlsAuthenticationDemo.csproj", "{71895ADC-8ED6-478A-9CCC-372C0E88D57D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Networking.Client", "src\LiveStreamingServerNet.Networking.Client\LiveStreamingServerNet.Networking.Client.csproj", "{35B4DDF7-E6FE-412D-B101-BD5BFE192A06}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Networking", "src\LiveStreamingServerNet.Networking\LiveStreamingServerNet.Networking.csproj", "{E6F733DA-3F22-4C2E-8389-35651E0ADE36}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Networking.Server.Test", "test\LiveStreamingServerNet.Networking.Server.Test\LiveStreamingServerNet.Networking.Server.Test.csproj", "{6584699E-532D-49EC-B521-B2151587588F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Rtmp.Client", "src\LiveStreamingServerNet.Rtmp.Client\LiveStreamingServerNet.Rtmp.Client.csproj", "{24D44F66-B6B3-4472-AF13-EA4DE4E47BAE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Rtmp", "src\LiveStreamingServerNet.Rtmp\LiveStreamingServerNet.Rtmp.csproj", "{05FCBA0F-B176-4695-92B6-37DA252F2A82}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.Rtmp.Test", "test\LiveStreamingServerNet.Rtmp.Test\LiveStreamingServerNet.Rtmp.Test.csproj", "{772B6681-727C-469B-82B5-2760451F4E0F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveStreamingServerNet.RtmpClientPlayDemo", "samples\LiveStreamingServerNet.RtmpClientPlayDemo\LiveStreamingServerNet.RtmpClientPlayDemo.csproj", "{17841723-77DF-4A42-9C24-38EB71203D39}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveStreamingServerNet.RtmpClientPublishDemo", "samples\LiveStreamingServerNet.RtmpClientPublishDemo\LiveStreamingServerNet.RtmpClientPublishDemo.csproj", "{6887F6DF-CE3F-4D6E-8E66-6A8151CA2680}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -205,6 +221,38 @@ Global
{71895ADC-8ED6-478A-9CCC-372C0E88D57D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71895ADC-8ED6-478A-9CCC-372C0E88D57D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71895ADC-8ED6-478A-9CCC-372C0E88D57D}.Release|Any CPU.Build.0 = Release|Any CPU
{35B4DDF7-E6FE-412D-B101-BD5BFE192A06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35B4DDF7-E6FE-412D-B101-BD5BFE192A06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35B4DDF7-E6FE-412D-B101-BD5BFE192A06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35B4DDF7-E6FE-412D-B101-BD5BFE192A06}.Release|Any CPU.Build.0 = Release|Any CPU
{E6F733DA-3F22-4C2E-8389-35651E0ADE36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6F733DA-3F22-4C2E-8389-35651E0ADE36}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6F733DA-3F22-4C2E-8389-35651E0ADE36}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6F733DA-3F22-4C2E-8389-35651E0ADE36}.Release|Any CPU.Build.0 = Release|Any CPU
{6584699E-532D-49EC-B521-B2151587588F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6584699E-532D-49EC-B521-B2151587588F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6584699E-532D-49EC-B521-B2151587588F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6584699E-532D-49EC-B521-B2151587588F}.Release|Any CPU.Build.0 = Release|Any CPU
{24D44F66-B6B3-4472-AF13-EA4DE4E47BAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24D44F66-B6B3-4472-AF13-EA4DE4E47BAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24D44F66-B6B3-4472-AF13-EA4DE4E47BAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24D44F66-B6B3-4472-AF13-EA4DE4E47BAE}.Release|Any CPU.Build.0 = Release|Any CPU
{05FCBA0F-B176-4695-92B6-37DA252F2A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{05FCBA0F-B176-4695-92B6-37DA252F2A82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05FCBA0F-B176-4695-92B6-37DA252F2A82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05FCBA0F-B176-4695-92B6-37DA252F2A82}.Release|Any CPU.Build.0 = Release|Any CPU
{772B6681-727C-469B-82B5-2760451F4E0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{772B6681-727C-469B-82B5-2760451F4E0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{772B6681-727C-469B-82B5-2760451F4E0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{772B6681-727C-469B-82B5-2760451F4E0F}.Release|Any CPU.Build.0 = Release|Any CPU
{17841723-77DF-4A42-9C24-38EB71203D39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17841723-77DF-4A42-9C24-38EB71203D39}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17841723-77DF-4A42-9C24-38EB71203D39}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17841723-77DF-4A42-9C24-38EB71203D39}.Release|Any CPU.Build.0 = Release|Any CPU
{6887F6DF-CE3F-4D6E-8E66-6A8151CA2680}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6887F6DF-CE3F-4D6E-8E66-6A8151CA2680}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6887F6DF-CE3F-4D6E-8E66-6A8151CA2680}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6887F6DF-CE3F-4D6E-8E66-6A8151CA2680}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -227,6 +275,10 @@ Global
{581B51B6-83A5-48D7-A655-D52737EFC66E} = {45761E33-F086-403D-BB6E-8059F8CC6BA8}
{7246C890-7231-4E08-9482-97AAAE4E9CD7} = {C85AC04A-5060-4C4B-830A-D7F51F602749}
{71895ADC-8ED6-478A-9CCC-372C0E88D57D} = {45761E33-F086-403D-BB6E-8059F8CC6BA8}
{6584699E-532D-49EC-B521-B2151587588F} = {C85AC04A-5060-4C4B-830A-D7F51F602749}
{772B6681-727C-469B-82B5-2760451F4E0F} = {C85AC04A-5060-4C4B-830A-D7F51F602749}
{17841723-77DF-4A42-9C24-38EB71203D39} = {45761E33-F086-403D-BB6E-8059F8CC6BA8}
{6887F6DF-CE3F-4D6E-8E66-6A8151CA2680} = {45761E33-F086-403D-BB6E-8059F8CC6BA8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0A9A3928-2852-49B9-85EF-F00480E9FE7F}
Expand Down
164 changes: 164 additions & 0 deletions README.NuGet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Live-Streaming-Server-Net

[![Nuget](https://img.shields.io/nuget/v/LiveStreamingServerNet)](https://www.nuget.org/packages/LiveStreamingServerNet/)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![JetBrains OSS](https://img.shields.io/badge/JetBrains-OSS-yellow.svg)](https://www.jetbrains.com/community/opensource)

Live-Streaming-Server-Net is a high-performance and flexible toolset that allows you to build your own live streaming server using .NET.

Please check the [documentation](https://josephnhtam.github.io/live-streaming-server-net/) for more details.

## Features

- **RTMP/RTMPS protocol**: Supports the RTMP and RTMPS protocols for streaming audio, video, and data.
- **HTTP-FLV/WebSocket-FLV with ASP.NET CORE**: Provides support for serving FLV live streams using HTTP-FLV and WebSocket-FLV protocols within an ASP.NET Core application.
- **Transmuxing RTMP streams into HLS streams**: Allows you to transmux RTMP streams into HLS (HTTP Live Streaming) streams using the built-in HLS transmuxer.
- **Transcoding RTMP streams into Adaptive HLS streams**: Integrates with FFmpeg to transcode RTMP streams into multiple-bitrate Adaptive HLS streams.
- **Integration with FFmpeg**: Provides support for processing the incoming RTMP stream with FFmpeg, for example, to create an MP4 archive.
- **GOP caching**: Supports caching the Group of Pictures (GOP) to ensure immediate availability of live streaming content.
- **Custom authorization**: Enables you to implement custom authorization mechanisms for accessing live streams.
- **Admin panel**: Includes an admin panel that provides an user interface for managing and monitoring the live streaming server.
- **Cloud Storage Integration**: Enabling real-time uploading of HLS files to cloud storage services like Azure Blob Storage, Google Cloud Storage, and AWS S3, which ensures scalable and efficient HLS stream distribution through CDN.

## Quick Start

### Run the RTMP Server

Create a .NET 8 console application project and add the dependencies

```
dotnet new console
dotnet add package LiveStreamingServerNet
dotnet add package Microsoft.Extensions.Logging.Console
```

Program.cs

```cs
using LiveStreamingServerNet;
using Microsoft.Extensions.Logging;
using System.Net;

using var server = LiveStreamingServerBuilder.Create()
.ConfigureLogging(options => options.AddConsole())
.Build();

await server.RunAsync(new IPEndPoint(IPAddress.Any, 1935));
```

Run the application

```
dotnet run
```

### Publish a Live Stream

#### With FFmpeg

Use the following command to publish a video as the live stream using FFmpeg

```
ffmpeg -re -i <input_file> -c:v libx264 -c:a aac -f flv rtmp://localhost:1935/live/demo
```

#### With OBS Studio

1. Open OBS Studio and go to "Settings".
2. In the "Settings" window, select the "Stream" tab.
3. Choose "Custom" as the "Service".
4. Enter "Server": `rtmp://localhost:1935/live` and "Stream Key": `demo`.
5. Click "OK" to save the settings.
6. Click the "Start Streaming" button in OBS Studio to begin sending live stream to the RTMP server.

### Play the Live Stream

#### With FFplay

Use the following command to play the live stream using FFplay

```
ffplay rtmp://localhost:1935/live/demo
```

#### With VLC Media Player

1. Open VLC Media Player.
2. Go to the "Media" menu and select "Open Network Stream".
3. In the "Network" tab, enter the URL: `rtmp://localhost:1935/live/demo`.
4. Click the "Play" button to start playing the live stream.

## NuGet Packages

<table>
<thead>
<tr>
<th>Package</th>
<th>Latest Version</th>
</tr>
</thead>
<tbody>
<tr>
<th>LiveStreamingServerNet</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.Standalone</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.Standalone"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.Standalone.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.AdminPanelUI</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.AdminPanelUI"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.AdminPanelUI.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.Flv</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.Flv"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.Flv.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.Networking</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.Networking"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.Networking.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.Rtmp</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.Rtmp"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.Rtmp.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.StreamProcessor</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.StreamProcessor"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.StreamProcessor.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.StreamProcessor.AmazonS3</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.StreamProcessor.AmazonS3"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.StreamProcessor.AmazonS3.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.StreamProcessor.AspNetCore</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.StreamProcessor.AspNetCore"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.StreamProcessor.AspNetCore.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.StreamProcessor.AzureBlobStorage</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.StreamProcessor.AzureBlobStorage"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.StreamProcessor.AzureBlobStorage.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.StreamProcessor.GoogleCloudStorage</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.StreamProcessor.GoogleCloudStorage"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.StreamProcessor.GoogleCloudStorage.svg?logo=nuget"></a></td>
</tr>
<tr>
<th>LiveStreamingServerNet.Utilities</th>
<td><a href="https://www.nuget.org/packages/LiveStreamingServerNet.Utilities"><img src="https://img.shields.io/nuget/v/LiveStreamingServerNet.Utilities?logo=nuget"></a></td>
</tr>
</tbody>
</table>

## License

This project is licensed under the terms of the [MIT license](https://github.com/josephnhtam/live-streaming-server-net/blob/master/LICENSE).

## Acknowledgments

<picture>
<source media="(prefers-color-scheme: dark)" srcset="./images/jetbrains-white.svg">
<source media="(prefers-color-scheme: light)" srcset="./images/jetbrains.svg">
<img src="./images/jetbrains.svg" alt="JetBrains" width="200"/>
</picture>

Special thanks to [JetBrains](https://www.jetbrains.com/) for providing the open-source software license that supports the development of this project.
8 changes: 4 additions & 4 deletions docs/tutorials/custom-authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ This `DemoPasswordValidator` is a simple example class to check if the password

```cs linenums="1"
using LiveStreamingServerNet.Networking.Contracts;
using LiveStreamingServerNet.Rtmp.Auth;
using LiveStreamingServerNet.Rtmp.Auth.Contracts;
using LiveStreamingServerNet.Rtmp.Server.Auth;
using LiveStreamingServerNet.Rtmp.Server.Auth.Contracts;

public class DemoAuthorizationHandler : IAuthorizationHandler
{
Expand All @@ -40,7 +40,7 @@ public class DemoAuthorizationHandler : IAuthorizationHandler
}

public async Task<AuthorizationResult> AuthorizePublishingAsync(
IClientInfo client,
ISessionInfo client,
string streamPath,
IReadOnlyDictionary<string, string> streamArguments,
string publishingType)
Expand All @@ -53,7 +53,7 @@ public class DemoAuthorizationHandler : IAuthorizationHandler
}

public Task<AuthorizationResult> AuthorizeSubscribingAsync(
IClientInfo client,
ISessionInfo client,
string streamPath,
IReadOnlyDictionary<string, string> streamArguments)
{
Expand Down
14 changes: 13 additions & 1 deletion docs/tutorials/rtmp-server-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Below are the interfaces for these event handlers:
public interface IRtmpServerConnectionEventHandler
{
int GetOrder() => 0;
ValueTask OnRtmpClientCreatedAsync(IEventContext context, IClientControl client);
ValueTask OnRtmpClientCreatedAsync(IEventContext context, ISessionControl client);
ValueTask OnRtmpClientDisposedAsync(IEventContext context, uint clientId);
ValueTask OnRtmpClientHandshakeCompleteAsync(IEventContext context, uint clientId);
ValueTask OnRtmpClientConnectedAsync(IEventContext context, uint clientId, IReadOnlyDictionary<string, object> commandObject, IReadOnlyDictionary<string, object>? arguments);
Expand Down Expand Up @@ -46,6 +46,12 @@ For instance, if you want to limit the publishing time of every stream to a maxi
### Implement IRtmpServerStreamEventHandler

```cs linenums="1"
using LiveStreamingServerNet.Networking.Server.Contracts;
using LiveStreamingServerNet.Rtmp.Server.Contracts;
using LiveStreamingServerNet.Utilities.Contracts;
using Microsoft.Extensions.Options;
using System.Collections.Concurrent;

public class PublishingTimeLimiterConfig
{
public int PublishingTimeLimitSeconds { get; set; }
Expand Down Expand Up @@ -111,6 +117,12 @@ The PublishingTimeLimiter, which implements `IRtmpServerStreamEventHandler`, wil
### Register the Event Handler

```cs linenums="1"
using LiveStreamingServerNet;
using LiveStreamingServerNet.Networking;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Net;

using var liveStreamingServer = LiveStreamingServerBuilder.Create()
.ConfigureRtmpServer(options =>
{
Expand Down
1 change: 0 additions & 1 deletion docs/tutorials/serving-hls-cloud-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Modify `Program.cs` file:
```cs linenums="1"
using Azure.Storage.Blobs;
using LiveStreamingServerNet;
using LiveStreamingServerNet.Networking.Helpers;
using LiveStreamingServerNet.StreamProcessor;
using LiveStreamingServerNet.StreamProcessor.AzureBlobStorage.Installer;
using LiveStreamingServerNet.StreamProcessor.Hls;
Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions samples/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project>
Loading
Loading