title: Unable To Play Youtube Video in Flutter,
body: <p>I am getting below error while to implement YouTube video player in my flutter app.</p>
  <blockquote>
  <p>Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: com.pichillilorenzo/flutter_inappwebview.</p>
  </blockquote>
  <p>how to solve this issue?</p>
  <pre><code>YoutubePlayerController controller = YoutubePlayerController(initialVideoId: youtubId);    
  YoutubePlayer(
        controller: controller,
        showVideoProgressIndicator: false,
        progressIndicatorColor: AppColors.primaryColor,
      );
  </code></pre>
  <p>I am using <a href="https://pub.dev/packages/youtube_player_flutter" rel="nofollow noreferrer">this package</a></p>
  <p>Is there any other better way for playing youtube videos in flutter (apart from Webview)?</p>
  <pre><code>import 'package:cooking_genie/src/presentation/core/app_colors.dart';
  import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  import 'package:youtube_player_flutter/youtube_player_flutter.dart';
  
  class YoutubePlayerWidget extends StatefulWidget {
    @override
    State&lt;StatefulWidget&gt; createState() {
      return YoutubePlayerWidgetState();
    }
  }
  
  class YoutubePlayerWidgetState extends State&lt;YoutubePlayerWidget&gt; {
    //late YoutubePlayerController _controller;
  
    @override
    void initState() {
      super.initState();
    }
  
    @override
    Widget build(BuildContext context) {
      return YoutubePlayer(
        controller: YoutubePlayerController(
          initialVideoId: 'zn2GwbPG-tc', //Add videoID.
          flags: YoutubePlayerFlags(
            hideControls: false,
            controlsVisibleAtStart: true,
            autoPlay: false,
            mute: false,
          ),
        ),
        showVideoProgressIndicator: true,
        progressIndicatorColor: AppColors.primaryColor,
      );
    }
  
    @override
    void dispose() {
      super.dispose();
    }
  }
  
  ///
  class Controls extends StatelessWidget {
    ///
    const Controls();
  
    @override
    Widget build(BuildContext context) {
      return Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            _space,
          ],
        ),
      );
    }
  
    Widget get _space =&gt; const SizedBox(height: 10);
  }
  </code></pre>