Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Grey Screen issue when you deploy web app #909

Open
superman-danny opened this issue Jan 23, 2024 · 12 comments
Open

[BUG] Grey Screen issue when you deploy web app #909

superman-danny opened this issue Jan 23, 2024 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@superman-danny
Copy link

superman-danny commented Jan 23, 2024

It shows and works perfectly in development server but when it goes live or in release mode. I get a grey screen

LIVE
Screenshot 2024-01-23 at 9 20 07 AM

PRODUCTION
Screenshot 2024-01-23 at 9 20 07 AM (2)

@superman-danny superman-danny added the bug Something isn't working label Jan 23, 2024
@sarbagya-acme
Copy link
Contributor

https://sarbagyastha.github.io/youtube_player_flutter/#/

Seems to be working, can you provide console logs ?

@moradiyajay
Copy link

I'm getting the same issue. Any solution?

@droidbg
Copy link

droidbg commented Mar 12, 2024

@superman-danny did you find any solution ? I am also facing the same.

@Z3ZEL
Copy link

Z3ZEL commented Mar 15, 2024

Same here, grey screen is the flutter production way to replace the big red error screen on debug btw.
It's working perfectly on debug mode (using flutter run). But soon as I use the compiled web version, It turns into error. I managed to catch this :
Null check operator used on a null value
bjs@http://127.0.0.1:5000/main.dart.js:34824:14 acd@http://127.0.0.1:5000/main.dart.js:113977:3 bmB@http://127.0.0.1:5000/main.dart.js:34131:3 b6P@http://127.0.0.1:5000/main.dart.js:34133:20 aB@http://127.0.0.1:5000/main.dart.js:111242:7 J1@http://127.0.0.1:5000/main.dart.js:91694:14 fA@http://127.0.0.1:5000/main.dart.js:91664:6.....

Not that useful tho.

If someone could help us, it'd be amazing :)

@droidbg
Copy link

droidbg commented Mar 17, 2024

@Z3ZEL deploying to production with a workflow is solving the issue.

@ReinisSprogis
Copy link

Same here. Suspecting CORS to be a problem.

@romain-girou
Copy link

Hello there !
Having the same issue, what did you guys do (@droidbg and @ReinisSprogis) to fix it ?

@romain-girou
Copy link

Well fixed it myself, looks like it's link to the renderer used to build the web. I was using the default CanvasKit and I build and deploy using the html and deployed and it works.
the command to build with html : flutter build web --web-renderer html

@ReinisSprogis
Copy link

@romain-girou html renderer isn't recomended. Low performance. I just needed embeded iframe youtube video. So i made my own widget that is doing just that.

@droidbg
Copy link

droidbg commented Mar 20, 2024

@ReinisSprogis it would be helpful if you could share your code of the widget, thanks.

@ReinisSprogis
Copy link

@droidbg @romain-girou

import 'package:flutter/material.dart';
import 'package:web/web.dart' as web;
import 'dart:ui_web' as ui;

import 'package:youtube_parser/youtube_parser.dart';

class YoutubeVideoIFrame extends StatefulWidget {
  const YoutubeVideoIFrame({super.key, required this.videoURL});
  final String videoURL;
  @override
  State<YoutubeVideoIFrame> createState() => _YoutubeVideoIFrameState();
}

class _YoutubeVideoIFrameState extends State<YoutubeVideoIFrame> {
  @override
  void initState() {
    super.initState();
    String? id = getIdFromUrl(widget.videoURL);
    if (id != null) {
      ui.platformViewRegistry.registerViewFactory(
          'youtube_player_${widget.videoURL}',
          (int viewId) => web.HTMLIFrameElement()
            ..style.width = '100%'
            ..style.height = '100%'
            ..allowFullscreen = true
            ..src = 'https://www.youtube.com/embed/${id}'
            ..style.border = 'none');
    }
  }

  @override
  Widget build(BuildContext context) {
    return HtmlElementView(viewType: 'youtube_player_${widget.videoURL}');
  }
}

@dev210202
Copy link

dev210202 commented Mar 24, 2024

@superman-danny @droidbg
I found the solution in this link.
#819 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants