Upload video to YouTube via V3-API with Flex/AS3
I am currently working on an AIR-Application to upload videos to youtube. Since I got the very absurd requirement to upload files up to 80GB (we do not need to discuss this, I also think it´s nonsense) I decided to use the resumable upload for uploading chunks, like descriped on https://developers.google.com/youtube/v3/guides/using_resumable_upload_protocol
But for some reason, if I add the Content-Range header, I always receive an Error #2032. If I do not add the Content-Range header, the upload works, but only for the first chunk.
Has anyone managed to upload a file with the V3 API in AS3/Flex ?
Error 2032 usually occurs when your program or running application goes non-responsive. Some common reasons for this..
- Your Proxy Settings may be not valid
- Your Website must be in the list of restrictions
- Your cookies must be corrupted
- Your ADD-ON's on your browser may be responsible
- Your registry must be corrupted
Source : Adobe Forums
Okay, I found out, what the "problem" is.
After uploading a chunk, the youtube servers return HTTP 308, which will be assessed as an error. Actually it isn't, it is youtubes status for "Resume incomplete". So the solution is simply to add an EventListener for HTTP_RESPONSE_STATUS, check for status 308 and then keep sending the next chunk. HTTP 200, and therefore the COMPLETE-Event will only be fired after uploading the last chunk