MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
423 stars 51 forks source link

Html Audio Control: Can't set currentTime #3422

Open Terrence77 opened 1 year ago

Terrence77 commented 1 year ago

Description WinForms with Microsoft.AspNetCore.Components.WebView.WindowsForms.BlazorWebView

When adding an html

The same bug exists in a Maui Blazor App The bug does not exist in a regular Blazor Server App.

The Pause, Volume and Playback Speed work just fine.

image

image

Project Sdk="Microsoft.NET.Sdk.Razor"> PropertyGroup> OutputType>WinExe TargetFramework>net7.0-windows UseWindowsForms>true ImplicitUsings>enable /PropertyGroup> ItemGroup> PackageReference Include="Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="7.0.81" /> /ItemGroup> /Project>

AB#44489621

novac42 commented 1 year ago

Could you please provide some more information about this?

Terrence77 commented 1 year ago

I am running Windows 10 (21H2 OS build 19044.2846)

Project Sdk="Microsoft.NET.Sdk.Razor"> WinExe net7.0-windows "Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="7.0.81" WebView2 (1.0.1370.28)

I posted this in the original post, isn't this the runtime info you are looking for? If not, please tell me what else/how to get the info and I will gladly post it.

Thank you.

Terrence77 commented 1 year ago

@Shangminx Do you have any information about this issue?

vickiez commented 1 year ago

Hi @Terrence77, you can find the WebView2 Runtime version by checking the path of the WebView2 process in Task Manager (under Properties when you right click on the process).

I created a work item to track this internally, we'll let you know on this thread when there is an update.

Terrence77 commented 1 year ago

@vickiez Is this information what you need? "Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="7.0.81"

WebView2 (1.0.1370.28)

If not, I would bet the issue is in any of the latest runtime versions?

Thank you for helping.

vickiez commented 1 year ago

@Terrence77 1.0.1370.28 is the SDK version, it helps us to also know the WebView2 Runtime version when we try to repro

Terrence77 commented 1 year ago

Is this it? image

vickiez commented 1 year ago

Yes, thank you for the info!

Terrence77 commented 1 year ago

@vickiez When I run my app in a Blazor Server app, the Audio control works perfectly. I looked at the runtime while running the Blazor app and it is the same as I posted above.

The problem shows in a Blazor Maui App and a WinForms app using the WebView2 control.

vickiez commented 1 year ago

Got it, thanks. FWIW, I wasn't able to repro with a regular WebView2 WinForms app with that SDK and Runtime. If the issue is in Maui you may want to also open an issue here: https://github.com/dotnet/maui/issues

Terrence77 commented 1 year ago

@vickiez

  1. So are you saying when you are playing an audio stream, and you move the timeline forward it sticks to the timeline? When I do it, the audio reverts back to the beginning.

  2. Can I upload a zip file of my simple project to demo the issue?

  3. Or can you post your simple project example of it workin?

  4. Are you clear on the issue that I am having?

Thank you for working with me on this.

vickiez commented 1 year ago

Yes, setting audio.currentTime is working fine for me with our WinForms sample app. I am just adding an audio element and advancing the time. A repro project would be great, thanks! Feel free to modify our Winforms app as well.

Terrence77 commented 1 year ago

@vickiez Attached is my sample code, Everything is in the Counter.razor page and the Components/TpsAudioPlayer.razor files. I deleted the sample mp3 file in the wwwroot/audio folder so adjust the path in the Counter.razor file.

WinFormsAudio.zip

Thank you.

Terrence77 commented 1 year ago

@vickiez The sample app you posted is not using the same control I am...I don't think. This sample app is using:

<TargetFrameworks>net462</TargetFrameworks>
 <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1777-prerelease" />

I am using

    <TargetFramework>net7.0-windows</TargetFramework>
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="7.0.81" />

So the Audio element might have worked in that old project, but it does not work in the newer versions.

Terrence77 commented 1 year ago

@vickiez, @Shangminx any update on running my code?

vickiez commented 1 year ago

Our Winforms app is actually using the newer version of the WebView2 SDK, 1.0.1777-prerelease. The BlazorWebView component in your app appears to be using the 1.0.1370.28 WebView2 SDK.

I changed our Winforms app to use the same SDK but couldn't repro, so the issue may be in BlazorWebView. It's maintained in the repo I linked above

Terrence77 commented 1 year ago

Ok, over in the Maui area? Thanks.

sarah-harissa commented 3 months ago

I am facing same issue in samsung tizen tv apps, sometimes current time is not working, maybe because mp3 is long? did any one find the reason for this?

Terrence77 commented 2 months ago

@sarah-harissa Check out this topic over in Maui Blazor https://github.com/dotnet/maui/issues/14964