示例#1
0
     # There is no currently notification
     $youtubeNotify = null;
 }
 $upload = new StupeflixDefaultUpload();
 $profileName = "iphone";
 // If you want to use http POST multipart/form-data upload to your own server, use this line instead of the previous (you can use too both upload types)
 //upload = new StupeflixHttpPOSTUpload("http://wwww.mycompany.com/upload");
 $profileIphone = new StupeflixProfile($profileName, array($upload), $meta);
 // Notification
 $notify = null;
 // Uncomment this line if you want to receive a ping when the video is available
 //$notify = new StupeflixNotify("http://mywebserver.com/path/to/receiver/", "available");
 // Uncomment this line if you want to receive a ping when the video state change (queued / start / info ... available).
 //$notify = new StupeflixNotify("http://mywebserver.com/path/to/receiver/");
 //    $profileArray = array($profileIphone, $profileQuicktime);
 $profiles = new StupeflixProfileSet(array($profileIphone), null, $notify);
 $profileNames = $profiles->getProfileNames();
 echo "Sending definition ...\n";
 $stupeflix->sendDefinition($user, $resource, $definitionFilename);
 echo "Launching generation of profiles\n";
 $stupeflix->createProfiles($user, $resource, $profiles);
 // This line will give you a url for the preview: you can point a standard flash player at it, you will get a video stream as soon as the video generation starts
 // You will have to ask for a preview in the meta : see before in $metaDict
 $previewURL = $stupeflix->getProfilePreviewUrl($user, $resource, $profileName);
 echo "preview URL: " . $previewURL . "\n";
 // Now wait for the completion of the video
 $lastCompletion = -1;
 // Loop : wait for the video to complete
 echo "Waiting for completion...\n";
 while (true) {
     // Retrieve the info for all profiles generated for user/resource
 public function createProfiles($user, $resource, $profiles)
 {
     // Create the base url
     $url = $this->createProfilesUrl($user, $resource);
     $body = "";
     $xml = '<?xml version="1.0" encoding="UTF-8"?>';
     if (is_array($profiles)) {
         $profiles = StupeflixProfileSet::deflt($profiles);
     }
     $xml .= $profiles->xmlGet();
     $body = self::XML_PARAMETER . "=" . urlencode($xml);
     $this->sendContent("POST", $url, null, $body, self::APPLICATION_URLENCODED_CONTENT_TYPE);
     return true;
 }