简体   繁体   中英

Is there WebGL support in Flutter WebView?

EDIT 5/28/2020: Not sure when exactly this was fixed, but as of Flutter 1.17.0, I no longer have this problem.

I've been trying to implement an iframe in Flutter WebView that requires WebGL (it displays a 3d model).

However, I get a warning saying WebGL in my browser is supported but not enabled. Here's a snippet for getting to https://get.webgl.org :

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class ModelView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Model View'),
      ),
      body: Container(
        child: WebView(
          initialUrl: 'https://get.webgl.org',
          javascriptMode: JavascriptMode.unrestricted,
        ),
      ),
    );
  }
}

Which displays:

Flutter WebView WebGL

Is there a way to enable WebGL for WebView ? Or is it impossible right now?

webview_flutter on Android uses Platform Views to embed Android WebView while WKWebView is used on iOS. Both have WebGL support so displaying https://get.webgl.org/ should work fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM