Skip to content

Commit 81917f4

Browse files
committed
Make Video component
1 parent b4c877c commit 81917f4

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

src/Components/Web.JS/src/GlobalExports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { WebStartOptions } from './Platform/WebStartOptions';
2020
import { RuntimeAPI } from '@microsoft/dotnet-runtime';
2121
import { JSEventRegistry } from './Services/JSEventRegistry';
2222
import { BinaryImageComponent } from './Rendering/BinaryImageComponent';
23-
import { BinaryMedia } from './Rendering/Media/BinaryMedia';
23+
import { BinaryMedia } from './Rendering/BinaryMedia';
2424

2525
// TODO: It's kind of hard to tell which .NET platform(s) some of these APIs are relevant to.
2626
// It's important to know this information when dealing with the possibility of mulitple .NET platforms being available.

src/Components/Web.JS/src/Rendering/Media/BinaryMedia.ts renamed to src/Components/Web.JS/src/Rendering/BinaryMedia.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
import { Logger, LogLevel } from '../../Platform/Logging/Logger';
5-
import { ConsoleLogger } from '../../Platform/Logging/Loggers';
4+
import { Logger, LogLevel } from '../Platform/Logging/Logger';
5+
import { ConsoleLogger } from '../Platform/Logging/Loggers';
66

77
export interface MediaLoadResult {
88
success: boolean;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Microsoft.AspNetCore.Components.Web.Media;
5+
6+
/// <summary>
7+
/// A component that renders video content from non-HTTP sources (byte arrays or streams)
8+
/// by materializing an in-memory blob and assigning its object URL to the underlying
9+
/// <c>&lt;video&gt;</c> element.
10+
/// </summary>
11+
/// <remarks>
12+
/// This component uses the same client-side pipeline as <see cref="Image"/> and therefore
13+
/// reads the full content into memory to create a blob URL. It is not suitable for large or
14+
/// truly streaming video scenarios. Use browser-native streaming approaches if you require
15+
/// progressive playback.
16+
///
17+
/// To configure common video attributes like <c>controls</c>, <c>autoplay</c>, <c>muted</c>,
18+
/// or <c>loop</c>, pass them through <see cref="MediaComponentBase.AdditionalAttributes"/>.
19+
/// </remarks>
20+
public sealed class Video : MediaComponentBase
21+
{
22+
/// <inheritdoc/>
23+
protected override string TagName => "video";
24+
25+
/// <inheritdoc/>
26+
protected override string TargetAttributeName => "src";
27+
28+
/// <inheritdoc/>
29+
protected override string MarkerAttributeName => "data-blazor-video";
30+
}

src/Components/Web/src/PublicAPI.Unshipped.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Microsoft.AspNetCore.Components.Web.Image.ImageSource.Stream.get -> System.IO.St
2323
Microsoft.AspNetCore.Components.Web.Internal.IInternalWebJSInProcessRuntime.InvokeJS(in Microsoft.JSInterop.Infrastructure.JSInvocationInfo invocationInfo) -> string!
2424
Microsoft.AspNetCore.Components.Web.Media.Image
2525
Microsoft.AspNetCore.Components.Web.Media.Image.Image() -> void
26+
Microsoft.AspNetCore.Components.Web.Media.Video
27+
Microsoft.AspNetCore.Components.Web.Media.Video.Video() -> void
2628
Microsoft.AspNetCore.Components.Web.Media.MediaComponentBase
2729
Microsoft.AspNetCore.Components.Web.Media.MediaComponentBase.AdditionalAttributes.get -> System.Collections.Generic.Dictionary<string!, object!>?
2830
Microsoft.AspNetCore.Components.Web.Media.MediaComponentBase.AdditionalAttributes.set -> void

0 commit comments

Comments
 (0)