-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Hi ,
We are developping an video app using Hybrid composition Platform view on android.
And here , we encounted an issue:
- render the video with Native view on main.dart
- open another flutter page to cover the video view
- press the Home button and put the app to background
- resume the app from Task list
- you will see the video view on the top of second page.
I simplified this issue to below sample code . This sample creates an surfaceview on the native side, and it will fill the entire canvas to RED while the surface create.
Every time put the app to background, the surfaceview will be destroyed. On resuming app to foreground,the surface view will be created again on the top of second page.
I have verified this issue on flutter channel master/dev/beta, and it can be reproduced on these channels.
BTW: Virtual Display mode does not have such issue. You could unmark the line 86 in mart.dart to verify that.
Dart side:
main.dart: https://github.com/neoyxm/neoMP/blob/master/main.dart
page2.dart: https://github.com/neoyxm/neoMP/blob/master/page2.dart
Native side to create the native view:
MainActivity.java: https://github.com/neoyxm/neoMP/blob/master/MainActivity.java
NativeView.java: https://github.com/neoyxm/neoMP/blob/master/NativeView.java
NativeViewFactory.java: https://github.com/neoyxm/neoMP/blob/master/NativeViewFactory.java
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.1 20G80 darwin-x64, locale zh-Hans-CN)
• Flutter version 2.2.3 at /opt/flutter
• Framework revision f4abaa0735 (7 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/yangxm/Library/Android/sdk/
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Users/yangxm/Library/Android/sdk/
• Java binary at: /Library/Java/JavaVirtualMachines/openjdk8/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_275-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] VS Code (version 1.59.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.25.0
[✓] Connected device (3 available)
• Pixel 3 (mobile) • 8ABX0PZMP • android-arm64 • Android 11 (API 30)
• macOS (desktop) • macos • darwin-x64 • macOS 11.5.1 20G80 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159