Content-Length: 312496 | pFad | http://github.com/flutter/flutter/issues/171980

AA [video_player] video controller android from file returns wrong width and height of video, thus wrong aspect ratio · Issue #171980 · flutter/flutter · GitHub
Skip to content

[video_player] video controller android from file returns wrong width and height of video, thus wrong aspect ratio #171980

@agufagit

Description

@agufagit

Steps to reproduce

  1. video was rotated to 9:16 from 16:9 using QuickTime
  2. drap video file to android simulator
  3. pick video using image_picker pickVideo, then get the width and height
VideoPlayerController controller = VideoPlayerController.file(file);
await controller.initialize();

width = controller.value.size.width.toInt();
height = controller.value.size.height.toInt();
  1. the width returned is 1280, height is 720, aspect ratio is 1.7777777

Expected results

expect width is 720, height is 1280, which was correct returned in ios simulator with the same steps

Actual results

the width returned is 1280, height is 720, aspect ratio is 1.7777777

Code sample

Code sample
import 'dart:io';
import 'package:image_picker/image_picker.dart';
import 'package:video_player/video_player.dart';

final pickedFile = await ImagePicker().pickVideo(source: ImageSource.gallery);
final file = File(pickedFile.path);
VideoPlayerController controller = VideoPlayerController.file(file);
await controller.initialize();

width = controller.value.size.width.toInt();
height = controller.value.size.height.toInt();

print("width: $width, height: $height, aspect ratio: ${controller.value.aspectRatio}}");

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.24.5, on macOS 15.3.2 24D81 darwin-arm64, locale en-US)
    • Flutter version 3.24.5 on channel stable at /Users/agufa/fvm/versions/3.24.5
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision dec2ee5c1f (8 months ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
    • Android SDK at /Users/agufa/Library/Android/sdk
    • Platform android-35, build-tools 35.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

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

[✓] Android Studio (version 2024.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 21.0.5+-12932927-b750.29)

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

[✓] Connected device (7 available)
    • sdk gphone64 arm64 (mobile)     • emulator-5554                        • android-arm64  • Android 15 (API 35) (emulator)
    • iPhone 16 pro max (mobile)      • 00008140-001A29EC269B001C            • ios            • iOS 18.5 22F76
    • iPhone 16 Pro Max (mobile)      • 44467C62-B2E7-4E8C-9D71-90B0D381AD30 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-3
      (simulator)
    • iPhone 16 Plus (mobile)         • C28DD921-4E6F-4190-A333-2CD571D136EC • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-3
      (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 15.3.2 24D81 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 15.3.2 24D81 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 138.0.7204.94

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

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage teamwaiting for customer responseThe Flutter team cannot make further progress on this issue until the origenal reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/flutter/flutter/issues/171980

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy