-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Description
Hello 👋 I'm building an app that takes screen recordings and presents them to watch back. It's important that these recordings be high quality (e.g. 4k 30fps). I've picked WebView2 so I can use web technology for the UI with low latency access to recording files.
I cannot find a way to achieve this with a video element and WebView2. I've tried various different ways but I keep running into crashes, videos not playing or other deal breaking UX issues. I'll detail what I've tried and what I observe. Here is a repo that demonstrates the issues https://github.com/petegleeson/WebView2VideoExample
SetVirtualHostNameToFolderMapping
I was able to load videos successfully with this approach. A larger video (7 GB) took 9 seconds to load before I could start playing. Once loaded I could not seek the video (using the video controls or with JS). These were both deal breaking UX problems for my application so I parked the approach.
WebResourceRequested
I created a response with the local recording file as a stream in a web resource request handler. After I got the correct content response headers, the video loaded successfully and I was able to seek with the controls and JS. Unfortunately, I quickly ran into problems caused by streaming the whole file in the response. The whole file had to be downloaded before the video could be played. When I tried with the larger video file my app consistently crashed with Unhandled exception at 0x00007FFD59EE474C (KernelBase.dll) in WebView2VideoExample.exe: 0xE0000008 (parameters: 0x00000000C0000000). during the request.
The last thing I tried was to use 206 Partial Content response code and the Content-Range header to stream chunks of the file. To me this sounds like the right approach, but I've had the least success with this. The network tab shows only the chunk being downloaded but the video never loads.
My expectation is to be able to use a video tag and WebView2 to view high quality local video files. I've raised this as a bug because I think that this is a use-case that WebView2 caters for. Please take a look at the repo I prepared for this issue. Happy to provide any more information if needed, I'm very excited about the possibilities of C++ and WebView2 desktop apps.
Version
SDK: 10.0.20348.0
Runtime: Canary 1.0.1293.44
Framework: Win32, WinRT
OS: Win11
Repro Steps
- Clone https://github.com/petegleeson/WebView2VideoExample and run the solution
