Able to rotate a rectangle but not a video (solved)



  • I am able to rotate a rectangle but i am not able to rotate a video
    Below is my code. Can explain what is wrong with my code.
    @.....................................................................................................
    import QtQuick 2.2
    import QtQuick.Window 2.1

    Window {
    visible:true
    width:760
    height:700
    Item {
    width 300; height:300
    Rectangle{
    id: rect
    width:150;height:100;anchors.centerln:parent
    color:"red"
    smooth:true
    states:State{
    name:"rotated"
    PropertyChanges{target:rect; rotation:180}
    }
    transitions:Transition{
    RotationAnimation{duration:3000; direction:RotationAnimation.Numerical}
    }
    }
    MouseArea {anchors.fill:parent; onClicked: rect.state="rotated"}
    }
    }

    Below is the code i use to rotate video

    import QtQuick 2.2
    import QtQuick.Window 2.2
    import QtMultimedia 5.0

    Window {
    visible:true
    width:760
    height:700

      Item {
         width:300; height:300
          MediaPlayer{
           id:player_1
           source:"file:///xxx.mp4"
           autoPlay:true
           autoLoad:true
           muted:false
       }
       VideoOutput{
        id:voutput_1
        source:player_1
        fillMode:VideoOutput.PreserveAspectFit
        x:0
        y:0
        height: parent.height
        width:parent.width/2
     }
        states:State{
                   name: "rotated"
                   PropertyChanges{ target:player_1;rotation:180)
                  }
             transitions:Transition{
                    RotationAnimation{duration:3000; direction:RotationAnimation.Numerical}
                    }
          }  MouseArea {anchors.fill:parent; onClicked:player_1.state="rotated"}
    

    }

    @



  • Rect and Item will behave different as I know. Try a video item in a Rect with anchor.fillparent(), and then rotate the Rect?



  • Your are rotating the wrong Item.

    player_1 is a MediaPlayer, a non visual item that just decode the video and audio from a source.
    While, voutput_1 is a real visual item that render the decoded frames and audio into the screen.
    So, you should rotate the voutput_1, while in your code your are trying to rotate the player_1

    P.S.: Pay attention, on some platform the VideoOutput has strong limitation (on iOS for example)



  • Interesting; are limitations on VideoOutput on iOS documented anywhere? (Anywhere friendly to people bringing Qt apps to iOS who don't know a whole lot about iOS and just expect stuff that works in Qt on desktop platforms to work on iOS too that is). Or just a matter of prodding it and seeing what works?



  • The limitation is written into the documentation ... but they don't explicit tell on which platform:
    [quote]
    The VideoOutput item works with backends that support either QVideoRendererControl or QVideoWindowControl. If the backend only supports QVideoWindowControl, the video is rendered onto an overlay window that is layered on top of the QtQuick window. Due to the nature of the video overlays, certain features are not available for these kind of backends:

    Some transformations like rotations
    Having other QtQuick items on top of the VideoOutput item
    Most backends however do support QVideoRendererControl and therefore don't have the limitations listed above.[/quote]

    Actually, it seems that only iOS had this limitation.



  • Ah thanks that's good to know; I was toying with taking my app down a route where I wanted to do clever stuff with texture mapping video, using it as shader sources etc. Some of the behaviour I was seeing with ordinary VideoOutput on iOS was already making me think it was probably an overlay rather than anything more integrated though.



  • This post is deleted!

Log in to reply
 

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