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
beat84
Posts: 14
Registered: ‎06-24-2013
My Device: Blackberry Z10 Developer Edition
My Carrier: Wind
Accepted Solution

How to using core mediaplayer for YouTube videos?

Hi all,

I'm trying to use the core mediaplayer to show a YouTube video.

 

This is the code I wrote:

 

MyApp::startYoutube(QString uri){

    InvokeRequest cardRequest;

 

    cardRequest.setTarget("sys.mediaplayer.previewer");

    cardRequest.setAction("bb.action.OPEN");

    cardRequest.setMimeType("video/x-youtube"); //also tried with video/mp4 and video/x-flv

    cardRequest.setUri(uri);

 

    bb::system::InvokeManager invokeMan;

    invokeMan.invoke(cardRequest);

}

 

but passing the YouTube url (http://www.youtube.com/v/VIDEO_ID) the invoked card advice me that the format is not supported.

 

I know that is possible beacause of FastTube app, but I cannot find the solution.

Where is the error?

 

Thanks in advance.

Matt

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

Re: How to using core mediaplayer for YouTube videos?


Hi @beat84,

The link you are trying to play is basically a URL for the web browser, correct? That is, YouTube would need HTML5 or Flash enabled to show you that content (it shows the custom YouTube player controls correct?). For playing things from YouTube, with this type of format for the URL, you would need to play it within a WebView component if you wanted to use it within a native app. The webkit runtime has its own media player (identical to the one seen through the browser app) which will go fullscreen when user plays the content. You can also take a look at native apps like Nobex Radio or SoundHound which does YouTube video playback through WebView.

For playing content using the core Media Previewer card app (the one you are trying to do below), you would need to know the final destination URL from the server (for example: http://domainName.com/file.mp4). Basically, the server would need to send the encoded media, using a protocol recognized by the BlackBerry 10 multimedia platform.

Hope this helps.

Cheers,
Rashid

Application Development Consultant | Developer Relations

BlackBerry
@surashid

Please use plain text.
BlackBerry Development Advisor
sabdelsayed
Posts: 249
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: How to using core mediaplayer for YouTube videos?

[ Edited ]

Replied too soon without a refresh to see Rashid's message :smileyhappy:

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.