iframe method

Future<void> iframe(
  1. WebPlayerSource source
)

Implementation

Future<void> iframe(WebPlayerSource source) {
  _source = source;
  webViewController.setNavigationDelegate(NavigationDelegate(
    onNavigationRequest: (NavigationRequest request) async {
      if (request.url == "about:blank" || request.url == source.url) {
        return NavigationDecision.navigate;
      }
      return NavigationDecision.prevent;
    },
  ));
  return webViewController.loadHtmlString("""
<head>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Video Oynatıcı</title>
  <style>
      body,
      html {
          margin: 0;
          padding: 0;
        height: 100%;
         overflow: hidden;
       background-color:black;
      }

      iframe {
          width: 100%;
          height: 100%;
      }
  </style>
</head>

<body>


 <iframe src="${source.url}" frameborder="0" autoplay=${source.autoPlay} allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

</body>
""");
}