Skip to content

ReplaceSurfaceProducer.Callback.onSurfaceCreated with onSurfaceAvailable when published to stable #155131

Closed

Description

@matanlurey

Callback.SurfaceProducer.onSurfaceCreated reads:

Invoked when a previous surface is now invalid and a new surface is now available.

Unfortunately this (a) is not a true statement and (b) the method name sucks.

What this really is:

public FlutterRenderer(@NonNull FlutterJNI flutterJNI) {
  this.flutterJNI = flutterJNI;
  this.flutterJNI.addIsDisplayingFlutterUiListener(flutterUiDisplayListener);
  ProcessLifecycleOwner.get()
      .getLifecycle()
      .addObserver(
          new DefaultLifecycleObserver() {
            @Override
            public void onResume(@NonNull LifecycleOwner owner) {
              Log.v(TAG, "onResume called; notifying SurfaceProducers");
              for (ImageReaderSurfaceProducer producer : imageReaderProducers) {
                if (producer.callback != null) {
                  producer.callback.onSurfaceCreated();
                }
              }
            }
          });
  }

A resume is not directly correlated with a surface creation.

Some possible ideas:

  1. Only call the method when the surface was previously destroyed
  2. Rename the method onSurfaceAvailable or onSurfaceResumed

/cc @johnmccutchan @jonahwilliams @reidbaker

Activity

  1. added
    platform-androidAndroid applications specifically
    P2Important issues not at the top of the work list
    c: tech-debtTechnical debt, code quality, testing, etc.
    fyi-androidFor the attention of Android platform team
    on Sep 12, 2024
  2. johnmccutchan commented on Sep 13, 2024

    @johnmccutchan
    Contributor

    I like onSurfaceAvailable

  3. self-assigned this
    on Sep 24, 2024
  4. 15 remaining items

  5. stuartmorgan-g commented on Dec 17, 2024

    @stuartmorgan-g
    Contributor

    @nikorehnback You need to flutter pub upgrade; treating warnings as errors in video_player_android is a bug that was fixed in 2.7.7, and you are still using 2.7.3.

  6. nikorehnback commented on Dec 18, 2024

    @nikorehnback

    @nikorehnback You need to flutter pub upgrade; treating warnings as errors in video_player_android is a bug that was fixed in 2.7.7, and you are still using 2.7.3.

    This seemed to help, thanks @stuartmorgan

  7. self-assigned this
    on Dec 18, 2024
  8. github-actions commented on Jan 21, 2025

    @github-actions

    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 -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: tech-debtTechnical debt, code quality, testing, etc.platform-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