Skip to content

Simplify ImageReaderSurfaceProducer: Do not trim memory for external textures #156488

@matanlurey

Description

@matanlurey

As of the migration from SurfaceTexture to ImageReader, we inadvertently broke the ability to run videos in the background, because when the application is backgrounded it typically receives a TRIM_MEMORY(BACKGROUND) event, which in turn causes the surface to be released.

For example, this option is no longer functional:

VideoPlayerOptions({
  bool allowBackgroundPlayback = false,
})

@johnmccutchan mentioned that the particular workaround was for Android 14, and it's possible that in other versions (i.e. Android 15 or newer), we could support background playback (by not releasing the texture). However, I want to make sure (a) I understand this correctly, (b) we consider this a problem, and (c) have a plan on how to fix this - for now it's likely I need to just make a note this functionality is unsupported on Android (or folks will need to fallback to an older pre-ImageReader version of the plugin, which is not ideal).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work listblockedIssue is blocked by another issuec: regressionIt was better in the past than it is nowp: video_playerThe Video Player pluginplatform-androidAndroid applications specificallyteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions