Sunday, March 20, 2016

YouTube API v3 -> connection timeout on uploading large videos

If you are getting a Connection timeout error / exception, saying that after 1000000 ms, the connection timeout happened, you can help yourself by increasing the timeout for the actual insert request. You need to do that by calling your clients, getIo() and the setting the higher timeout by setTimeout().

It should help you to successfully upload larger vidoes to YoutTube :)

If not, then you can speed up the upload, at least in some situations, by sending larger chunks.
For example,

  $chunkSizeBytes = 30 *1 * 1024 * 1024;
$media = new Google_Http_MediaFileUpload(

This will send 30MB chunks instead of default 1MB chunks, which will make uploads go much faster if your server has an excellect connection to the net (as it should have), and enough of RAM :)

Cool ideas:

GoDaddy's limitation of ~120 seconds timeout is still there, but mitigated with these workarounds , changes in the uploader design :)

Plus, GoDaddy's error log  still shows no errors , albeit the script is terminated at 120seconds.

Also , non-native PHP does seem to work better in terms that it makes resumable uploads possible, after the first ERR_CONNECTION_RESET failure (while uploading to GoDaddy server from a local computer).

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...