Youtube intent starts in browser android - android

I have followed a tutorial on how to use the youtube gdata. Populating a listview with videos from youtube and a onclick. The source code is availeable from this site: http://blog.blundell-apps.com/click-item-in-a-listview-to-show-youtube-video/
On the onclick somethings seems to go wrong. It should start the url of the video, but it only goes to the webrowser and youtube.com
Can somebody take a look at it ?
Edit:
Everything is working now. It seems like using the JSON player/default instead of player/mobile launched the intent correctly.

It seems as though the URL chosen in the example source you linked isn't a good one to use for this purpose. If you look through the source of GetYoutubeUserVideosTask, you'll notice that the value they pull out of the JSON for url is the player->default or player->mobile value from each object in the items array, which does just load a web page if you click on it.
You might try modifying the example to pull out one of the content urls from that JSON object instead, which should load the video player directly.
HTH

The Youtube app is only supposed to be used with special ROMs. So you can't run them in an OpenSource-ROM, like the one used in the Emulator, unfortunately.

Related

Podcast feed in Android app

I am working on an android app for my church and would like to put our sermons on it. The company we upload our sermons to automatically makes a podcast feed for it. Basically I am looking for a way to list podcasts inside of the app. I would like it to be hardcoded to one podcast. I have looked online but cannot really find anything about. I am not sure how to code the podcast part. More than likely the actual playing can be handed off to a secondary app.
there two steps i recommend.
A) Use the Aquery lib to parse the xml or json returned by the podcast feed link.
Check it out https://code.google.com/p/android-query/. Doesnt matter what layout you use to display the podcast items.
B) Then you can Streaming the audio from A URL using MediaPlayer. http://www.tutorialspoint.com/android/android_mediaplayer.htm
Good luck

Android Intent.ACTION_SEND Youtube

I want to use my application to upload videos on YouTube. I'm using this code:
uploadIntent.setDataAndType(Uri.fromFile(f), "video/quicktime");
startActivity(Intent.createChooser(uploadIntent, "Upload"));
but it also shows me options for bluetooth, gmail etc. when I want to it to display only the YouTube option. How can I display only the YouTube option?
I had misunderstood what you were asking. It seems that you have the upload working but want to restrict it to only YouTube. To achieve this, you should not use Intent.createChooser since there's no point in choosing if you only want to display one option. Instead, you can use Intent.setClassName to specify the package and class for YouTube.
You can discover the correct values by simply examining the Intents passed back in your current code when you select YouTube. You'll want to set the return value of Intent.createChooser from PackageManger.queryIntentActivites to a local variable, set a breakpoint in the line after and examine the contents of the YouTube Intent when it breaks.

In Andorid, is it possible to get the Embed Html code of a YouTube video link?

I'm little bit struggle on past few days i can't get good solution for regarding this. My task is to load the youtube link in an webview. The given url is VideoLink. I directly load this link through android webview it won't play. When i load the embed code of this link, it successfully loaded. Here my problem is i get the embed code Manually (ie load the url on system browser-> right click -> select copy embed html),but i have lot of links like this. Is it not possible to do manually. Is it possible to get the embed html code of youtube link by programmatically.
Why cant you create a httpConection to the URL and read the InputStream in to String and give it to Webview. if you can explain a bit more, i can suggest you a better idea.

Redirect embedded video from WebView to standalone player / Play in fullscreen when in landscape mode

I'm developing a news reader app, so I parse RSS feed data and then populate android components. There, I have a WebView component which displays HTML data (parsed from specific XML tag, but it is not important).
So, that HTML data contain valid HTML, with text, formatting, images, and in some news - can contain embedded videos.
Videos are embedded through an (YT), (other video hosting sites) and are displayed/played correctly - web view plays it in-place. Videos are from YouTube, Vimeo, etc. but mainly (>90%) from YouTube, so YouTube is a scope of this question.
I use following code to display webview content:
webContent.setWebViewClient(new WebViewOverrideUrl());
webContent.getSettings().setJavaScriptEnabled(true);
webContent.getSettings().setPluginsEnabled(true);
webContent.loadDataWithBaseURL(null, htmlContent.toString(), "text/html", "utf-8", null);
My questions are:
1. Is there a possibility to redirect this video to a standalone app, i.e. YouTube or Flash player (or whatever user have installed to play videos)?
I have read so many posts regarding this topic but i can't find a solution. Not even a clue.
2. Is it possible to tell that frame with video (mostly YouTube) content to play it in fullscreen when change orientation to landscape (Or if it is in landscape already, to play it in fullscreen immediately when clicked)?
3. Is it even possible with YouTube (Flash) player, and if it's not, is it possible with HTML5 tag (instead of the iframe)?
There is a possibillity to create any tab for video and embed it in HTML contents on server side (, , , <...whatever...>), so i am looking for possible options.
Thanks a lot in advance, if I come up with some kind of solution in meantime, I will definitely post it here. A lot of people face the similar problems.
Well, to answer this question, at last.
Because of a very large number of different devices and different Android systems on those devices, i decided to use the simplest approach - I just ask user where he wants to play video.
The code that everyone knows is:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);
Since i was getting youTube link in an embedded tag, guy who creates XML data for me, made a regex which gets youTube link only and i wrapped it in html tags, partly on server, and partly inside app to get acceptable appearance.
This was the only way i found that works on every device. Tried to aim YouTube app directly, but that didn't work on some very common devices that even have YT installed (Telenor/Alcatel OneTouch). Tried and succeeded in creating custom video player, but it didn't work on some random devices, although it worked on different pieces of a same device model.
Hope this can help someone.

xml parsing with no browser use

I have read the example for Rss Parsing from the ibm site.(http://www.ibm.com/developerworks/opensource/library/x-android/).
In this example,the rss are shown in a listview and then,if you press one announcement you can see it in the web browser of the device.How could i see them in the app,with no use of the device browser?
Thanks a lot
Create a layout with a WebView then load the URL from each "announcement" using WebView.loadUrl.
I'm a little confused but you seem to have answered your own question.
You say you don't want to use the web browser on the device but the example in your question doesn't use the browser. It does exactly what you're asking for.
The idea is that you download the html from the website and then use the parser to break it up into separate "announcements" and store them in list view items in your program.
I have done a bit of this type of thing myself in android. I used jsoup java library, which makes breaking the html into the bits you want to display really easy.
If you want some more help I can give you an example of an app I made that pulls movie times from google.com/movies as an example. here are links to the classes where I did the html download and parse:
ScreenScraper.java
HtmlParser.java

Categories

Resources