Bootstrap UI components extensions of Video
$ dotnet add package BootstrapBlazor.VideoPlayer示例:
https://blazor.app1.es/videoPlayers
使用方法:
1.nuget包
BootstrapBlazor.VideoPlayer
2._Imports.razor 文件 或者页面添加 添加组件库引用
@using BootstrapBlazor.Components
3.razor页面
<VideoPlayer SourcesType="application/x-mpegURL" SourcesUrl="https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8" Debug="true" />
<VideoPlayer SourcesType="video/mp4" SourcesUrl="//vjs.zencdn.net/v/oceans.mp4" />
4.参数说明
| 参数 | 说明 | 默认值 |
|---|---|---|
| SourcesUrl | 资源地址 | null |
| SourcesType | 资源类型,video/mp4, application/x-mpegURL, video/ogg .. 更多参考 EnumVideoType | application/x-mpegURL |
| Width | 宽度 | 300 |
| Height | 高度 | 200 |
| Controls | 显示控制条 | true |
| Autoplay | 自动播放 | true |
| Poster | 设置封面资源,相对或者绝对路径 | |
| Option | 播放器选项, 不为空则优先使用播放器选项,否则使用参数构建 | null |
| async Task Reload(string? url, string? type) | 切换播放资源 | |
| async Task SetPoster(string? poster) | 设置封面 | |
| Func<string, Task>? OnError | 错误回调 |
