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: 125
Registered: ‎11-06-2012
My Device: BlackBerry
My Carrier: Mobifone

Error when play video by MediaPlayer

Hi,

 

I'm making my own video player. I'm using a ForeignWindowControland a MediaPlayer as an attached object in QML. The ForeignWindowControl is total black out with no image and sound when playing video, If I comment out the VideoOut part, it will play the sound.

 

This is my code, please help

 

Container {
                topPadding: 20
                ForeignWindowControl {
                    id: fwcVideoSurface
                    windowId: "myVideoSurface"
                    visible: boundToWindow
                    
                    preferredHeight: 400
                    
                    updatedProperties: WindowProperty.Size | WindowProperty.Position | WindowProperty.Visible
                    
                    onTouch: {
                        
                    }
                }
            }

attachedObjects: [
        MediaPlayer {
            id: player
            
            // Set these properties for video
            videoOutput: VideoOutput.PrimaryDisplay
            windowId: fwcVideoSurface.windowId
            repeatMode: RepeatMode.Track
            audioOutput: AudioOutput.Default
            
            onMediaStateChanged: {
                switch (player.mediaState) {
                    case MediaState.Unprepared:
                        break;
                    case MediaState.Prepared:
                        break;
                }
            }
        }
    ]

 

Developer
Posts: 125
Registered: ‎11-06-2012
My Device: BlackBerry
My Carrier: Mobifone

Re: Error when play video by MediaPlayer

It works on my z30 but not in z10 :smileysad:

Retired
Posts: 418
Registered: ‎07-18-2012
My Device: Q10
My Carrier: Bell Canada

Re: Error when play video by MediaPlayer

Hi,

 

What OS Version is on your Z10? (I just found out about an intermitent issue on Z10 with 10.1 where video is sometimes black). That issue is fixed in 10.2...

 

Thanks.

--
Rob is no longer associated with BlackBerry.