Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6038047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:09:43+00:00 2026-05-23T06:09:43+00:00

I am using the following code to upload a video to Youtube through youtube

  • 0

I am using the following code to upload a video to Youtube through youtube API. My problem is after uploading the video, I need to give the location of the video to the user. How do I find this ?
I’ll be really grateful if someone can help me to solve this.

MediaFileSource ms = new MediaFileSource(videoFile, mimeType);
        String videoTitle = title;
        VideoEntry newEntry = new VideoEntry();
        YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
        mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Tech"));
        mg.setTitle(new MediaTitle());
        mg.getTitle().setPlainTextContent(videoTitle);
        mg.setKeywords(new MediaKeywords());
        mg.getKeywords().addKeyword("yt:crop=16:9");
        mg.setDescription(new MediaDescription());
        mg.getDescription().setHtmlContent(attributionDocument);
        mg.setPrivate(true);
        mg.setVideoId("Vid1");


    ResumableGDataFileUploader uploader = null;
    try {
        uploader = new ResumableGDataFileUploader.Builder(
            service, new URL(RESUMABLE_UPLOAD_URL), ms, newEntry)
            .title(videoTitle)
            .build();

        uploader.start();
          while (!uploader.isDone()) {
            try {
                Thread.sleep(PROGRESS_UPDATE_INTERVAL);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
          }

          switch(uploader.getUploadState()) {
            case COMPLETE:
              System.out.println("Uploaded successfully");

              break;
            case CLIENT_ERROR:
                System.out.println("Upload Failed");
              break;
            default:
                System.out.println("Unexpected upload status");
              break;
          }

    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (ServiceException e) {
        e.printStackTrace();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:09:44+00:00Added an answer on May 23, 2026 at 6:09 am

    I managed to solve this by myself. Instead of using resumable file upload, I used direct upload. My code:

        String id = "";
        File videoFile = new File(videoLocation);
        if (!videoFile.exists()) {
            System.out.println("Sorry, that video doesn't exist.");
    
        }
        String videoTitle = title;
        VideoEntry newEntry = new VideoEntry();
        YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
        mg.setTitle(new MediaTitle());
        mg.getTitle().setPlainTextContent(videoTitle);
        mg.setKeywords(new MediaKeywords());
        mg.getKeywords().addKeyword("yt:crop=16:9");
        mg.setDescription(new MediaDescription());
        mg.getDescription().setHtmlContent(attributionDocument);
        mg.setPrivate(true);
        mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Tech"));
    
    
        MediaFileSource ms = new MediaFileSource(videoFile, "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);
        id =createdEntry.getId();
        return id;
    
        }
    

    I hope this will save someone else’s day.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the code to upload a video to Youtube using the C# .NET
I have upload the video on facebook using following code Help From : https://github.com/zoul/facebook-ios-sdk/
I wanted to upload a video on youtube using Java Google Data API. I
I am using the following code to upload photo to facebook hconnect = WinHttpConnect(hsession,Lgraph.facebook.com,INTERNET_DEFAULT_HTTPS_PORT,0);`hrequest
I am using the following code to upload an image to a web server
I've implemented the following code for uploading photos inside a jQuery dialog (using an
Using the following code to upload an attachment to Google site, but I am
I am using the following code to upload the file <asp:UpdatePanel ID=UpdatePanel18 runat=server> <ContentTemplate>
Greetings, I'm uploading an image to my server using the following code: http://cocoadev.com/index.pl?HTTPFileUploadSample However,
I am trying to upload file to rackspace cloud file using the following code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.