Hls2TlgrUploader 1.0.0
dotnet add package Hls2TlgrUploader --version 1.0.0
NuGet\Install-Package Hls2TlgrUploader -Version 1.0.0
<PackageReference Include="Hls2TlgrUploader" Version="1.0.0" />
paket add Hls2TlgrUploader --version 1.0.0
#r "nuget: Hls2TlgrUploader, 1.0.0"
// Install Hls2TlgrUploader as a Cake Addin #addin nuget:?package=Hls2TlgrUploader&version=1.0.0 // Install Hls2TlgrUploader as a Cake Tool #tool nuget:?package=Hls2TlgrUploader&version=1.0.0
Hls2TlgrUploader
This library uploads HLS stream to Telegram channel.
How to use
- Add nuget package
- Set up your appsettings.json
- Register services
- Use
IVideoUploadingService
Add nuget package
dotnet add package Hls2TlgrUploader
Set up your appsettings.json
{
"Telegram": {
"BotToken": "YOUR_BOT_TOKEN",
"DestinationChatId": "YOUR_CHAT_ID_OR_CHANNEL_ALIAS"
}
}
Register services
The package provides an extension method for IServiceCollection
.
public void ConfigureServices(IServiceCollection services)
{
services.AddHls2TlgrUploader(Configuration);
}
However, all necessary services are public, so you can register them manually.
Use IVideoUploadingService
See also Hls2TlgrUploader.IntegrationTests.
public class YourService
{
private readonly IVideoUploadingService _videoUploadingService;
public YourService(IVideoUploadingService videoUploadingService)
{
_videoUploadingService = videoUploadingService;
}
public async Task UploadVideoAsync()
{
Uri[] hlsParts = GetHlsPartsUrls();
Task<Stream> thumbnailJpgStream = GetThumbnail();
Message message = await service.CopyToTelegramAsync(
uris,
thumbnailJpgStream,
"Some caption",
CancellationToken.None);
}
}
Configuration
The package uses 2 configuration sections: Telegram
and Processing
.
You can pass a configuration object to AddHls2TlgrUploader
method.
Only 2 properties are required: Telegram:BotToken
and Telegram:DestinationChatId
.
Available options:
Telegram
- BotToken (required)
- DestinationChatId (required)
- ApiUrl (default: https://api.telegram.org) - Telegram API URL
- TimeoutSeconds (default: 60) - Timeout for Telegram API requests
Processing
- ConcurrentDownloads (default: 1) - Number of concurrent downloads. See Download concurrency
- TempVideoFilePattern (default: "video-{0}.mp4") - Pattern for temporary video files. {0} is replaced with a random GUID in format "D" (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx).
- FfmpegPath (default: "ffmpeg") - Path to ffmpeg executable
Download concurrency <a name="download-concurrency"></a>
The package can use HttpClient
for downloading HLS parts.
The parts are downloaded into memory and processed as they arrive.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- System.IO.Pipelines (>= 8.0.0)
- Telegram.Bot (>= 19.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 94 | 8/31/2024 |