pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.22k stars 1.58k forks source link

YouTube embedded player in webview #28

Open velsa opened 5 years ago

velsa commented 5 years ago

I've set the option 'mediaPlaybackRequiresUserGesture': false, but youtube player still doesn't autostart. I'm emeding YouTube player in webview by opening a url https://www.youtube.com/embed/Mz3kHQxBjGg?autoplay=1

Any ideas on how to make it autoplay in the webview?

SteadyAction commented 5 years ago

Same issue!

SteadyAction commented 5 years ago

@pichillilorenzo

maltub9 commented 4 years ago

I encounter an issue when I click on full screen button inside the youtube video. the app crush after that. what is the solution for this?

pichillilorenzo commented 4 years ago

@maltub9 please post the error log you get, otherwise I can't fix it. Also, if possible, post the code you are using to show the youtube video in order to debug it. Thanks

mind-easy commented 2 years ago

I still have the same issue. Is there a solution for this?

water-user commented 2 years ago

Same here, version ^5.4.3+7, Here's the code:

  InAppWebViewGroupOptions options = InAppWebViewGroupOptions(
      crossPlatform: InAppWebViewOptions(
        useShouldOverrideUrlLoading: true,
        mediaPlaybackRequiresUserGesture: false,
      ),
      android: AndroidInAppWebViewOptions(
        useHybridComposition: true,
      ),
      ios: IOSInAppWebViewOptions(
        allowsInlineMediaPlayback: true,
      ));
  @override
  Widget build(BuildContext context) {
    return InAppWebView(
      key: webViewKey,
      initialUrlRequest: URLRequest(
        url: Uri.parse('https://www.youtube.com/embed/q_dsgjGRBsw?autoplay=1'),
      ),
      initialOptions: options,
      onWebViewCreated: (controller) {
        webViewController = controller;
      },
    );
  }