I have a site that charges people for view the videos. I am trying use "google drive" as stream server for videos. I created a account service and the private key, and I am using the php library as you can see bellow:
define('ID_VIDEO', '0B9SXFdezvkZtOE9xVlVNR3U0a1U');
const CLIENT_ID = 'XXXXXXXXXXXXX.apps.googleusercontent.com';
const SERVICE_ACCOUNT_NAME = 'XXXXXXXXXXXXXX@developer.gserviceaccount.com';
const KEY_FILE = 'XXXXXXXXXXXXXXXXXXXXXX-privatekey.p12';
$client = new Google_Client();
$client->setApplicationName("JVideos");
session_start();
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
// Load the key in PKCS 12 format (you need to download this from the
// Google API Console when the service account was created.
$key = file_get_contents(KEY_FILE);
$client->setAssertionCredentials(new Google_AssertionCredentials(
SERVICE_ACCOUNT_NAME,
array('https://www.googleapis.com/auth/drive'),
$key)
);
$client->setClientId(CLIENT_ID);
$service = new Google_DriveService($client);
$file = $service->files->get(ID_VIDEO);
$access_toke = json_decode($client->getAccessToken(), TRUE);
$access_toke = $access_toke['access_token'];
?>
<embed width="100%" height="100%" name="plugin" src="<?= urldecode($file['embedLink']);?>&access_token=<?= $access_toke;?>" type="application/x-shockwave-flash" >
The problem is: how can I embed this video in my site without anybody do the login on google, the video should be viewed just with this authentication executed through of this api on the code above. When I execute this code, google return me that is necessary do the login.
Thanks