formaui-net.Framework.Media 1.0.0-preview.27

Prefix Reserved
This is a prerelease version of formaui-net.Framework.Media.
dotnet add package formaui-net.Framework.Media --version 1.0.0-preview.27
                    
NuGet\Install-Package formaui-net.Framework.Media -Version 1.0.0-preview.27
                    
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="formaui-net.Framework.Media" Version="1.0.0-preview.27" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="formaui-net.Framework.Media" Version="1.0.0-preview.27" />
                    
Directory.Packages.props
<PackageReference Include="formaui-net.Framework.Media" />
                    
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 formaui-net.Framework.Media --version 1.0.0-preview.27
                    
#r "nuget: formaui-net.Framework.Media, 1.0.0-preview.27"
                    
#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 formaui-net.Framework.Media@1.0.0-preview.27
                    
#: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=formaui-net.Framework.Media&version=1.0.0-preview.27&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=formaui-net.Framework.Media&version=1.0.0-preview.27&prerelease
                    
Install as a Cake Tool

Forma.Framework.Media

The provider contract FormaVideoPlayer plays through. A player provider turns an address into a PlayerFrame, what the player loads, and the player asks its providers in turn: those the host registered, then the bundled hosting services, then any file the browser can fetch. A host registers a provider to teach the player addresses of its own, or to serve a hosting service's addresses its own way.

Use it

The package comes with formaui-net.Blazor, with the contract in the Forma.Framework.Media namespace and the bundled providers in Forma.Framework.Media.Providers. The bundled providers need no registration; a host registers each of its own as an IPlayerProvider, and they are asked in registration order before any bundled one:

using Forma.Framework.Media;

builder.Services.AddScoped<IPlayerProvider, LibraryPlayerProvider>();

A provider returns a frame for the addresses it claims and null for the rest. One that resolves the application's own video identifiers against its library:

using Forma.Framework.Media;

public sealed class LibraryPlayerProvider(IVideoLibrary library) : IPlayerProvider
{
    private const string Scheme = "library:";

    public async ValueTask<PlayerFrame?> GetPlayerFrameAsync(string source, PlayerOptions options, CancellationToken cancellationToken)
    {
        if (!source.StartsWith(Scheme, StringComparison.OrdinalIgnoreCase))
        {
            return null;
        }

        var video = await library.FindAsync(source[Scheme.Length..], cancellationToken);

        return video is null ? null : new NativePlayerFrame(video.Url);
    }
}

The player then takes that address like any other:

@using Forma.Blazor.Components.Media

<FormaVideoPlayer Source="library:stage-4-finish" Title="Stage 4 finish" />

The contract

IPlayerProvider.GetPlayerFrameAsync(source, options, cancellationToken) returns the frame for an address, or null for an address it leaves to the next provider. PlayerOptions carries how the player was asked to behave:

Member What it is
Autoplay Whether playback starts on its own, muted.
LimitTracking Whether the hosting service is asked to collect as little as it offers to. On by default.
PageAddress The address of the page the player renders on, which some services require.

FormaVideoPlayer fills Autoplay from its own parameter and PageAddress from the page's base address.

Frames

Every frame carries Source, the address it stands for.

Record What the player loads
EmbeddedPlayerFrame(Source) A hosting service's player page, in an <iframe> sized to the player's aspect ratio.
NativePlayerFrame(Source) A file the browser plays itself, in a <video> sized the same way, with the player's Captions.
HtmlPlayerFrame(Source, Html, ScriptUrl) Markup a hosting service's script turns into a player: the player renders Html, loads ScriptUrl once, and lets the result size itself.

The player renders an HtmlPlayerFrame's Html as trusted markup, so a provider encodes every part of the address it writes into it.

The player loads a frame only from an address its kind allows, as Forma.Framework.Sanitization sets out: an EmbeddedPlayerFrame's as a frame's source, which takes no data: address, and a NativePlayerFrame's as a video's. A frame at an address its kind doesn't allow, a provider's javascript: among them, shows the video unavailable, and the player's log records the refusal at Debug. An HtmlPlayerFrame's Source is written as a link to the service's own page, and is written inert where a link doesn't allow it.

The bundled providers

Asked in this order after every registered provider:

Provider Claims Returns
YouTubePlayerProvider A watch, share, embed, shorts or live address; embeds from youtube-nocookie.com while LimitTracking is on. EmbeddedPlayerFrame
VimeoPlayerProvider A watch or player address; adds dnt=1 while LimitTracking is on. EmbeddedPlayerFrame
TwitchPlayerProvider A channel, video or clip address, while PageAddress is set, since Twitch requires the embedding host. EmbeddedPlayerFrame
TikTokPlayerProvider A video address, as markup plus TikTok's script. HtmlPlayerFrame
InstagramPlayerProvider A post, reel or video address, as markup plus Instagram's script. HtmlPlayerFrame
FacebookPlayerProvider A video, watch or reel address, as markup plus Facebook's script. HtmlPlayerFrame
TwitterPlayerProvider A post on X, as markup plus the widget script, with data-dnt. HtmlPlayerFrame
FilePlayerProvider An address AddressPolicy allows as a video's source: a relative address, or an absolute one under http, https or blob, or a data: address of a video. NativePlayerFrame

A registered provider that claims a service's addresses answers before that service's bundled provider, so a host can serve its own copy of a video it keeps.

License

Apache License 2.0, under the repository's LICENSE.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on formaui-net.Framework.Media:

Package Downloads
formaui-net.Blazor

A Blazor component library for .NET 11: form inputs and pickers, dialogs, popovers and toasts, toolbars and menus, tabs and layout, file pickers, uploaders and viewers, icons, emoji and windows.

formaui-net.Blazor.Explorer

FormaExplorer, a file manager for the Forma component library over items and folders the host already holds: a folder tree, an address bar with history and breadcrumbs, thumbnail, details and list views, search, sorting and grouping, selection, drag and drop between folders, upload, and a preview of any item.

formaui-net.Blazor.Composer

FormaComposer, a rich text authoring surface for Blazor: an editor with the toolbar, dialogs, views and attachments an article or a page body needs, assembled from plugins the host picks.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-preview.27 57 12/3/2026
1.0.0-preview.26 66 12/3/2026
1.0.0-preview.25 73 12/2/2026
1.0.0-preview.24 87 12/1/2026
1.0.0-preview.23 126 11/30/2026
1.0.0-preview.22 120 11/30/2026
1.0.0-preview.21 127 11/29/2026
1.0.0-preview.20 125 11/26/2026
1.0.0-preview.19 125 11/26/2026
1.0.0-preview.18 118 11/26/2026
1.0.0-preview.17 108 11/26/2026
1.0.0-preview.16 106 11/24/2026
1.0.0-preview.15 107 11/23/2026
1.0.0-preview.14 108 11/23/2026
1.0.0-preview.13 101 11/21/2026
1.0.0-preview.12 104 11/20/2026
1.0.0-preview.11 108 11/18/2026
1.0.0-preview.10 103 11/17/2026
1.0.0-preview.9 137 11/17/2026
1.0.0-preview.8 111 11/17/2026
Loading failed

What this release changed is in Forma's changelog: https://github.com/FormaUI/Forma/blob/v1.0.0-preview.27/CHANGELOG.md