Skip to content

When using PlatformView to create TextureView or SurfaceView on Android, the content on the surface disappears when returning from the background to the foreground #163520

@Kongdy

Description

@Kongdy

Steps to reproduce

  1. Run sample project on Android
  2. Render content on TextureView or SurfaceView in PlatformView
  3. Background app
  4. Foreground app

Expected results

The display remains on the PlatformView.

Actual results

As shown in the video, the display disappears when returning from the background, but reappears when continuing video playback or performing a hot reload in the code

imgDisppeared.mp4

Code sample

https://github.com/Kongdy/miss_img_demo

https://github.com/LiteAVSDK/Player_Flutter

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Tested Flutter versions

3.29.0 ❌ Issue occurs
3.27.4 ❌ Issue occurs
3.27.3 ❌ Issue occurs
3.27.2 ❌ Issue occurs
3.24.5 ❌ Issue occurs
3.22.3 ❌ Issue occurs
3.19.0 ✓ As expected

Tested Devices

Oppo reno 7 on Android 13
Xiaomi MIX4 on Android 14

Flutter Doctor output

Doctor output
~/StudioProject/SuperPlayer/Flutter/example git:[main]
flutter doctor -v
[✓] Flutter (Channel stable, 3.22.3, on macOS 14.6.1 23G93 darwin-arm64, locale zh-Hans-AL)
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b0850beeb2 (7 months ago), 2024-07-16 21:43:41 -0700
    • Engine revision 235db911ba
    • Dart version 3.4.4
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • 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
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.92.1)

[✓] Connected device (4 available)
[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsc: regressionIt was better in the past than it is nowfound in release: 3.29Found to occur in 3.29found in release: 3.30Found to occur in 3.30has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions