Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by dansav · Mar 27, 2012 at 11:25 PM · videouploadwwwformyoutube

use unity wwwform to upload youtube video?

How would I upload a video to youtube using wwwform?

I'm reading the docs but don't understand their php example and how I would translate this to unity. They also have a .net guide but it's custom .net api.
Can't I do this straight from unity without using php or .net?

https://developers.google.com/youtube/2.0/developers_guide_dotnet

 something like
         var form = new WWWForm();
         form.AddField("frameCount", Time.frameCount.ToString());
         form.AddBinaryData("fieldname", bytes, "video.mov", "video/quicktime");
         
           var w = WWW("some url", form);
         yield w;
         if (w.error != null)
             print(w.error);
         else
             print("Finished Uploading Screenshot");
     }
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by ByteSheep · Mar 28, 2012 at 12:24 AM

Nearly certain you have to use php and that you can't do this directly through unity..

php files can receive data from unity using the get() function, so you can send variables to the php file (e.g. video name & location) and then use php to upload that file/video to youtube.

Haven't got too much experience with the unity WWW class but I'll give it a go:

 var postTo="yourURL/file.php?"; //be sure to add a ? to your url
 var videolocation="video location";

 function Start() {
 
     var TheURL = postTo + "loc=" + WWW.EscapeURL(videolocation);
        
     // Post the URL to the site
     video_post = WWW(TheURL);
     yield video_post;
 
     if(video_post.error) {
         print("There was an error: " + video_post.error);
     }
 }



Then use the get() function in the php file:

 if($_GET['loc'])
 {
 $vidlocation = $_GET['loc'];
 
 //now you have the location of the video that should be uploaded..
 }



Hope this helped :D

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by DaveA · Mar 28, 2012 at 02:16 AM

You would have to be NOT using a web player so you could read the local file (or you have already converted some in-game memory to a compatible format), and you need to specify the bytes to upload. If going direcly to youtube you might need to figure out if they have special header info, like your login credentials etc. that should be attached to the headers. So while a php proxy as merry_christmas suggests would work, you still need to figure out what youtube needs and get the bytes of the content on that form.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

send xml with wwwform for youtube video upload from unity 0 Answers

Is it possible to play YouTube Video's using Video Player? 1 Answer

How to fix "Your Browser Does Not Currently Recognize Any of the Video Formats Available" error? 0 Answers

Upload large files 0 Answers

Failed to upload image over custom server 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges