sirNugg3ts.HtmlToOmt 1.0.2

dotnet add package sirNugg3ts.HtmlToOmt --version 1.0.2
                    
NuGet\Install-Package sirNugg3ts.HtmlToOmt -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="sirNugg3ts.HtmlToOmt" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="sirNugg3ts.HtmlToOmt" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="sirNugg3ts.HtmlToOmt" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add sirNugg3ts.HtmlToOmt --version 1.0.2
                    
#r "nuget: sirNugg3ts.HtmlToOmt, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package sirNugg3ts.HtmlToOmt@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=sirNugg3ts.HtmlToOmt&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=sirNugg3ts.HtmlToOmt&version=1.0.2
                    
Install as a Cake Tool

sirNugg3ts.HtmlToOmt

sirNugg3ts.HtmlToOmt is a .NET 8 library that renders an HTML page offscreen via Chromium (CefSharp) and pushes each frame as a live video source over OMT through the libomtnet library.

Requirements

The OMT binaries (libomtnet.dll, libomt.dll, libvmx.dll) and all CefSharp native files are already bundled with the library.

Installation

dotnet add package sirNugg3ts.HtmlToOmt

Usage

using sirNugg3ts.HtmlToOmt.Contracts;
using sirNugg3ts.HtmlToOmt.Services;

var renderOptions = new HtmlRenderHostOptions
{
    InitialUrl = "http://localhost:9090/my-graphic",
};

var renderHost = new HtmlRenderHost(renderOptions);

renderHost.Diagnostic += (_, msg) => Console.WriteLine(msg);

await renderHost.StartAsync();

// Keep running until you're done
await Task.Delay(Timeout.Infinite, cancellationToken);

// Disposes all instances and shuts down Chromium
HtmlRenderHost.Shutdown();

HtmlRenderHostOptions

Property Required Default Description
InitialUrl URL to load in the offscreen browser
Width / Height 1920 / 1080 Frame dimensions in pixels
OmtSourceName URL OMT source name — defaults to the URL if not set
Fps 30 Frame rate for both the browser and the OMT stream
PaintOnChangeOnly false When true, frames are only sent when the page repaints instead of at a fixed rate
OmtQuality "Low" OMT encode quality — Low, Medium, or High
HeaderInjectionRules HTTP headers to inject per URL prefix (e.g. auth tokens)
CefCommandLineArgs Extra Chromium command-line flags (e.g. ["disable-web-security"])

Header injection

var renderOptions = new HtmlRenderHostOptions
{
    InitialUrl = "http://localhost:9090/my-graphic",
    Width = 1920,
    Height = 1080,
    HeaderInjectionRules = new[]
    {
        new HeaderInjectionRule
        {
            UrlPrefix = "http://localhost:9090/",
            HeaderName = "Authorization",
            ValueProvider = () => $"Bearer {GetToken()}",
        }
    }
};

Multiple sources

Each HtmlRenderHost is an independent browser instance with its own OMT source. You can run as many as you need simultaneously, and start or stop each one individually:

var scoreboardHost = new HtmlRenderHost(new HtmlRenderHostOptions
{
    InitialUrl = "http://localhost:9090/scoreboard",
    OmtSourceName = "Scoreboard",
});

var lowerThirdHost = new HtmlRenderHost(new HtmlRenderHostOptions
{
    InitialUrl = "http://localhost:9090/lower-third",
    OmtSourceName = "Lower Third",
});

await scoreboardHost.StartAsync();
await lowerThirdHost.StartAsync();

// Stop one source without affecting the other
lowerThirdHost.Dispose();

// Shut everything down at process exit
HtmlRenderHost.Shutdown();

Shutdown

Call HtmlRenderHost.Shutdown() once at process exit. It disposes all remaining instances automatically before shutting down Chromium:

HtmlRenderHost.Shutdown();

Initialization

Chromium is initialized automatically on first use. If you need to control timing (e.g. initialize at startup before creating any instances), call HtmlRenderHost.Initialize() explicitly — it is safe to call multiple times.

License

This library is licensed under the MIT License.

This package bundles binaries from the Open Media Transport project, also licensed under the MIT License. Copyright (c) 2025 Open Media Transport Contributors.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2 126 7/13/2026
1.0.1 106 7/9/2026
1.0.0 136 6/23/2026