youtube_player_flutter
youtube_player_flutter copied to clipboard
[web] player works fine on debug but crashes on deployed site
The moment controller is created, we get an error. In debug mode it works perfectly. Do anyone have any idea? I will supply more crash logs soon..
In debug mode, we get an error but it does not effect the functionality:
In release deployment we get this error the moment controller is created and no player and widget is rendered on screen:
NoSuchMethodError: method not found: 'bw8' on null
same issue
I solved the problem like this: First, the reason is: WebYoutubePlayerIframePlatform is not loaded via flutter_web_view since following plugin is not loaded in release mode: https://github.com/sarbagyastha/youtube_player_flutter/blob/master/packages/youtube_player_iframe_web/pubspec.yaml#L15
I have initialized the WebViewPlatform.instance in my own widget's initState method of the webview_flutter which is used by youtube player plugin of this repository.
WebViewPlatform.instance = WebYoutubePlayerIframePlatform();
required imports are
import 'package:webview_flutter_platform_interface/src/webview_platform.dart';
import 'package:youtube_player_iframe_web/src/web_youtube_player_iframe_platform.dart';