An app I wrote needed the following features:
- Application has to run in the browser as a SWF.
- Application will run in filesystem mode (file://).
- Application will not have server side (except for YouTube).
- Application will have to login to YouTube using ClientLogin instead of AuthSub to avoid redirects.
- Application will have to upload a manipulated ByteArray, not directly from FileReference.browse().
So, I turned to the YouTube API docs, looked at the PHP implementations and the result is this class which I’m sharing with you now.
Introducing: YouTubeDirectUploader.as – A utility class for uploading to YouTube using email and password.
The class provides two methods of uploading:
- Using FileReference and browse() – which will opt the user to select their video to upload.
- Using a ByteArray – which allows the Application to manipulate the FLV before uploading to YouTube (what was needed in my case).
It was also designed to be used as a declared object in MXML, just to ease the use and allow bindings to form elements.