Repository navigation
Description
Bug
Only on CanvasKit, HtmlElementViews are destroyed on resize. This is a critical issue for us as it completely breaks using the embedded video player in full-screen.
Steps to Reproduce
The integrated example is a bit complex, so here is a simplified version of it. It shows the same behavior.
As soon as you resize on CanvasKit, the HtmlElementView is destroyed. Doing the same using the HTML renderer works fine (the iframe is not reloaded).
- Run
flutter create bug. - Update
main.dartas follows:
import 'dart:html';
import 'package:flutter/material.dart';
import 'dart:ui' as ui;
void main() {
final iframe = IFrameElement()
..id = 'bug'
..src = 'https://flutter.dev'
..allowFullscreen = true
..style.overflow = 'hidden'
..setAttribute('frameBorder', '0')
..setAttribute('scrolling', 'no');
ui.platformViewRegistry.registerViewFactory(
'bug',
(int viewId) => iframe,
);
runApp(MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 480,
height: 270,
child: HtmlElementView(
viewType: 'bug',
),
),
),
),
));
}- Run
flutter run -d chrome --web-renderer=html - Resize the window: the Flutter page should not be reloaded when resizing
- Run
flutter run -d chrome --web-renderer=canvaskit - Resize the window: the Flutter page should not be reloaded when resizing
Illustration
(Turn on sound for an explanation.)
Screen.Recording.2021-03-25.at.18.05.03.mov
Elaborate integrated example showing why this is critical (click to expand)
Integrated example
To illustrate why this is an issue in a real-world sense, here is an example:
Using HTML renderer
As you can see, I am able to use full-screen successfully. I am also able to zoom in a little or resize the window without the HtmlElementView being destroyed.
Screen.Recording.2021-03-25.at.16.59.50.mov
Using CanvasKit renderer
As soon as I tap on full-screen, zoom in, or resize in any other way, the HtmlElementView is destroyed and it does not work at all.
Activity
creativecreatorormaybenot commentedon Mar 25, 2021
In my mind, this is a regression. And a critical one actually. This is because the default web renderer was switched to CanvasKit and if you take a look at the integrated example, you will see that it completely breaks the video player in our web app.
darshankawar commentedon Mar 26, 2021
Issue replicable on latest master and stable with canvaskit rendering.
79065.mov
flutter doctor -v
yjbanov commentedon Apr 1, 2021
Deduplicating with #51865. @ditman is working on a fix for this, it's just not a trivial fix, so it will take a little time.
github-actions commentedon Aug 3, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.