I have moved the previous discussion from the module suggestion post to a specific one
I got it working. The problem comes with Webview2 security policies that don't allow the use of local resources when using Webview:loadstring()
, because the origin of the Webview content is set to about:blank
See [Login to see the link] for more on this
To make it works, you should put the html content in a separate file and load it directly from the Webview constructor call :
example.html
<!doctype html>
<html>
<head>
<title>Test Video Player</title>
</head>
<body>
<video controls style="top:0; left: 0; position: absolute; height: calc(100vh); width: 100%; object-fit: cover">
<source src="example.mp4" type="video/mp4">
</video>
</body>
</html>
video.lua
local ui = require "ui"
require "webview"
local win = ui.Window("Test Video Player", 640, 540)
local wv = ui.Webview(win, "file:///"..sys.File("example.html").fullpath)
wv.align = "all"
win:center()
ui.run(win):wait()
Both files should be in the the current directory