Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Video Upload to Youtube
    primarykey
    data
    text
    <p>I am developing an app that uploads a video in the sdcard to youtube and returns the youtube video url after. However, I have not been able to successfully do so.</p> <p>I have tried with ACTION_SEND:</p> <pre><code>public void onUploadClick(View v) { Intent uploadIntent = new Intent(Intent.ACTION_SEND); // In a real app, video would be captured from camera. File f = new File("/sdcard/test.mov"); uploadIntent.setDataAndType(Uri.fromFile(f), "video/quicktime"); startActivity(Intent.createChooser(uploadIntent, "Upload")); } </code></pre> <p>But, oddly, with this implementation I do not have Youtube as an option for the upload. I have Bluetooth, Mail, Dropbox, Facebook, Flickr, Gmail and Handcent. But not Youtube. Any thoughts on this? Besides, is it possible using this method to have the url of the youtube video after uploaded? How?</p> <p>I have also tried using Youtube API for Java, and again no success. I added all the libraries needed (gdata-client-1.0.jar, gdata-media-1.0.jar and gdata-youtube-2.0,jar). However, when I run it I get a NoClassDefFoundError for com.google.gdata.client.youtube.YouTubeService, despite having the right libs and imports. Here is the code I am using:</p> <pre><code>YouTubeService service = new YouTubeService(clientID, developer_key); VideoEntry newEntry = new VideoEntry(); YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup(); mg.setTitle(new MediaTitle()); mg.getTitle().setPlainTextContent("My Test Movie"); mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos")); mg.setKeywords(new MediaKeywords()); mg.getKeywords().addKeyword("cars"); mg.getKeywords().addKeyword("funny"); mg.setDescription(new MediaDescription()); mg.getDescription().setPlainTextContent("My description"); mg.setPrivate(false); mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag")); mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag")); newEntry.setGeoCoordinates(new GeoRssWhere(37.0,-122.0)); // alternatively, one could specify just a descriptive string // newEntry.setLocation("Mountain View, CA"); MediaFileSource ms = new MediaFileSource(new File("file.mov"), "video/quicktime"); newEntry.setMediaSource(ms); String uploadUrl = "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads"; VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry); </code></pre> <p>To sum up, my questions are: - What am I doing wrong in both approaches? - Regarding my simple objective of uploading a video to youtube and getting its youtube link after, which method do you recommend? Even if it's neither of those above.</p> <p>Thank you.</p> <p>---- Update 04/10 ----</p> <ul> <li>After trying with a differente phone I found out that Youtube not showing up as choice to upload the video is my phone's problem (probably due to the ROM). However, even if it does work using intents is not the way to go because I cannot get the URL back and that is essential.</li> <li>After some research it seems that the second method is not possible. The Youtube API for Java does not work in Android.</li> </ul> <p>That being said, I am looking for suggestions on how to upload a video to Youtube in Android. What I really want is to choose a video file, upload it to Youtube and get the youtube URL. Preferably without any interference from the user, who only chooses the file and then the uploading and URL retrieving runs "in the background". Any suggestions? What is the easiest and fastest way to achieve this?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload