10-16-2013 07:28 AM
I'm trying to use the core mediaplayer to show a YouTube video.
This is the code I wrote:
cardRequest.setMimeType("video/x-youtube"); //also tried with video/mp4 and video/x-flv
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.
Solved! Go to Solution.
10-18-2013 10:13 AM
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
10-18-2013 10:49 AM - edited 10-18-2013 10:51 AM
Replied too soon without a refresh to see Rashid's message
08-07-2014 10:01 PM
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...
08-08-2014 08:56 AM
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.