To display video on qml (Qt-5)



  • Hai,
    display video on qml.
    video player (qt) uses videoWidget

    @
    QVideoWidget *videoWidget = new QVideoWidget;
    @

    To display the video we are using layout. Instead of displaying it in layout ,I should pass this data to qml video element and display on qml
    @
    QBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(videoWidget);
    @



  • You are mixing widget with QML ... you should do all on QML



  • bjanuario thank you for the reply. My source of video is in qt side I don't know how to display on qml side.



  • Here some sample of video player on QML:

    @import QtQuick 1.0
    import QtMultimediaKit 1.1 // do not forgot to import this

    Item {
    id: videoPlayerItem
    property bool isVideoPlaying: videoPlayer.hasVideo // property to know if videoPlaying id ongoing or not
    /*
    Functions Which starts Video Playing
    /
    function playVideo(){
    videoPlayer.play()
    }
    /

    Function Which Stops Video Playing
    /
    function stopVideo(){
    videoPlayer.stop()
    }
    /

    Function Which Stops Video Playing
    /
    function pauseVideo(){
    videoPlayer.pause()
    }
    /

    Actual QML based Video Component
    */
    Video{
    id:videoPlayer
    anchors.fill: videoPlayerItem // never forget to mention the size and position
    source: "Video/Bear.wmv"
    focus: true
    }
    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.