This Howto will explain how you can directly upload a video to HW and convert it from your website.
First, you need to enable the external upload capability from your account page (developer tab). Activating this option will give you an upload key to put in your upload form.
h2. Upload form
You have two ways to upload a video: normal upload or ajax upload with progression.
h3.h2. Normal upload
In a page (upload.html for example), put this HTML form:
That's it!
h3. Ajax upload
To**DISABLED**
For dothose who already integrated the ajax upload, it'syou morewill complicated. Youalways have to make a proxy request server side to have success because ajax request cannot reach external websites.
In PHP (ajaxproxy.php):
The upload form:
The UPLOAD_ID is a key generated by you. It is used to track the upload progress.
The CSS:
The javascript:
You need to include the prototype library (http://www.prototypejs.org) librarysize=0 and add this piece of JS (from http://mongrel.rubyforge.org/docs/upload_progress.html):received=0.
.
h3. Form parameters
In the sample codes, we can see some hidden fields:
* key: your upload key (necessary to authenticate your account)
* redirect_if_success: redirect your user after a successful upload (optional)
* redirect_if_error: redirect your user after a failed upload. Will have the error code in parameter (optional)
* your_site_user_id: this is a custom field, custom fields are unlimited. This is important if you want to track your users' videos or whatever.
* post_id: another custom field
h2. Get notified
To get notified when an upload is finished, you must enable the ping after transfer in your account (developer tab). This address will receive all the info about the new uploaded video, and all the custom fields you've put in your upload form.
Here is an example:
If you've set the automatic encode and the ping_url_after_encode, the job will be automatically created and you'll receive all the custom fields in the ping address.
Example:
So, without any efforts, you'll be able to have your encoded video associated with your own objects (user_id, post_id).
If you don't set the automatic encode, you need to create the job manually after getting the ping after transfer (custom fields included).