Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YouTube. How to upload video using PHP

I want to let users to upload videos to YouTube using my account. It means that they visit my site, click on the button "Upload video", choose the file and it uploads to YouTube in my account. The users don't sign in their own accounts, they use my.

As I understood I have to use Using OAuth 2.0 for Web Server Applications. I have created on cloud.google.com new poject, in APIs chose Prediction API ON and YouTube Data API v3, register new app and got Certificate (SERVICE_ACCOUNT_NAME = EMAIL ADDRESS?). The Google APIs Client Library for PHP shows the error

Catchable fatal error: Argument 3 passed to Google_HostedmodelsServiceResource::predict() must be an instance of Google_Input, none given, called in /Volumes/information/data/Dima/Dropbox/web/domains/videocard.aspi/server.php on line 62 and defined in /Volumes/information/data/Dima/Dropbox/web/domains/videocard.aspi/libs/google-api-php-client/src/contrib/Google_PredictionService.php on line 36

And I don't understood is SERVICE_ACCOUNT_NAME = EMAIL ADDRESS in Certificate in cloud.google.com/console?

I don't know what to do, I have spent days to find the right way.

P.S. I can't use ZEND framework. Sorry for my poor English

like image 567
aspirisen Avatar asked Nov 02 '22 10:11

aspirisen


1 Answers

Not sure, why you are trying to use Prediction API. It has nothing to do with uploads. Your error is coming from there.

Here are PHP samples: Resumable Upload Simple uploads

Besides, you can not let users upload into your own account. Through OAuth2, they can only upload to their account. And letting random users upload to your account wouldn't be a good solution anyways. That's why we created YouTube Direct Lite : which lets people upload into their account but sends videos to your playlist for your moderation.

like image 147
Ibrahim Ulukaya Avatar answered Nov 10 '22 21:11

Ibrahim Ulukaya