MagicRain
MagicRain

Reputation: 75

Flutter: Make iFame fullscreen on Android device

I'm trying to load an iFrame by using webview_flutter. I cann't full screen the video on Android. It works well on iOS.

Here is my set-up.
webview_flutter: 0.3.18+1

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

void main() {
  runApp(MaterialApp(
    title: 'IFrameTest',
    home: IFrameDemo(),
  ));
}

class IFrameDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Iframe'),
      ),
      body: Center(
        child: Container(
            child: WebView(
          initialUrl: Uri.dataFromString(
                  '<html><body><iframe width="300" height="200"  src="http://player.youku.com/embed/XODY3NDMzNjY4" allowfullscreen></iframe></body></html>',
                  mimeType: 'text/html').toString(),
          javascriptMode: JavascriptMode.unrestricted,
        )),
      ),
    );
  }
}

When I click the full-screen button on the right-bottom corner, I will get the following error:

2020-03-02 11:50:38.411 7845-7845/com.example.helloiframe E/InputMethodManager: b/117267690: Failed to get fallback IMM with expected displayId=1 actual IMM#displayId=0 view=io.flutter.plugins.webviewflutter.InputAwareWebView{4981903 VFEDHVC.. .F...... 0,0-1080,1840}

Upvotes: 4

Views: 2161

Answers (2)

Rahul Singh
Rahul Singh

Reputation: 168

use flutter_inappwebview


here is a sample code

import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';

Future main() async {
  WidgetsFlutterBinding.ensureInitialized();

  runApp(MaterialApp(home: new MyApp()));
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text("Sample")),
        body: SizedBox(
          height: 250,
          child: InAppWebView(
            initialData: InAppWebViewInitialData(
              data: 'YOUR IFRAME'
            ),
          ),
        ),
    );
  }
}

Upvotes: 1

MαπμQμαπkγVπ.0
MαπμQμαπkγVπ.0

Reputation: 6737

There is actually an open ticket in GitHub, currently fullscreen in webview_flutter is not yet supported.

I can reproduce the issue, this is not supported yet #27101 Please follow up on that issue, I'm closing the current one as a duplicate. If you disagree, please write in the comments and I will reopen it. Thank you

Upvotes: 0

Related Questions