概述
WebVR in WebView
06/12/2018
2 分钟可看完
本文内容
As of the Windows 10 April 2018 Update (version 1803, build 17134, EdgeHTML 17), WebVR is supported in WebView controls in Windows 10 apps. The WebView control enables you to host web content in your Windows 10 app. See Microsoft Edge WebView for Windows 10 apps for more information about WebView.
Add WebVR support to a WebView control
In order for your WebView control to host WebVR content, there are a few steps you'll have to take.
Initialize the WebView programmatically to run in a separate process. You'll have to declare, initialize, and add it to the UI programmatically (rather than declaratively in the XAML or HTML).
Add a PermissionRequested event handler for the WebView. In it, allow the permission request.
The following sample declares and initializes a WebView, handles the PermissionRequested event, adds the WebView to the UI, and navigates to a WebVR site.
WebView webView;
public MainPage()
{
this.InitializeComponent();
webView = new WebView(WebViewExecutionMode.SeparateProcess);
webView.PermissionRequested += MyWebView_PermissionRequested;
MyGrid.Children.Add(webView);
Grid.SetRow(webView, 1);
webView.Navigate("https://webvr.info/samples/03-vr-presentation.html");
}
private void MyWebView_PermissionRequested(
WebView sender, WebViewPermissionRequestedEventArgs args)
{
args.PermissionRequest.Allow();
}
let wvprocess = new MSWebViewProcess();
// WebViews created with the same MSWebViewProcess object share the same process
wvprocess.CreateWebViewAsync().then(function (webview) {
webview.navigate("https://webvr.info/samples/03-vr-presentation.html");
document.body.appendChild(webview);
webview.addEventListener("MSWebViewPermissionRequested", e => {
e.permissionRequest.allow();
});
});
See also
最后
以上就是自信毛巾为你收集整理的android webview vr,WebVR in WebView的全部内容,希望文章能够帮你解决android webview vr,WebVR in WebView所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复