Soenneker.Blazor.Videojs
11.0.439
Prefix Reserved
dotnet add package Soenneker.Blazor.Videojs --version 11.0.439
NuGet\Install-Package Soenneker.Blazor.Videojs -Version 11.0.439
<PackageReference Include="Soenneker.Blazor.Videojs" Version="11.0.439" />
<PackageVersion Include="Soenneker.Blazor.Videojs" Version="11.0.439" />
<PackageReference Include="Soenneker.Blazor.Videojs" />
paket add Soenneker.Blazor.Videojs --version 11.0.439
#r "nuget: Soenneker.Blazor.Videojs, 11.0.439"
#:package Soenneker.Blazor.Videojs@11.0.439
#addin nuget:?package=Soenneker.Blazor.Videojs&version=11.0.439
#tool nuget:?package=Soenneker.Blazor.Videojs&version=11.0.439
Soenneker.Blazor.Videojs
Wraps Video.js in a Blazor component with typed configuration, dynamic source and poster updates, and common player events exposed as EventCallbacks.
Installation
dotnet add package Soenneker.Blazor.Videojs
Register the scoped interop in Program.cs:
using Soenneker.Blazor.Videojs.Registrars;
builder.Services.AddVideoJsInteropAsScoped();
Basic player
@using Soenneker.Blazor.Videojs
@using Soenneker.Blazor.Videojs.Configuration
@using Soenneker.Blazor.Videojs.Dtos
<VideoJs Configuration="@_configuration"
OnPlay="HandlePlay"
OnEnded="HandleEnded" />
@code {
private readonly VideoJsConfiguration _configuration = new()
{
Controls = true,
Autoplay = "muted",
Muted = true,
Fluid = true,
Responsive = true,
AspectRatio = "16:9",
Poster = "https://vjs.zencdn.net/v/oceans.png",
PlaybackRates = [0.5, 1, 1.5, 2],
Sources =
[
new VideoJsSource { Src = "https://vjs.zencdn.net/v/oceans.mp4", Type = "video/mp4" },
new VideoJsSource { Src = "https://vjs.zencdn.net/v/oceans.webm", Type = "video/webm" }
]
};
private void HandlePlay() { }
private void HandleEnded() { }
}
The component creates and disposes the Video.js player with the component lifecycle. Its generated default classes are video-js vjs-default-skin; pass Class to append your own classes.
Change media after initialization
Pass Sources when the source list changes at runtime:
<VideoJs Configuration="@_configuration" Sources="@_sources" />
Sources overrides Configuration.Sources when provided.
_sources =
[
new VideoJsSource
{
Src = "https://media.example.com/next-video.mp4",
Type = "video/mp4"
}
];
After the player is created, the component watches Sources and Configuration.Poster and applies changes through Video.js. Other configuration properties are creation options: changing them later does not recreate or reconfigure the player. Give each component a unique Id if you set one explicitly.
Packaged or CDN assets
Video.js CSS and JavaScript load from a pinned jsDelivr URL by default, with Subresource Integrity validation. To avoid the external dependency, use the assets included in the NuGet package:
private readonly VideoJsConfiguration _configuration = new()
{
UseCdn = false
};
Keep UseCdn consistent for all players sharing the same scoped interop. Video.js installs a page-global videojs object, so this package cannot isolate two asset builds on the same page.
Events
Available callbacks are:
OnReady,OnPlay,OnPause, andOnEndedOnTimeUpdate,OnDurationChange, andOnRateChangeOnLoadedMetadata,OnLoadedData,OnCanPlay, andOnCanPlayThroughOnSeeking,OnSeeked,OnWaiting, andOnPlayingOnVolumeChange,OnProgress,OnStalled, andOnSuspendOnAbort,OnError, andOnEmptied
Callbacks can be added, replaced, or removed on later renders. They are notifications without event payloads; OnError does not include Video.js error details. OnTimeUpdate can fire frequently, so keep its handler inexpensive.
Configuration notes
VideoJsConfiguration mirrors commonly used Video.js creation options, including controls, autoplay, muted playback, responsive sizing, playback rates, control-bar options, HTML5 tech options, languages, and plugins. See the Video.js options guide for the browser library's option semantics.
- Browser autoplay rules still apply.
Autoplay = "muted"withMuted = trueis the most broadly permitted mode, but playback is never guaranteed. - Media hosts must serve the correct MIME type and allow any cross-origin access required by the browser and selected streaming format.
- Source and poster URLs are sent to the browser as provided. Do not build them from untrusted input without applying your application's URL policy.
- The component exposes lifecycle and event integration, not imperative controls such as play, pause, seek, or volume setters.
Child content
Use ChildContent when the underlying <video> element needs custom children such as tracks or fallback markup:
<VideoJs Configuration="@_configuration">
<track kind="captions"
src="/captions/en.vtt"
srclang="en"
label="English"
default />
</VideoJs>
When child content is supplied, the component does not render <source> elements itself; sources in the Video.js configuration are still passed to the player options.
Low-level interop
IVideoJsInterop exposes initialization, creation, source/poster updates, event registration, and player disposal for integrations that manage their own <video> element. Most applications should use the VideoJs component so player and .NET callback references are cleaned up together.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Asyncs.Initializers (>= 11.0.144)
- Soenneker.Blazor.Extensions.EventCallback (>= 11.0.477)
- Soenneker.Blazor.Extensions.IJSObjectReferences (>= 11.0.8)
- Soenneker.Blazor.Utils.ResourceLoader (>= 11.0.1859)
- Soenneker.Lepton.Suite (>= 11.0.149)
- Soenneker.Utils.Json (>= 11.0.2797)
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 |
|---|---|---|
| 11.0.439 | 62 | 11/19/2026 |
| 11.0.438 | 61 | 11/19/2026 |
| 11.0.437 | 57 | 11/19/2026 |
| 11.0.436 | 54 | 11/19/2026 |
| 11.0.435 | 42 | 11/19/2026 |
| 11.0.433 | 48 | 11/18/2026 |
| 11.0.432 | 48 | 11/18/2026 |
| 11.0.430 | 66 | 11/18/2026 |
| 11.0.427 | 78 | 11/18/2026 |
| 11.0.426 | 86 | 11/17/2026 |
| 11.0.425 | 86 | 11/17/2026 |
| 11.0.424 | 101 | 11/16/2026 |
| 11.0.423 | 90 | 11/16/2026 |
| 11.0.422 | 84 | 11/15/2026 |
| 11.0.421 | 97 | 11/15/2026 |
| 11.0.420 | 89 | 11/15/2026 |
| 11.0.419 | 86 | 11/15/2026 |
| 11.0.418 | 86 | 11/15/2026 |
| 11.0.417 | 95 | 11/15/2026 |
| 11.0.416 | 99 | 11/15/2026 |
Updated Multiple NuGet packages