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
Contributor
R4BB
Posts: 19
Registered: ‎03-05-2013
My Device: 9700
My Carrier: BlackBerry

Re: Cannot play a video using QML code

Hello Friends,

 

I am still facing issue in playing media player with SampleVideo QML. when I try to play a video it return me value '1'

 

var x = player.play();    // it return 1 means Interna Error

 

I have alredy set access_shared permission

 

& I have already add libs

 

LIBS += -lbbmultimedia
LIBS += -lmmrndclient
LIBS += -lstrm
LIBS += -lasound
LIBS += -lscreen

Please let me know what I doing wrong ?

 

Thanks In Advance

 

 

Please use plain text.
Contributor
R4BB
Posts: 19
Registered: ‎03-05-2013
My Device: 9700
My Carrier: BlackBerry

Re: Cannot play a video using QML code

[ Edited ]

I am using code as

 

import bb.cascades 1.0
import bb.multimedia 1.0

Page {
    Container {
        Button {
            id: playButton
            text: "Play"
            horizontalAlignment: HorizontalAlignment.Center
            onClicked: {

                if (! player.isPlaying) {
                    console.log("myPlayer.isPlaying = true");
                    var x = player.play();
                    playButton.text = "Play " +x
                } else {
                    console.log("myPlayer.isPlaying = false");
                    var x = player.pause();
                    playButton.text = "Pause " + x
                }
            }
        }

        ForeignWindowControl {
            id: videoSurface
            windowId: "myVideoSurface"
            updatedProperties: WindowProperty.Size | WindowProperty.Position | WindowProperty.Visible
            visible: boundToWindow
            preferredWidth: 640
            preferredHeight: 480
        }

        attachedObjects: [
            MediaPlayer {

                id: player
                property bool isPlaying: false

                sourceUrl: "lovingyou.mp4"
                videoOutput: VideoOutput.PrimaryDisplay
                windowId: videoSurface.windowId

                onMediaStateChanged: {
                    if (player.mediaState == MediaState.Started) {
                        console.log("player Started");

                        playButton.text = "Pause"
                        isPlaying = true;

                    } else if (player.mediaState == MediaState.Paused) {
                        console.log("player Paused");

                        playButton.text = "Play"
                        isPlaying = false;

                    } else if (player.mediaState == MediaState.Stopped) {
                        console.log("player Stopped");

                        playButton.text = "Play"
                        isPlaying = false;
                    }
                }
            }
        ] //attachedObjects
    }

}

 

Hi , Previosuly i was running above code simulator 10.0.9, Now i try on 10.1.x in this time play() method return '5'

means

UnsupportedMediaType = 5

A data format not recognized by any plugin.

 whats going wrong ???

Please use plain text.
BlackBerry Development Advisor (Retired)
s_rashid
Posts: 127
Registered: ‎02-27-2012
My Device: Bold
My Carrier: Rogers

Re: Cannot play a video using QML code



Hi R4BB,


Note that the simulator has almost no video playback support and very little audio playback support (in terms of the codecs supported; this is due to licensing reasons).

 

Also, have you tried modifying the path a little bit? That is, the *sourceUrl* attribute. For example, if you have kept the video file in the *assets* folder, you can set

...
sourceUrl: "asset:///file.mp4"
......

If it is in the *Shared* folder, you can set the absolute file path to be in the format: "file:///accounts/1000/appdata/[rest of the full path]/file.mp4"

 

Note that previously just "/accounts/1000/[full path]/file.mp4" was working; but now, you have to prepend the "file..." accordingly.

 

Rashid

Please use plain text.
Contributor
R4BB
Posts: 19
Registered: ‎03-05-2013
My Device: 9700
My Carrier: BlackBerry

Re: Cannot play a video using QML code

Hi s_rashid,

 

Thanks for response, i have already tried with changed "sourceUrl" as prepending "asset:///" & tried url with "file:///accounts/1000/appdata/[rest of the full path]/file.mp4". But the result is same.

 

Should i assume that we can not test to play a video file on bb simulator up to version 10.1? Is there is any way to test then please let me know.

 

 

Thanks

 

 

Please use plain text.
Developer
Spacena
Posts: 120
Registered: ‎02-06-2013
My Device: Dev Alpha C
My Carrier: airtel

Re: Cannot play a video using QML code

Anyone got the solution for this ? If so, then please share.



There are 2 types of IT companies in the world:

One that says "I have a website."
and another that says "I am a website !"
Please use plain text.
Developer
Spacena
Posts: 120
Registered: ‎02-06-2013
My Device: Dev Alpha C
My Carrier: airtel

Re: Cannot play a video using QML code

Any success so far ??


There are 2 types of IT companies in the world:

One that says "I have a website."
and another that says "I am a website !"
Please use plain text.
Developer
Spacena
Posts: 120
Registered: ‎02-06-2013
My Device: Dev Alpha C
My Carrier: airtel

Re: Cannot play a video using QML code

Have you got any solution ?



There are 2 types of IT companies in the world:

One that says "I have a website."
and another that says "I am a website !"
Please use plain text.