Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Incorrect resolution in Qt Quick application
Forum Updated to NodeBB v4.3 + New Features

Incorrect resolution in Qt Quick application

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 130 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ali.Golbin
    wrote on last edited by
    #1

    I run a simple app using Mediaplayer and VideoOutput to showing a HD video on Android TV.
    I use Screen.width and Screen.height for my Window object. But detected screen is 1280x720.

    My main.qml is:

    import QtQuick
    import QtQuick.Window
    import QtMultimedia
    
    Window {
        id: mainWindow
        width: Screen.width
        height: Screen.height
        visible: true
    
        Rectangle {
            id: mw
            anchors.fill: parent
            color: "red"
            focus: true
    
            VideoOutput {
                id: videoOutput
                anchors.fill: parent
            }
    
            MediaPlayer {
                id: item_id
                audioOutput: AudioOutput {}
                videoOutput: videoOutput
            }
    
            Keys.onReturnPressed: {
                if (item_id.playbackState == MediaPlayer.PlayingState) {
                    item_id.pause()
                    console.log("Qt Player: "+videoOutput.width);
                    console.log("Qt Player: "+videoOutput.height);
                } else if (item_id.playbackState == MediaPlayer.PausedState) {
                    item_id.play()
                } else {
                    item_id.source = "file:///storage/emulated/0/download/371.mp4"
                    item_id.play();
                    console.log("Starting ...")
                    console.log("Qt Scene: "+mainWindow.width);
                    console.log("Qt Scene: "+mainWindow.height);
                }
            }
            Keys.onLeftPressed: item_id.setPosition(item_id.position-3000)
            Keys.onRightPressed: item_id.setPosition(item_id.position+3000)
    
        }
    
    
        Component.onCompleted: {
    //        showFullScreen()
            show()
        }
    
    }
    
    

    I tested my Android TV with a simple app with the same structure written in Android Studio and detected resolution is 1920x1080.

    My Mainactivity.java is:

    public class MainActivity extends Activity {
    
        public static VideoView videoView;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            // Native Player
            MainActivity.videoView = (VideoView) findViewById(R.id.videoView);
            String videoURL = "file:///storage/emulated/0/download/371.mp4";
            Uri uri = Uri.parse(videoURL);
            MainActivity.videoView.setVideoURI(uri);
            MainActivity.videoView.start();
    
            MainActivity.videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mp) {
                    Log.e("> ", "Media is prepared. Playing ...");
                    Log.e("> ", "W: "+MainActivity.videoView.getWidth());
                    Log.e("> ", "H: "+MainActivity.videoView.getHeight());
                }
            });
    
        }
    }
    

    What is the problem?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved