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. Video element plays video at wrong position on IOS
Forum Updated to NodeBB v4.3 + New Features

Video element plays video at wrong position on IOS

Scheduled Pinned Locked Moved QML and Qt Quick
29 Posts 5 Posters 8.0k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    Jacky2k
    wrote on last edited by
    #6

    Hi,

    I am not using QML. Here are the important code snippets:
    @MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    player =  new QMediaPlayer;
    player->setVideoOutput(ui->videoWidget);
    ui->videoWidget->show();
    

    }

    void MainWindow::onActionOpen()
    {
    QString file = QFileDialog::getOpenFileName(this, tr("Open Video File"), ".");
    if(file.isEmpty())
    return;

    player->setMedia(QUrl::fromLocalFile(file));
    player->setVolume(50);
    player->play();
    

    }@

    ui->videoWidget is of type QVideoWidget
    On my Ubuntu 14.04 64bit host everything works fine. Qt is version 4.8.6 for host and 4.8.5 for target. QtMobility is 1.2.0 for both.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jacky2k
      wrote on last edited by
      #7

      Hi,

      I am not using QML. Here are the important code snippets:
      @MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
      {
      ui->setupUi(this);

      player =  new QMediaPlayer;
      player->setVideoOutput(ui->videoWidget);
      ui->videoWidget->show();
      

      }

      void MainWindow::onActionOpen()
      {
      QString file = QFileDialog::getOpenFileName(this, tr("Open Video File"), ".");
      if(file.isEmpty())
      return;

      player->setMedia(QUrl::fromLocalFile(file));
      player->setVolume(50);
      player->play();
      

      }@

      ui->videoWidget is of type QVideoWidget
      On my Ubuntu 14.04 64bit host everything works fine. Qt is version 4.8.6 for host and 4.8.5 for target. QtMobility is 1.2.0 for both.

      1 Reply Last reply
      0
      • O Offline
        O Offline
        onek24
        wrote on last edited by
        #8

        -Oh okay, your thread is in the QtQuick(QML)-section so i thought you did it with QML-. Well, how do you position your MediaPlayer?

        My bad, this thread is a few months old and you are not OP. Still, i will try to help you trough your problem even if i haven't worked with the QMediaPlayer so far.

        1 Reply Last reply
        0
        • O Offline
          O Offline
          onek24
          wrote on last edited by
          #9

          -Oh okay, your thread is in the QtQuick(QML)-section so i thought you did it with QML-. Well, how do you position your MediaPlayer?

          My bad, this thread is a few months old and you are not OP. Still, i will try to help you trough your problem even if i haven't worked with the QMediaPlayer so far.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jacky2k
            wrote on last edited by
            #10

            I have an UI file where I have a few buttons and also the QVideoWidget using Layouts.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Jacky2k
              wrote on last edited by
              #11

              I have an UI file where I have a few buttons and also the QVideoWidget using Layouts.

              1 Reply Last reply
              0
              • O Offline
                O Offline
                onek24
                wrote on last edited by
                #12

                Have you tried to re-position your videoWidget after you started playing a video?

                1 Reply Last reply
                0
                • O Offline
                  O Offline
                  onek24
                  wrote on last edited by
                  #13

                  Have you tried to re-position your videoWidget after you started playing a video?

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    Jacky2k
                    wrote on last edited by
                    #14

                    How am I supposed to do that? The Widget is part of a layout. setGeometry() has no effect.

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      Jacky2k
                      wrote on last edited by
                      #15

                      How am I supposed to do that? The Widget is part of a layout. setGeometry() has no effect.

                      1 Reply Last reply
                      0
                      • O Offline
                        O Offline
                        onek24
                        wrote on last edited by
                        #16

                        Sorry, my bad, haven't read the layouts part. Well, in that case: Have you tried positioning it without a layout? Does that work? And have you tried playing with the horizontal and vertical settings of the widget?

                        1 Reply Last reply
                        0
                        • O Offline
                          O Offline
                          onek24
                          wrote on last edited by
                          #17

                          Sorry, my bad, haven't read the layouts part. Well, in that case: Have you tried positioning it without a layout? Does that work? And have you tried playing with the horizontal and vertical settings of the widget?

                          1 Reply Last reply
                          0
                          • timdayT Offline
                            timdayT Offline
                            timday
                            wrote on last edited by
                            #18

                            See "QTBUG-42721":https://bugreports.qt-project.org/browse/QTBUG-42721

                            I raised this as an issue with iOS video placement (using the QML VideoOutput, but it presumably sits on the same underlying code as the C++ ) a week or so ago which sounds like it's the same as hailong's problem. If it helps identify it's the same thing:

                            • It came in with Qt5.3.2; I never saw the problem on 5.3.1.
                            • If you rotate the device while the video is playing, it'll move to where you expect it to! (At least until the video ends; if you have it set up to loop, it might move back to the top corner again).
                            1 Reply Last reply
                            0
                            • timdayT Offline
                              timdayT Offline
                              timday
                              wrote on last edited by
                              #19

                              See "QTBUG-42721":https://bugreports.qt-project.org/browse/QTBUG-42721

                              I raised this as an issue with iOS video placement (using the QML VideoOutput, but it presumably sits on the same underlying code as the C++ ) a week or so ago which sounds like it's the same as hailong's problem. If it helps identify it's the same thing:

                              • It came in with Qt5.3.2; I never saw the problem on 5.3.1.
                              • If you rotate the device while the video is playing, it'll move to where you expect it to! (At least until the video ends; if you have it set up to loop, it might move back to the top corner again).
                              1 Reply Last reply
                              0
                              • J Offline
                                J Offline
                                Jacky2k
                                wrote on last edited by
                                #20

                                Well, then I guess it is not the same problem as I am using Qt 4.8.5.

                                1 Reply Last reply
                                0
                                • J Offline
                                  J Offline
                                  Jacky2k
                                  wrote on last edited by
                                  #21

                                  Well, then I guess it is not the same problem as I am using Qt 4.8.5.

                                  1 Reply Last reply
                                  0
                                  • J Offline
                                    J Offline
                                    Jacky2k
                                    wrote on last edited by
                                    #22

                                    At least in my case it seems to be a problem of gsteramer and not Qt. I was able to reproduce the problem using gst-launch:
                                    @# gst-launch -v videotestsrc ! xvimagesink@
                                    When I use ximagesink it works perfectly fine.

                                    1 Reply Last reply
                                    0
                                    • J Offline
                                      J Offline
                                      Jacky2k
                                      wrote on last edited by
                                      #23

                                      At least in my case it seems to be a problem of gsteramer and not Qt. I was able to reproduce the problem using gst-launch:
                                      @# gst-launch -v videotestsrc ! xvimagesink@
                                      When I use ximagesink it works perfectly fine.

                                      1 Reply Last reply
                                      0
                                      • H Offline
                                        H Offline
                                        hailong
                                        wrote on last edited by
                                        #24

                                        wow, so many replies on my thread, I feel so happy that more and more people are using Qt for cross-platform app development.

                                        I could't not solve my problem on September even if I had done a lot of research on that, so I used one week to learn how to develop for IOS and rewrited the hole app using Obj-C.

                                        1 Reply Last reply
                                        0
                                        • H Offline
                                          H Offline
                                          hailong
                                          wrote on last edited by
                                          #25

                                          wow, so many replies on my thread, I feel so happy that more and more people are using Qt for cross-platform app development.

                                          I could't not solve my problem on September even if I had done a lot of research on that, so I used one week to learn how to develop for IOS and rewrited the hole app using Obj-C.

                                          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