Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML MediaPlayer and iOS



  • Hello, I'm creating qml project on qt creator, qt 5.3. I'm using *.m4v file. When I'm compiling my project to Android it's working perfect, but in my iPhone i'm getting a blackScreen

       Video {
            id: video
            width: Screen.width
            height: Screen.height
            source: '1.m4v'
            focus: true
        }
    

    I'm trying to use MediaPlayer, but it is not work... can anyone help me please. Sry for bad ENG ((


  • Moderators

    AFAIK video playback is not possible in QML for iOS, only in QWidgets.
    Because it's not possible to write the video into OpenGL texture.



  • Can u give some link or example how to do this with Qwidgets ?


  • Moderators

    minimal example to play video in C++/QWidget. See "this":http://doc.qt.io/qt-5/videooverview.html for further reading.
    @
    int main(int argc, char argv[])
    {
    QApplication a(argc, argv);
    QMainWindow w;
    QVideoWidget
    videoWidget = new QVideoWidget;
    QMediaPlayer* player = new QMediaPlayer;
    player->setMedia(QUrl(...));
    player->setVideoOutput(videoWidget);
    player->play();
    w.setCentralWidget(pVWidget);
    w.show();
    return a.exec();
    }
    @
    But i think your app is written in QML right?
    You would need to switch completely from QML to QWidgets.



  • Thank you very much, i will try for switch completely from QML to QWidgets. ((

    P.S. It's so moodily ((


  • Moderators

    but before you switch completely you should run a simple test (like the code i've posted) if it is really working for you.



  • On the bright side support for video on iOS with Quick may come in Qt 5.5, so stay tuned.


Log in to reply