-
Notifications
You must be signed in to change notification settings - Fork 30.2k
[video_player] Playback resolution is the same as the UI resolution #152136
Description
Steps to reproduce
I am using an Orange Pi 5 with the Android ROM. The Orange Pi 5 has the ability to connect HDMI devices to the device itself. I connect a 4K display to the Orange Pi.
-
I go into the Android settings and change it to 4K.
Settings -> Display -> HDMI -> Resolution -> 3840x2160p60 -
Let's change the UI resolution (desktop) to 1080p because this is a common case for Android 11 or older.
adb connect ...
adb shell wm size 1920x1080Now the UI resolution is 1080p but if you check the resolution set in step 1, the resolution is still 4K. If you check the display information, it also says that it is 4K resolution.
- Play a video where you can determine the difference between 4K and 1080p, text is a good example.
Observe the content and the amount of detail.
- Change the UI resolution back to 4K.
adb shell wm size 3840x2160As 8K TVs become more popular, this becomes more of an issue because the UI resolution is capped at 4K. This could also mean that some devices do not receive the full resolution of the device if their vendor has capped the UI resolution at any resolution lower than the device's display resolution.
(Most likely related to: #143985)
Expected results
The expected result is that the player should not be based on the UI resolution, but on the resolution set in the display settings.
Although we are not using Android TV in this specific example, the same idea applies on different devices post.
This issue does not occur when using a native Android app with ExoPlayer though.
Actual results
The content plays at UI resolution instead of the fully supported device resolution.
Code sample
Code sample
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ignore_for_file: public_member_api_docs
/// An example of using the plugin, controlling lifecycle and playback of the
/// video.
library;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:video_player/video_player.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky).then(
(_) {
runApp(
MaterialApp(
home: _PlayerVideoAndPopPage(),
),
);
},
);
}
class _PlayerVideoAndPopPage extends StatefulWidget {
@override
_PlayerVideoAndPopPageState createState() => _PlayerVideoAndPopPageState();
}
class _PlayerVideoAndPopPageState extends State<_PlayerVideoAndPopPage> {
late VideoPlayerController _videoPlayerController;
bool startedPlaying = false;
@override
void initState() {
super.initState();
_videoPlayerController = VideoPlayerController.networkUrl(Uri.parse(
"http://192.168.126.191/check-4k-25fps-h264.mp4",
));
_videoPlayerController.setLooping(true);
_videoPlayerController.addListener(() {
if (startedPlaying && !_videoPlayerController.value.isPlaying) {
Navigator.pop(context);
}
});
}
@override
void dispose() {
_videoPlayerController.dispose();
super.dispose();
}
Future<bool> started() async {
await _videoPlayerController.initialize();
await _videoPlayerController.play();
startedPlaying = true;
return true;
}
@override
Widget build(BuildContext context) {
return Material(
child: Center(
child: FutureBuilder<bool>(
future: started(),
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
if (snapshot.data ?? false) {
return AspectRatio(
aspectRatio: _videoPlayerController.value.aspectRatio,
child: VideoPlayer(_videoPlayerController),
);
} else {
return const Text('waiting for video to load');
}
},
),
),
);
}
}
Screenshots or Video
Logs
No response
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.22.3, on Ubuntu 22.04.4 LTS 6.5.0-41-generic, locale en_CA.UTF-8)
• Flutter version 3.22.3 on channel stable at /home/[redacted]/tools/flutter/3.22.3
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b0850beeb2 (6 days ago), 2024-07-16 21:43:41 -0700
• Engine revision 235db911ba
• Dart version 3.4.4
• DevTools version 2.34.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /home/[redacted]/Android/Sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /opt/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• Ubuntu clang version 14.0.0-1ubuntu1.1
• cmake version 3.22.1
• ninja version 1.10.1
• pkg-config version 0.29.2
[✓] Android Studio (version 2023.3)
• Android Studio at /opt/android-studio
• Flutter plugin version 79.0.2
• 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.91.1)
• VS Code at /usr/share/code
• Flutter extension version 3.92.0
[✓] Connected device (3 available)
• I RK3588 (mobile) • testnet53:5589 • android-arm64 • Android 12 (API 32)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.4 LTS 6.5.0-41-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.126
[✓] Network resources
• All expected network resources are available.
• No issues found!
