×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    15

    Question Rotate the video

    Greetings.

    I'm using Phonon::VideoPlayer to play a video. And I need it to be able to match the screen.
    A player starts with controls and in landscape orientation on portrait screen. I want the video to be rotated when switching to fullScreen mode(video should be lansdcape oriented, but rotated 90 degrees clockwise) so the video can be played in larger frame.
    I have E51, it's resolution is 240x320 and video's aspect ratio is 4:3. So in portrait phone orientation I can playback only 240x160 size, and if I was able to rotate, the video size would be able to become 320x240.

    How can I do that?

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Rotate the video

    You might try this:

    Code:
       
    #include <AknAppUi.h>
    // Need libs avkon cone eiksrv
    .
    .
    .
        // lock orientation
        CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
        if(appUi){
            QT_TRAP_THROWING(appUi ->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape));
        }
    (You'll have to figure out how to switch back to agnostic/portrait mode afterwards, I suppose. You should be able to follow the breadcrumbs.)

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    15

    Re: Rotate the video

    Quote Originally Posted by danhicksbyron View Post
    You might try this:

    Code:
       
    #include <AknAppUi.h>
    // Need libs avkon cone eiksrv
    .
    .
    .
        // lock orientation
        CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
        if(appUi){
            QT_TRAP_THROWING(appUi ->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape));
        }
    (You'll have to figure out how to switch back to agnostic/portrait mode afterwards, I suppose. You should be able to follow the breadcrumbs.)
    Thanks for the answer. Can you give me a references to that libs and an example project that uses them?

    And is there no way to control orientation with Qt?

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    15

    Re: Rotate the video

    Hmm. I've managed to rotate the app.

    Thanks for the tip.

    For further readers, here is an example:
    Setting the application orientation

  5. #5
    Registered User
    Join Date
    Jan 2010
    Posts
    15

    Re: Rotate the video

    When using such approach I have some glitches when switching orientation. Is this a bug or maybe it's Phonon-related thingy? Or is it all right and supposed to be?

    My phone model is E51.

  6. #6
    Nokia Developer Champion
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Rotate the video

    If you grope around in the Symbian stuff (I think looking for other references to EAppUiOrientationLandscape), I vaguely recall that you'll find that there is another interface for switching orientation, but in the little playing I did with this stuff I didn't find it to be functionally different.

    Here's the snippet of code I experimented with:
    Code:
    #include "TestWindowing.h"
    
    // For orientation changes
    #include <AknAppUi.h>
    // Need libs avkon cone eiksrv
    
    TestWindowing::TestWindowing(QWidget *parent)
        : QMainWindow(parent)
    {
    	ui.setupUi(this);
    	appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
    	
    	window1 = new MyWindowWidget(this);
    	ui1.setupUi(window1);
    	window2 = new MyWindowWidget(this);
    	ui2.setupUi(window2);
    	window1 ->show();
    }
    
    TestWindowing::~TestWindowing()
    {
    
    }
    
    void TestWindowing::setNoState() {
    	setNewWindowState(Qt::WindowNoState);
    }
    
    void TestWindowing::setMinimized() {
    	setNewWindowState(Qt::WindowMinimized);
    }
    
    void TestWindowing::setMaximized() {
    	setNewWindowState(Qt::WindowMaximized);
    }
    
    void TestWindowing::setFullScreen() {
    	setNewWindowState(Qt::WindowFullScreen);
    }
    
    void TestWindowing::setPortrait() {
    	QT_TRAP_THROWING(appUi ->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);)
    	this ->show();
    }
    
    void TestWindowing::setLandscape() {
    	QT_TRAP_THROWING(appUi ->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);)
    	this ->show();
    }
    
    void TestWindowing::setAutomaticOrientation() {
    	QT_TRAP_THROWING(appUi ->SetOrientationL(CAknAppUi::EAppUiOrientationAutomatic);)
    	this ->show();
    }
    
    void TestWindowing::setUnspecifiedOrientation() {
    	QT_TRAP_THROWING(appUi ->SetOrientationL(CAknAppUi::EAppUiOrientationUnspecified);)
    	this ->show();
    }
    
    void TestWindowing::switchToWindow1() {
    	window2 ->hide();
    	window1 ->show();
    }
    
    void TestWindowing::switchToWindow2() {
    	window1 ->hide();
    	window2 ->show();
    }
    
    void TestWindowing::setNewWindowState(Qt::WindowStates newState) {
        window1 ->setNewWindowState(newState);
        window2 ->setNewWindowState(newState);
    	Qt::WindowStates states = this ->windowState();
    	states = states & ~(Qt::WindowNoState | Qt::WindowMinimized
    			| Qt::WindowMaximized | Qt::WindowFullScreen);
    	this ->setWindowState(states | newState);
    	this ->show();
    }
    
    MyWindowWidget::MyWindowWidget(TestWindowing* owner, QWidget *parent)
        : QWidget(parent)
    {
    	this ->owner = owner;
    }
    
    MyWindowWidget::~MyWindowWidget()
    {
    
    }
    
    void MyWindowWidget::setNoState() {
    	owner ->setNoState();
    }
    
    void MyWindowWidget::setMinimized() {
    	owner ->setMinimized();
    }
    
    void MyWindowWidget::setMaximized() {
    	owner ->setMaximized();
    }
    
    void MyWindowWidget::setFullScreen() {
    	owner ->setFullScreen();
    }
    
    void MyWindowWidget::setPortrait() {
    	owner ->setPortrait();
    }
    
    void MyWindowWidget::setLandscape() {
    	owner ->setLandscape();
    }
    
    void MyWindowWidget::setAutomaticOrientation() {
    	owner ->setAutomaticOrientation();
    }
    
    void MyWindowWidget::setUnspecifiedOrientation() {
    	owner ->setUnspecifiedOrientation();
    }
    
    void MyWindowWidget::switchToWindow1() {
    	owner ->switchToWindow1();
    }
    
    void MyWindowWidget::switchToWindow2() {
    	owner ->switchToWindow2();
    }
    
    void MyWindowWidget::setNewWindowState(Qt::WindowStates newState) {
    	Qt::WindowStates states = this ->windowState();
    	states = states & ~(Qt::WindowNoState | Qt::WindowMinimized
    			| Qt::WindowMaximized | Qt::WindowFullScreen);
    	this ->setWindowState(states | newState);
    }
    I did find this all to be a little flaky, in that switching various modes (both orientation and maximized/full screen) back and forth a bunch of times would eventually lead to flaky operation. And I wouldn't be surprised if video has trouble with any sort of dynamic switching.

    It is interesting to note that the wiki article you pointed at (and the one I initially got the info from) is wrong, in that it doesn't specify the required trap handling for crossing the Qt/Symbian boundary.

Similar Threads

  1. Flashlite 3.1 Nokia 5800 Video Object doesn't rotate on device
    By initapp in forum [Archived] Flash Lite on Nokia Devices
    Replies: 2
    Last Post: 2009-07-03, 03:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •