12345678910111213141516171819 |
- using System.Runtime.InteropServices.JavaScript;
- using System.Runtime.Versioning;
- namespace SimpleWebChat.BlazorWasm.Modules;
- [SupportedOSPlatform("browser")]
- public static partial class AudioPlaybackModule
- {
- private static JSObject _jsModule;
- public static async Task PlayChunk(byte[] chunk)
- {
- _jsModule ??= await JSHost.ImportAsync("SvcAudioPlaybackModule", $"{GlobalModule.BasePath ?? "/"}svc-audio-playback-module.js");
- await JsPlay(chunk);
- }
- [JSImport("play", "SvcAudioPlaybackModule")]
- private static partial Task JsPlay(byte[] chunk);
- }
|