Skip to content

Commit c0aeef0

Browse files
Only get helper for AudioBufferSourceNode if it is needed.
1 parent d68bf29 commit c0aeef0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/KristofferStrube.Blazor.WebAudio/AudioNodes/AudioBufferSourceNode.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ protected AudioBufferSourceNode(IJSRuntime jSRuntime, IJSObjectReference jSRefer
5151
/// <returns>An <see cref="AudioBuffer"/></returns>
5252
public async Task<AudioBuffer?> GetBufferAsync()
5353
{
54-
IJSObjectReference helper = await webAudioHelperTask.Value;
5554
await using ValueReference bufferAttribute = new(JSRuntime, JSReference, "buffer");
56-
5755
if (await bufferAttribute.GetTypeNameAsync() is "null")
5856
{
5957
return null;
6058
}
6159

60+
IJSObjectReference helper = await webAudioHelperTask.Value;
6261
IJSObjectReference jSInstance = await helper.InvokeAsync<IJSObjectReference>("getAttribute", JSReference, "buffer");
6362
return jSInstance is null ? null : await AudioBuffer.CreateAsync(JSRuntime, jSInstance, new() { DisposesJSReference = true });
6463
}

0 commit comments

Comments
 (0)