Giter Site home page Giter Site logo

Comments (4)

calren avatar calren commented on August 11, 2024 1

After more investigating, this seems to be a Compose-related issue. When the sample was isolated to only use Views (https://github.com/calren/ViewsTransformerExoPlayerDemo), the issue was no longer present.

The Compose issue is being tracked here: androidx/media#1237 . Using the 1.4.0-rc01 version of PlayerView should resolve this issue. Once Media3 1.4.0-rc01 is released, I will update the Media3 dependency and test again.

In the mean time, I don't think we need to merge the fix that involves using AspectRatioFrameLayout, so I will close #173

from platform-samples.

calren avatar calren commented on August 11, 2024

@droid-girl Any idea why this might be happening? Feels like the code might be missing something in between setting the mediaItem on the exoplayer and preparing exoplayer for playback (https://github.com/android/platform-samples/blob/main/samples/media/video/src/main/java/com/example/platform/media/video/TransformerVideoComposition.kt#L261-L272), but I can't figure out what's missing. Hoping someone on the ExoPlayer team can help debug.

from platform-samples.

calren avatar calren commented on August 11, 2024

From Kristina: Maybe we should try AspectRatioLayout, ie: https://github.com/androidx/media/blob/d833d59124d795afc146322fe488b2c0d4b9af6a/demos/transformer/src/main/res/layout/transformer_activity.xml#L88

I will give this a try and see if the issue persists.

from platform-samples.

calren avatar calren commented on August 11, 2024

I got the issue resolved by:

  1. Putting PlayerView inside AspectRatioFrameLayout
    <androidx.media3.ui.AspectRatioFrameLayout
        android:id="@+id/input_debug_aspect_ratio_frame_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <androidx.media3.ui.PlayerView
            android:id="@+id/media_player"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </androidx.media3.ui.AspectRatioFrameLayout>
  1. Explicitly setting aspect ratio in the Activity / Fragment
    binding.inputDebugAspectRatioFrameLayout.setAspectRatio(16f/9f)

Will submit a PR for this fix.

This doesn't seem very intuitive, so I will explore ways we can make this easier for the developer.

from platform-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.