Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 97
Registered: ‎11-13-2012
My Device: BB10 Simulator
My Carrier: Globe Telecom

[HELP] Playing Portrait Videos in Foreign Window Control are rotated -90 Degrees

For landscape videos, the rotation is totally normal. but for portrait videos. they are rotated -90 degrees. And I also tried to rotate manually the container and even the foreign window control but does not take effect.

 

here's my code.

 

import bb.cascades 1.0
import bb.multimedia 1.0

Container 
{
    id: videoContainer
    preferredWidth: _app.getDisplayWidth()
    preferredHeight: _app.getDisplayHeight()

    layout: DockLayout {}
    
    onCreationCompleted: 
    {
        OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All;
    }
    
    attachedObjects: 
    [
        MediaPlayer
        {
            id: videoPlayer
            videoOutput: VideoOutput.PrimaryDisplay
            windowId: videoSurface.windowId
        },
        OrientationHandler 
        {
            id: orientationHandler
            onOrientationChanged:
            {
                if (orientation == OrientationSupport.supportedDisplayOrientation.DisplayPortrait) 
                {
                    videoContainer.preferredWidth = _app.getDisplayWidth();
                    videoContainer.preferredHeight = _app.getDisplayHeight();
                } 
                else if (orientation == OrientationSupport.supportedDisplayOrientation.DisplayLandscape) 
                {
                    videoContainer.preferredWidth = _app.getDisplayHeight();
                    videoContainer.preferredHeight = _app.getDisplayWidth();                     
                }
            }
        }
    ]
    
    ForeignWindowControl 
    {
        id					: videoSurface
        windowId			: "videoSurface"
        updatedProperties	: WindowProperty.Size | WindowProperty.Position | WindowProperty.Visible | WindowProperty.SourceSize
        horizontalAlignment	: HorizontalAlignment.Center
        verticalAlignment	: VerticalAlignment.Center
        
        preferredWidth 		: videoPlayer.videoDimensions.width;
        minWidth 			: videoPlayer.videoDimensions.width;
        maxWidth 			: videoPlayer.videoDimensions.width;
        
        preferredHeight 	: videoPlayer.videoDimensions.height;
        minHeight 			: videoPlayer.videoDimensions.height;
        maxHeight 			: videoPlayer.videoDimensions.height;
    }
}

 Hope someone has a solution. Thank you. Smiley Happy

Developer
Posts: 97
Registered: ‎11-13-2012
My Device: BB10 Simulator
My Carrier: Globe Telecom

Re: [HELP] Playing Portrait Videos in Foreign Window Control are rotated -90 Degrees

Any suggestions ? Smiley Sad