youtube_player_flutter icon indicating copy to clipboard operation
youtube_player_flutter copied to clipboard

[web] player works fine on debug but crashes on deployed site

Open aytunch opened this issue 1 year ago • 2 comments

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: Screenshot 2023-05-02 at 19 33 52

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

aytunch avatar May 02 '23 16:05 aytunch

same issue

halfaHalfawy avatar Jul 08 '23 02:07 halfaHalfawy

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';

talhaocakci avatar Jul 25 '23 21:07 talhaocakci