I have created the php script below that uploads videos to youtube and it uploads fine.

I would like to be able to set advanced settings to the uploaded video as follows:

* Allow comments should be "approved" not "All"
* I also need to be able to set the video location(this would come from
the database from my site)
* I should also need to be able to set the recording date(to the date
of the upload)
* I also don't want the video statistics to be publicly visible

I have looked around, but i cannot find any documentation on this from google, and i think google have not provided complete documentation for the API.

Any links will also do. Thanks

```
require_once '../google_api/Google_Client.php';
require_once '../google_api/contrib/Google_YouTubeService.php';
$OAUTH2_CLIENT_ID = '514750847005.apps.googleusercontent.com';
$OAUTH2_CLIENT_SECRET = '9mvQL0NPv1zEOty0tZw71O4t';

$client = new Google_Client();
$client->setClientId($OAUTH2_CLIENT_ID);
$client->setClientSecret($OAUTH2_CLIENT_SECRET);
$redirect = filter_var('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'], FILTER_SANITIZE_URL);
$client->setRedirectUri("{$redirect}");

$youtube = new Google_YoutubeService($client);

if (isset($_GET['code'])) {
            if (strval($_SESSION['state']) !== strval($_GET['state'])) {
                die('The session state did not match.');
            }

            $client->authenticate();
            $_SESSION['token'] = $client->getAccessToken();
            header('Location: ' . $redirect);
        }

        if (isset($_SESSION['token'])) {
            $client->setAccessToken($_SESSION['token']);
        }
        if ($client->getAccessToken()) {
            try {
                $snippet = new Google_VideoSnippet();
                $snippet->setTitle($title);
                $snippet->setDescription($desc);
                $snippet->setTags($tags);
                $snippet->setCategoryId(22);

                $status = new Google_VideoStatus();
                $status->privacyStatus = "public";

                $today = date("Y-m-d\TH:i:s");
                $recordingDetails = new Google_VideoRecordingDetails();
                $recordingDetails->setRecordingDate($today);

                $video = new Google_Video();
                $video->setSnippet($snippet);
                $video->setStatus($status);
                $video->setRecordingDetails($recordingDetails);

                // Size of each chunk of data in bytes. Setting it higher leads faster upload (less chunks,
                // for reliable connections). Setting it lower leads better recovery (fine-grained chunks)
                $chunkSizeBytes = 1 * 1024 * 1024;

                // Create a MediaFileUpload with resumable uploads
                $media = new Google_MediaFileUpload('video/*', null, true, $chunkSizeBytes);
                $media->setFileSize(filesize($vd_file));

                // Create a video insert request
                $insertResponse = $youtube->videos->insert("status,snippet", $video, array('mediaUpload' => $media));

                $uploadStatus = false;

                // Read file and upload chunk by chunk
                $handle = fopen($vd_file, "rb");
                while (!$uploadStatus && !feof($handle)) {
                    $chunk = fread($handle, $chunkSizeBytes);
                    $uploadStatus = $media->nextChunk($insertResponse, $chunk);
                }

                fclose($handle);
                msg_add('suces', 'message', 'Youtube video upload was successful');
            } catch (Google_ServiceException $e) {
                $message = sprintf('<p>A service error occurred: <code>%s</code></p>', htmlspecialchars($e->getMessage()));
                msg_add('err', 'message', $message);
            } catch (Google_Exception $e) {
                $message = sprintf('<p>An client error occurred: <code>%s</code></p>', htmlspecialchars($e->getMessage()));
                msg_add('err', 'message', $message);
            }

```