FirebaseUI-Android icon indicating copy to clipboard operation
FirebaseUI-Android copied to clipboard

VideoView as a background in the custom layout shows only as a black background

Open museady opened this issue 7 years ago • 4 comments

Step 1: Are you in the right place?

Yes

Step 2: Describe your environment

  • Android device: emulator
  • Android OS version: 8.0
  • Google Play Services version: 4.2.0
  • Firebase/Play Services SDK version: _____
  • FirebaseUI version: 16.1.0

Step 3: Describe the problem:

Steps to reproduce:

  1. In my welcome screen I have button to go for sign-in and the background is a VideoView and its working with no problems
  2. When i select to sign-in I pass the same layout but with additional buttons for the providers using AuthMethodPickerLayout
  3. then the VideoView just stop and turn into black background

Expected Results:

*The VideoView work as a background even when attach the whole view as a custom view to AuthMethodPickerLayout

Relevant Code:

//Linking the custom layout to providers
      AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout
              .Builder(R.layout.activity_auth)
              .setGoogleButtonId(R.id.sign_in_google)
              .setEmailButtonId(R.id.sign_in_email)
              .setFacebookButtonId(R.id.sign_in_facebook)
              .setTwitterButtonId(R.id.sign_in_twitter)
              .build();

      startActivityForResult(
              AuthUI.getInstance()
                      .createSignInIntentBuilder()
                      .setAuthMethodPickerLayout(customLayout)
                      .setTheme(R.style.auth_theme)
                      .setAvailableProviders(Arrays.asList(
                              new AuthUI.IdpConfig.EmailBuilder().build(),
                              new AuthUI.IdpConfig.GoogleBuilder().build(),
                              new AuthUI.IdpConfig.TwitterBuilder().build(),
                              new AuthUI.IdpConfig.FacebookBuilder().build()
                              //Todo Here is the place to add more providers
                      ))
                      .build(),
              RC_SIGN_IN);

museady avatar Feb 07 '19 20:02 museady

@muhammadv2 do you have a video or a screenshot of this? Also is there any code that is needed to start the VideoView? Can you link to some VideoView documentation?

FYI we mostly consider custom layouts an "at your own risk" feature at this point, it's possible that this will never work.

samtstern avatar Feb 07 '19 20:02 samtstern

@samtstern Thanks for the fast response

Sure here's a video showing the case. google drive

I am using the VideoView comming with Android widgets here its documentation And here is the code that starts it

VideoView videoView = findViewById(R.id.video_view); Uri uri = Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.beach_welcome); videoView.setVideoURI(uri); videoView.start();

museady avatar Feb 07 '19 21:02 museady

This seems like intended behavior since FirebaseUI has no idea your app has a VideoView and therefore never calls setVideoURI() ... right? Why would we expect the video to play without that?

We also don't call videoView.start()

samtstern avatar Feb 07 '19 21:02 samtstern

@muhammadv2 here's what I would suggest. Create a custom subclass of VideoView and use that instead. Your subclass should automatically call start() on itself when it moves into the foreground and should also automatically call setVideoURI with the video you want.

Then if you use that view in the xml layout, it should auto-play even though FirebaseUI is managing it.

Closing because there's nothing to do on our side.

samtstern avatar Feb 07 '19 21:02 samtstern