WavesurferBlazorWrapper 0.5.1
dotnet add package WavesurferBlazorWrapper --version 0.5.1
NuGet\Install-Package WavesurferBlazorWrapper -Version 0.5.1
<PackageReference Include="WavesurferBlazorWrapper" Version="0.5.1" />
<PackageVersion Include="WavesurferBlazorWrapper" Version="0.5.1" />
<PackageReference Include="WavesurferBlazorWrapper" />
paket add WavesurferBlazorWrapper --version 0.5.1
#r "nuget: WavesurferBlazorWrapper, 0.5.1"
#:package WavesurferBlazorWrapper@0.5.1
#addin nuget:?package=WavesurferBlazorWrapper&version=0.5.1
#tool nuget:?package=WavesurferBlazorWrapper&version=0.5.1
Blazor wrapper around wavesurfer.js.
Included wavesurfer.js version: 7.10.1.
Supported target frameworks: .NET 8, .NET 9, and .NET 10.
Scripts
Add the bundled scripts to your layout:
<script src="_content/WavesurferBlazorWrapper/wavesurfer.min.js"></script>
<script src="_content/WavesurferBlazorWrapper/wavesurfer.regions.min.js"></script>
<script src="_content/WavesurferBlazorWrapper/wavesurfer.timeline.min.js"></script>
<script src="_content/WavesurferBlazorWrapper/wavesurfer.minimap.min.js"></script>
wavesurfer.js v7 removed the Markers plugin. Wrapper marker methods are backed by single-point Regions.
Basic Usage
@using WavesurferBlazorWrapper
<WavesurferPlayer Url="youraudiofile.mp3" />
Multiple players can be used on the same page:
<WavesurferPlayer ShowDefaultToolbar Url="/audio/track-1.mp3" />
<WavesurferPlayer ShowDefaultToolbar Url="/audio/track-2.mp3" />
<WavesurferPlayer ShowDefaultToolbar Url="/audio/track-3.mp3" />
Regions And Content
Use WavesurferRegion for new code. WavesurferRegionOption is the older key/value option helper and is kept for compatibility.
await Player.RegionAddRegion(new WavesurferRegion
{
Start = 12.4f,
End = 16.8f,
Content = "First lyric line",
Color = "rgba(10, 120, 220, 0.2)",
Drag = false,
Resize = false
});
Export Peaks JSON
wavesurfer.js v7 replaced exportPCM with exportPeaks. Use ExportPeaks after the player is ready:
<WavesurferPlayer @ref="Player" Url="sample.wav" OnReady="PlayerReady" />
@code {
private WavesurferPlayer? Player;
private async Task PlayerReady()
{
if (Player is null)
{
return;
}
var peaks = await Player.ExportPeaks(channels: 2, maxLength: 1000, precision: 10000);
var json = System.Text.Json.JsonSerializer.Serialize(peaks);
}
}
ExportPCM is obsolete and delegates to the v7 peaks export behavior.
ASP.NET Core MVC
This package is a Blazor component library. It can be used from ASP.NET Core MVC only through the standard ASP.NET Core Blazor component integration path, not as a plain Razor view helper.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.Components.Web (>= 10.0.0)
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.0)
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.