Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[video_player_android] Flutter player widget does not scale correctly if video uses rotation correction #159724

@FirentisTFW

Description

@FirentisTFW

What package does this bug report belong to?

video_player (2.9.2)

What target platforms are you seeing this bug on?

Android

Have you already upgraded your packages?

Yes

Steps to reproduce

  1. Run the example app with updated remote video link on Android device (see Code Sample).
  2. Wait for the video to load (about 7 MB, I could not reduce it because any compression tool I tried resulted in losing rotation correction).
  3. Play the video.
  4. Verify the actual video size and player widget size.

Expected results

Player widget size matches video size.

Actual results

Player widget is smaller and does not match the actual video size. The rotation correction of the video in this case is 270 degrees.

The issue was not observed on iOS and MacOS.

Code sample

Use the example project code (video_player/example/lib/main.dart) with a different link for the remote video. Instead of https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4 use https://drive.google.com/uc?export=download&id=1j8xYdGEYZ_mnfYTnDc4ULxMkc7EBw3AD

Screenshots or Videos

Video demonstration
Screen.Recording.2024-12-03.at.15.08.06.mov

Logs

Output
Restarted application in 870ms.
I/ViewRootImpl( 7263): updatePointerIcon pointerType = 1000, calling pid = 7263
D/InputManager( 7263): setPointerIconType iconId = 1000, callingPid = 7263
I/ViewRootImpl( 7263): updatePointerIcon pointerType = 1000, calling pid = 7263
D/InputManager( 7263): setPointerIconType iconId = 1000, callingPid = 7263
I/ExoPlayerImpl( 7263): Init 75844ee [AndroidXMedia3/1.4.1] [beyond0, SM-G970F, samsung, 31]
I/ViewRootImpl@613a070[FlutterActivity]( 7263): ViewPostIme pointer 0
I/ViewRootImpl@613a070[FlutterActivity]( 7263): ViewPostIme pointer 1
D/BufferPoolAccessor2.0( 7263): bufferpool2 0x70b01bbc78 : 0(0 size) total buffers - 0(0 size) used buffers - 361/376 (recycle/alloc) - 14/366 (fetch/transfer)
D/BufferPoolAccessor2.0( 7263): evictor expired: 1, evicted: 1
I/ViewRootImpl( 7263): updatePointerIcon pointerType = 1000, calling pid = 7263
D/InputManager( 7263): setPointerIconType iconId = 1000, callingPid = 7263
I/AudioManager( 7263): getParameters keys = offloadVariableRateSupported
I/DMCodecAdapterFactory( 7263): Creating an asynchronous MediaCodec adapter for track type video
I/ACodec  ( 7263):  [] Now uninitialized
I/ACodec  ( 7263): [] onAllocateComponent
I/OMXClient( 7263): IOmx service obtained
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] Now Loaded
I/MediaCodec( 7263): MediaCodec will operate in async mode
D/MediaCodec( 7263): flushMediametrics
D/SurfaceUtils( 7263): connecting to surface 0x715028d510, reason connectToSurface
I/MediaCodec( 7263): [OMX.Exynos.avc.dec] setting surface generation to 7437325
D/SurfaceUtils( 7263): disconnecting from surface 0x715028d510, reason connectToSurface(reconnect)
D/SurfaceUtils( 7263): connecting to surface 0x715028d510, reason connectToSurface(reconnect)
I/ACodec  ( 7263): app-pid(7263)
W/ACodec  ( 7263): [OMX.Exynos.avc.dec] setting HDRStaticInfo failed even though codec advertises support
W/ACodec  ( 7263): [OMX.Exynos.avc.dec] getting HDRStaticInfo failed even though codec advertises support
D/MediaCodec( 7263): keep callback message for reclaim
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] Now Loaded->Idle
D/SurfaceUtils( 7263): set up nativeWindow 0x715028d510 for 1280x720, color 0x105, rotation 270, usage 0x402900
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] configureOutputBuffersFromNativeWindow setBufferCount : 13, minUndequeuedBuffers : 9
I/MediaCodec( 7263): setCodecState state(0), called in 6
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] Now Idle->Executing
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] Now Executing
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] calling emptyBuffer 1 w/ codec specific data, size : 21
I/DMCodecAdapterFactory( 7263): Creating an asynchronous MediaCodec adapter for track type audio
I/CCodec  ( 7263): state->set(ALLOCATING)
I/CCodec  ( 7263): allocate(c2.android.aac.decoder)
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] calling emptyBuffer 2 w/ codec specific data, size : 8
I/CCodec  ( 7263): setting up 'default' as default (vendor) store
I/CCodec  ( 7263): Created component [c2.android.aac.decoder]
I/CCodec  ( 7263): state->set(ALLOCATED)
D/CCodecConfig( 7263): read media type: audio/mp4a-latm
D/ReflectedParamUpdater( 7263): extent() != 1 for single value type: algo.buffers.max-count.values
D/ReflectedParamUpdater( 7263): extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater( 7263): extent() != 1 for single value type: input.buffers.allocator-ids.values
D/ReflectedParamUpdater( 7263): extent() != 1 for single value type: output.buffers.allocator-ids.values
D/ReflectedParamUpdater( 7263): extent() != 1 for single value type: algo.buffers.allocator-ids.values
D/ReflectedParamUpdater( 7263): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater( 7263): extent() != 1 for single value type: algo.buffers.pool-ids.values
W/ACodec  ( 7263): [OMX.Exynos.avc.dec] getting HDRStaticInfo failed even though codec advertises support
I/CCodecConfig( 7263): query failed after returning 19 values (BAD_INDEX)
D/CCodecConfig( 7263): c2 config diff is Dict {
D/CCodecConfig( 7263):   c2::u32 coded.aac-packaging.value = 0
D/CCodecConfig( 7263):   c2::u32 coded.bitrate.value = 64000
D/CCodecConfig( 7263):   c2::u32 coded.pl.level = 0
D/CCodecConfig( 7263):   c2::u32 coded.pl.profile = 8192
D/CCodecConfig( 7263):   c2::i32 coding.drc.album-mode.value = 0
D/CCodecConfig( 7263):   c2::float coding.drc.attenuation-factor.value = 1
D/CCodecConfig( 7263):   c2::float coding.drc.boost-factor.value = 1
D/CCodecConfig( 7263):   c2::i32 coding.drc.compression-mode.value = 3
D/CCodecConfig( 7263):   c2::i32 coding.drc.effect-type.value = 3
D/CCodecConfig( 7263):   c2::float coding.drc.encoded-level.value = 0.25
D/CCodecConfig( 7263):   c2::float coding.drc.reference-level.value = -16
D/CCodecConfig( 7263):   c2::u32 input.buffers.max-size.value = 8192
D/CCodecConfig( 7263):   c2::u32 input.delay.value = 0
D/CCodecConfig( 7263):   string input.media-type.value = "audio/mp4a-latm"
D/CCodecConfig( 7263):   c2::u32 output.delay.value = 2
D/CCodecConfig( 7263):   c2::float output.drc.output-loudness.value = 0.25
D/CCodecConfig( 7263):   string output.media-type.value = "audio/raw"
D/CCodecConfig( 7263):   c2::u32 raw.channel-count.value = 1
D/CCodecConfig( 7263):   c2::u32 raw.max-channel-count.value = 8
D/CCodecConfig( 7263):   c2::u32 raw.sample-rate.value = 44100
D/CCodecConfig( 7263): }
I/MediaCodec( 7263): MediaCodec will operate in async mode
D/MediaCodec( 7263): flushMediametrics
D/CCodec  ( 7263): [c2.android.aac.decoder] buffers are bound to CCodec for this session
I/CCodec  ( 7263): appPid(7263) width(0) height(0)
D/CCodecConfig( 7263): no c2 equivalents for log-session-id
D/CCodecConfig( 7263): no c2 equivalents for flags
D/CCodecConfig( 7263): config failed => CORRUPTED
D/CCodecConfig( 7263): c2 config diff is   c2::u32 raw.channel-count.value = 2
D/CCodecConfig( 7263):   c2::u32 raw.sample-rate.value = 48000
W/Codec2Client( 7263): query -- param skipped: index = 1107298332.
D/CCodec  ( 7263): client requested max input size 885, which is smaller than what component recommended (8192); overriding with component recommendation.
W/CCodec  ( 7263): This behavior is subject to change. It is recommended that app developers double check whether the requested max input size is in reasonable range.
D/CCodec  ( 7263): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  ( 7263):   int32_t aac-drc-album-mode = 0
D/CCodec  ( 7263):   int32_t aac-drc-boost-level = 127
D/CCodec  ( 7263):   int32_t aac-drc-cut-level = 127
D/CCodec  ( 7263):   int32_t aac-drc-effect-type = 3
D/CCodec  ( 7263):   int32_t aac-encoded-target-level = -1
D/CCodec  ( 7263):   int32_t aac-max-output-channel_count = 8
D/CCodec  ( 7263):   int32_t aac-target-ref-level = 64
D/CCodec  ( 7263):   int32_t bitrate = 64000
D/CCodec  ( 7263):   int32_t channel-count = 2
D/CCodec  ( 7263):   int32_t level = 0
D/CCodec  ( 7263):   int32_t max-input-size = 8192
D/CCodec  ( 7263):   string mime = "audio/mp4a-latm"
D/CCodec  ( 7263):   int32_t profile = 2
D/CCodec  ( 7263):   int32_t sample-rate = 48000
D/CCodec  ( 7263):   int64_t durationUs = 0
D/CCodec  ( 7263): }
D/CCodec  ( 7263): setup formats output: AMessage(what = 0x00000000) = {
D/CCodec  ( 7263):   int32_t aac-drc-album-mode = 0
D/CCodec  ( 7263):   int32_t aac-drc-boost-level = 127
D/CCodec  ( 7263):   int32_t aac-drc-cut-level = 127
D/CCodec  ( 7263):   int32_t aac-drc-effect-type = 3
D/CCodec  ( 7263):   int32_t aac-drc-output-loudness = -1
D/CCodec  ( 7263):   int32_t aac-encoded-target-level = -1
D/CCodec  ( 7263):   int32_t aac-max-output-channel_count = 8
D/CCodec  ( 7263):   int32_t aac-target-ref-level = 64
D/CCodec  ( 7263):   int32_t channel-count = 2
D/CCodec  ( 7263):   string mime = "audio/raw"
D/CCodec  ( 7263):   int32_t sample-rate = 48000
D/CCodec  ( 7263): }
I/CCodecConfig( 7263): query failed after returning 19 values (BAD_INDEX)
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] Now handling output port settings change
D/MediaCodec( 7263): keep callback message for reclaim
I/CCodec  ( 7263): state->set(STARTING)
W/Codec2Client( 7263): query -- param skipped: index = 1342179345.
W/Codec2Client( 7263): query -- param skipped: index = 2415921170.
W/Codec2Client( 7263): query -- param skipped: index = 1610614798.
D/CCodecBufferChannel( 7263): [c2.android.aac.decoder#599] Created input block pool with allocatorID 16 => poolID 29 - OK (0)
D/BufferPoolAccessor2.0( 7263): Destruction - bufferpool2 0x70b01bbc78 cached: 0/0M, 0/0% in use; allocs: 376, 96% recycled; transfers: 366, 96% unfetched
D/SurfaceUtils( 7263): set up nativeWindow 0x715028d510 for 1280x720, color 0x105, rotation 270, usage 0x402900
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] configureOutputBuffersFromNativeWindow setBufferCount : 17, minUndequeuedBuffers : 9
I/CCodecBufferChannel( 7263): [c2.android.aac.decoder#599] Created output block pool with allocatorID 16 => poolID 523 - OK
D/CCodecBufferChannel( 7263): [c2.android.aac.decoder#599] Configured output block pool ids 523 => OK
I/CCodec  ( 7263): state->set(RUNNING)
I/CCodecBufferChannel( 7263): [c2.android.aac.decoder#599] 4 initial input buffers available
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] Now Executing
I/MediaCodec( 7263): setCodecState state(0), called in 6
D/AudioTrack( 7263): setVolume(1.000000, 1.000000) pid : 7263
W/ACodec  ( 7263): [OMX.Exynos.avc.dec] getting HDRStaticInfo failed even though codec advertises support
I/ACodec  ( 7263): [OMX.Exynos.avc.dec] OMX_EventPortSettingsChanged 0x7f030010
W/MediaCodec( 7263): mapFormat: no mediaType information
I/MediaCodec( 7263): setCodecState state(1), called in 6
I/MediaCodec( 7263): setCodecState state(0), called in 6
D/BufferPoolAccessor2.0( 7263): evictor expired: 1, evicted: 0
D/BufferPoolAccessor2.0( 7263): bufferpool2 0x70b025a548 : 5(40960 size) total buffers - 0(0 size) used buffers - 24/29 (recycle/alloc) - 5/29 (fetch/transfer)
D/BufferPoolAccessor2.0( 7263): evictor expired: 1, evicted: 1
D/ImageReaderSurfaceProducer( 7263): ImageTextureEntry can't wait on the fence on Android < 33
I/ViewRootImpl@613a070[FlutterActivity]( 7263): ViewPostIme pointer 0
I/ViewRootImpl@613a070[FlutterActivity]( 7263): ViewPostIme pointer 1
D/AudioTrack( 7263): getTimestamp_l(1575): device stall time corrected using current time 411490888101286
I/MediaCodec( 7263): setCodecState state(1), called in 6
I/ViewRootImpl( 7263): updatePointerIcon pointerType = 1000, calling pid = 7263
D/InputManager( 7263): setPointerIconType iconId = 1000, callingPid = 7263
D/BufferPoolAccessor2.0( 7263): bufferpool2 0x70b025a548 : 5(40960 size) total buffers - 4(32768 size) used buffers - 95/105 (recycle/alloc) - 10/102 (fetch/transfer)
I/ViewRootImpl@613a070[FlutterActivity]( 7263): ViewPostIme pointer 0
I/ViewRootImpl@613a070[FlutterActivity]( 7263): ViewPostIme pointer 1
I/ViewRootImpl( 7263): updatePointerIcon pointerType = 1000, calling pid = 7263
D/InputManager( 7263): setPointerIconType iconId = 1000, callingPid = 7263
I/ViewRootImpl@613a070[FlutterActivity]( 7263): ViewPostIme pointer 0
I/MediaCodec( 7263): setCodecState state(0), called in 6
I/ViewRootImpl@613a070[FlutterActivity]( 7263): ViewPostIme pointer 1
D/AudioTrack( 7263): getTimestamp_l(1575): device stall time corrected using current time 411494977105206
I/MediaCodec( 7263): setCodecState state(1), called in 6
I/ViewRootImpl@613a070[FlutterActivity]( 7263): ViewPostIme pointer 0
I/ViewRootImpl@613a070[FlutterActivity]( 7263): ViewPostIme pointer 1
I/ViewRootImpl( 7263): updatePointerIcon pointerType = 1000, calling pid = 7263
D/InputManager( 7263): setPointerIconType iconId = 1000, callingPid = 7263
I/MediaCodec( 7263): setCodecState state(0), called in 6

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.4.1 23E224 darwin-arm64, locale en-PL)
    • Flutter version 3.24.3 on channel stable at /Users/paweljakubowski/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (3 months ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/paweljakubowski/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • ANDROID_HOME = /Users/paweljakubowski/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

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

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

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.95.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

[✓] Connected device (4 available)
    • SM G970F (mobile)               • RF8MB0MKYEK           • android-arm64  • Android 12 (API 31)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 131.0.6778.86

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.27Found to occur in 3.27found in release: 3.28Found to occur in 3.28has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: video_playerThe Video Player pluginpackageflutter/packages repository. See also p: labels.platform-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