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

New Developer
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.setMimeType("video/x-youtube"); //also tried with video/mp4 and video/x-flv



    bb::system::InvokeManager invokeMan;




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.


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.


Application Development Consultant | Developer Relations


Posts: 252
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 Smiley Happy


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
Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: How to using core mediaplayer for YouTube videos?

I'm trying to figure out how to do the same thing.  I'm recording screencasts for my BB10 app and want to play them using the media player.  I can include the videos in my app, but that baloons the size of the BAR file.  It would be nice to play them from YouTube, still in the media player, but I don't want to use a WebView -- I'd like to be able to use the Media Player directly.  The problem is, I don't know how to get a link to a MP4 file on YouTube.com.  It's probably not possible?  There are sites that will convert a YouTube video to an MP4 for you, but that's not what is wanted here...

Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: How to using core mediaplayer for YouTube videos?

I belive it is against Googles TOS to play youtube videos in any way other than by using html5.  This is because they use the web functionalities to support thier advertisments and going native somehow is able to circumvent this.



They made Microsoft pull the youtube app from Windows Phone several times because they were trying to build a native version that did not use html5 as thier TOS requires.