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
Posts: 19
Registered: ‎05-21-2012
My Device: Bold

Playing Streaming Video

Hi,

I already have a thread but the post was not in the right category. http://supportforums.blackberry.com/t5/Native-Development/Launch-default-media-player/m-p/1976305

 

I was trying to play audio/video. Presently I followed this (https://developer.blackberry.com/cascades/documentation/design/audio_video/playing_audio_or_video.ht... and able to play local audio but when I play local video I just hear the sound no video is there.

 

Also the audio/video streaming is not working.

 

I followed this (https://developer.blackberry.com/cascades/documentation/design/audio_video/playing_custom_sounds_in_... for audio playback and its playing local audio only

 

New Contributor
Posts: 3
Registered: ‎11-06-2012
My Device: BlackBerry 10 Dev Alpha

Re: Playing Streaming Video

Hi,

 

I have the very same problem here.

On the Dev Alpha (beta3) I succeded in streaming an mp4 file from an http source, but can't see any video output at all.

 

Looking forward for any advice.

 

Thanks,

Antonio

Developer
Developer
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha

Re: Playing Streaming Video

you might want to post some code to help you identify the issue?

 

probably an issue with how you configured your foreigncontrol...

Contributor
Posts: 19
Registered: ‎05-21-2012
My Device: Bold

Re: Playing Streaming Video

[ Edited ]

I did a small research and found that there were some issue  in videoOutput property of MediaPlayer class.

i tried the below code and able to play Local Audio/Video file.

 

attachedObjects: [
    MediaPlayer {
        id: myPlayer
       // sourceUrl: ""
 
        videoOutput: VideoOutput.PrimaryDisplay
        windowId: videoSurface.windowId  // name of the window to create
    }
]
ForeignWindowControl {
    id: videoSurface
    windowId: "myVideoSurface"
    
    updatedProperties: WindowProperty.Size | WindowProperty.Position | WindowProperty.Visible
    visible: boundToWindow
   // preferredWidth: 1280
   // preferredHeight: 768
     preferredWidth: 640
     preferredHeight: 480

         }

 call the url from Button clicked

 Button {
            id: Button4
            text: qsTr("Play Video Local WMV")
            layoutProperties: StackLayoutProperties {
                spaceQuota: 1.0
            }
            onClicked: {
               
                videoSurface.visible = true;
                myPlayer.setSourceUrl("asset:///sounds/BB10DevAlpha.wmv")
                myPlayer.play()
            }
        }

 

 
The above code helps me to play local audio/video, not remote(streaming). Now my question is.

1. How can I play streaming (RTSP/HTTP)  audio/video using the same MediaPlayer class.

2. How can I play streaming (RTSP/HTTP) audio/video using Media Previewer using Invocation Framework, so that I can launch default Media Player of the device and starts playing content. I mean how to Invoke the Media Previewer to play a file.

 

I followed this https://developer.blackberry.com/cascades/documentation/device_platform/invocation/index.html to play video file in media previewer, but it opens the default browser and while it starts playing it says the browser crashes.  I tried something like below code.

   Button {
            id: Button5
            text: qsTr("Launch Default Player ")
            layoutProperties: StackLayoutProperties {
                spaceQuota: 1.0
            } attachedObjects: [
                   Invocation {
                     id: invoke
                     query: InvokeQuery {
                       mimeType: "video/audio"
                       uri: "http://www.mydomain.com/60820828.mp4"
                     }
                   }
                   
                   
                 ]
                
                 onClicked: {
                   invoke.trigger("bb.action.OPEN")
                 }
        }

 I saw this tutorial http://rapidberry.net/native-api-deep-dive-multimedia-playback-streaming/, can I get the working code of this tutorial.

 

 

 

 

Contributor
Posts: 19
Registered: ‎05-21-2012
My Device: Bold

Re: Playing Streaming Video

Hi Guys,

 

Now I am able to play local Audio/video in default player also. But getting Error 13 when put an remote url. Here is the code.

 

void MultimediaTest1::handleInvokeButtonClick()
{
	//exit(1);

	InvokeRequest cardrequest;
	cardrequest.setMimeType("audio/video");
	cardrequest.setTarget("sys.mediaplayer.previewer");
	cardrequest.setUri("file:///accounts/1000/shared/music/sample.mp3");
	InvokeManager invokemanager;
	invokemanager.invoke(cardrequest);
}

 

I call this Qt C++  function from my QML file, and it plays local videos, but if I set an URL in setUri() method , getting the error.

Contributor
Posts: 19
Registered: ‎05-21-2012
My Device: Bold

Re: Playing Streaming Video

[ Edited ]

Hey Guys,

I got one more update, I can play remote audio/video if the url doesn't have space or %20 in it.

 

How can I play urls which has %20 in it. I tried QUrl::fromEncoded("http://... %20...") but is not woking.

 

Could any please help me how to play encoded url.

 

New Contributor
Posts: 3
Registered: ‎11-06-2012
My Device: BlackBerry 10 Dev Alpha

Re: Playing Streaming Video

[ Edited ]

Did you manage to play remote mp4 videos or just audio?

I still have sound but no video output at all on a remote mp4 file (HTTP protocol).

Contributor
Posts: 19
Registered: ‎05-21-2012
My Device: Bold

Re: Playing Streaming Video

I am able to play Audio/Video from Local and Remote location in Custome player and Device default player.

The only issue I have is I can't play Encoded Remote Url, a Url which has Space or %20 in it.

 

It would be really nice if anyone can help me to play encoded Url. I think its the QUrl which is causing the issue.

 

 

New Contributor
Posts: 3
Registered: ‎11-06-2012
My Device: BlackBerry 10 Dev Alpha

Re: Playing Streaming Video

Still no luck here...

 

I'm using this piece of QML, based on the official docs, and I still get white screen (but I can hear the sound of the stream correctly).

 

import bb.cascades 1.0
import bb.multimedia 1.0

Page {
    attachedObjects: [
        MediaPlayer {
            id: myPlayer
            sourceUrl: "http://somewhereintheweb/video.mp4"
            videoOutput: VideoOutput.PrimaryDisplay
            windowId: videoSurface.windowId
        }
    ]
    ForeignWindowControl {
        id: videoSurface
        windowId: "myVideoSurface"
        updatedProperties: WindowProperty.Size | WindowProperty.Position | WindowProperty.Visible
        visible: boundToWindow
        preferredWidth: 640
        preferredHeight: 480
    }
    
    onCreationCompleted: {
        myPlayer.play();
    }
}

 From the C++ side I have this very small snippet:

// Test video
	QmlDocument *qml = QmlDocument::create("asset:///testvideo.qml");
	Page* root = qml->createRootObject<Page>();

	Application::instance()->setScene(root);

 

Developer
Developer
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha

Re: Playing Streaming Video

the fromEncoded should do the job, you probably have some other unhandled characters in your URL...i would suggest you make yourself a simple project and try to play around with the url string to find the issue...shouldn't be that hard.

btw for Error 13, this seems to be an OutOfMemory error...find the doc on error codes here:
https://developer.blackberry.com/cascades/reference/bb__multimedia__mediaerror.html

hope this helps