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.
- Windows x64
- .NET 8 Runtime
- Visual C++ Redistributable 2019+ (required by Chromium)
The OMT binaries (libomtnet.dll, libomt.dll, libvmx.dll) and all CefSharp native files are already bundled with the library.
dotnet add package sirNugg3ts.HtmlToOmt
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();| 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"]) |
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()}",
}
}
};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();Call HtmlRenderHost.Shutdown() once at process exit. It disposes all remaining instances automatically before shutting down Chromium:
HtmlRenderHost.Shutdown();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.
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.