MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Cannot modify the currentTime of a video in HTML page displayed by SetVirtualHostNameToFolderMapping

Open
#1,386 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug priority-low tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Description
It is not possible to advance or rewind a video when it is displayed in a web page (in a webview2) via SetVirtualHostNameToFolderMapping

Indeed, it's possible to do "play", "pause", change volume source, but not clic on timeline.
If I change currentTime with javascript the video restart in 0.

However, this same page displayed with local path, the video controler works.

I haven't error message.

Version
SDK: .NEt Framework 4.7.2
VS2019
Runtime: 1.0.864.35
Framework: WinForms
OS: Win10 (20H2)

Repro Steps
1/ Create a folder in your computer (by example "c:\test")
2/ In this folder, put a mp4 video named "video.mp4" and create a "index.html" file with this html code

<!DOCTYPE html>
<html>
	<body>
		<video style="width: 100%; height: 100%; " autoplay="" controls=""><source src="video.mp4" type="video/mp4"></video>
	</body>
</html>

3/ Create a new Project (Windows Forms Application in VB.NET)
4/ Install a package "Microsoft.Web.WebView2" via Nuget
5/ Add a "Windows Forms" in your Project (named Form1)
6/ Add a "Webview2" in Your forms (named WebView21), en change source for "about:blank"
7/ Modify Form1 code and add

Public m_alreadyinit As Boolean = False
  Public Async Sub initializeAsync()
      If WebView21.CoreWebView2 IsNot Nothing Then
          If m_alreadyinit = False Then
              m_alreadyinit = True
              WebView21.CoreWebView2.AddWebResourceRequestedFilter("*", CoreWebView2WebResourceContext.All)

              Dim opts = New CoreWebView2EnvironmentOptions With {
              .AdditionalBrowserArguments = " --disable-web-security --allow-file-access-from-files --allow-running-insecure-content"
              }
              Dim env = Await CoreWebView2Environment.CreateAsync(Nothing, "C:\test\", opts)
              Await WebView21.EnsureCoreWebView2Async(env)

              WebView21.CoreWebView2.SetVirtualHostNameToFolderMapping("myvirtualhost", "C:\test\", CoreWebView2HostResourceAccessKind.Allow)

              MyWebView2.Source = New Uri("http://myvirtualhost/test.html")
              '----> this code it's OK WebView21.Source = New Uri("file:///c:/test/test.html")
          End If
      End If
  End Sub
  Private Sub m_media_NavigationCompleted(sender As Object, e As CoreWebView2NavigationCompletedEventArgs)
      initializeAsync()
  End Sub

8/ Compile, and check, It's possible to play/pause/change volume but impossible to change currenttime
9/ If I change the WebView2 source for used "New Uri("file:///c:/test/test.html")" then the change currentime works

AB#33799172

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied VB.NET WinForms reproduction and compare the same video page loaded through SetVirtualHostNameToFolderMapping with the file:/// URL. Check the reported play, pause, volume, timeline, and JavaScript currentTime behaviors in both cases. Done means the seeking discrepancy is explained and a maintainer-confirmed fix or limitation is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
desktop, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.