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.
Related
I am trying to display the preview thumbnail when user move his finger over video scrubber.
The only solution I m finding is to extract thumbnails using some 3rd party tool and save it to server or pass it to app via some JSON.
What I m trying to do is something similar to JwPlayer (http://jwplayer.electroteque.org/controls-preview)
Any idea where to start?
Or is here any standard protocol that support manual generated thumbnails? Or i need to go with my own feed format.
I don't quite know what the configuration of your project is, but one possibility is too actually instantiate a mini player and display the progress of the video as the user the slides. So essentially this "mini player" would appear when the user begins drag, and skip to whatever time is specified, and pause. It is similar to a project I am working on now. This is a great reference as well: http://www.autodeskresearch.com/pdf/p1159-matejka.pdf. This technique is much different then the one I suggested, but is another alternative depending on your scenario.
I have been searching for a way to create a share function that share an image and text in the same time and the answers i found is that WhatsApp can only share a single text or single image or single audio .. but in another hand i found that YouTube application is able to share text and image in the same time and in one message box as shown below:
So is anyone have an idea of how to do this?!.
And thank you in advance.
WhatsApp actually recognize this link as a youtube link and gets the preview image of the video from youtube.
WhatsApp and youtube probably made an arrangement between them, when WhatsApp recognize
a youtube link it request the image from youtube servers and gets it.
You can see that if you take only the link and send it, the image will be added by WhatsApp.
unfortunately there is no way (that i know off) to share both an image and a text in WhatsApp.
Regards,
Gili
Checking the answer from Gili, what I found out is the link that YouTube share has the follow format in the Extra Text:
https://youtu.be/prkQ6QFv-_Y
So, it is quite easy to parse it and by using the YouTube API for Java, it is possible to retrieve almost all the possible information about that video and build your own layout.
Link one: How to register your app for YouTube to share the text and
capture it:
http://developer.android.com/training/sharing/receive.html
Link two: YouTube Data API for Java
https://developers.google.com/api-client-library/java/apis/youtube/v3
What I am not sure if all the version of YouTube shared text has the same format or not.
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.
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.
Im trying to launch an application from another one. Ive used the fingerpaint api demo and added a save and some different brushes and Id like the user to be prompted on saving the picture to select something like photoshop to do color correction of photomanipulation to the photo and once they are done with the photo and its saved in photoshop have the fingerpaint app reopen with the photo they just manipulated in the screen and ready for them to add more to if they chose to do so.
Will I have to set a background activity to read the photoshops state and when it saves? Thats what Im thinking I will have to do but Im not sure at this point.
Im not asking for some one to code it out for me but if any one has an idea of how or where I can see an example of an app opening another that would be awesome.
( and please do not be so vague as to say look at the android.com dev section as there is WAY to much info to look through on there. I spend half my day on there already :p )
Intents are used to launch other activities. Best way would be to save the image and get the uri for the image.
Intent i = new Intent(Intent.ACTION_EDIT, imageUri);
this.startActivity(i);
That will launch whatever activity that can handle that uri and intent type. You can also use createChooser to give the user the option to pick an Activity. (similar to have the share option works in most apps).
To do the saving recognition I'm not sure if startActivityForResult would do what you want. it depends on how the Photoshop app is setup.