# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # To run this sample, define these variables first define('USER', "xxx"); # name of your Rambla user account define('PWD', "xxx"); # password of your Rambla user account define('DOWNLOAD_PATH', '/path/to/local/download/location'); # path to a file in which to store the transcoded file require_once 'raws_json/json_client.php'; require_once 'raws_json/rats_service.php'; try { $rats = new RatsService(USER, PWD); $transc_filename = null; echo "\nGetting transc list:"; $transc_list = $rats->getTranscList(); foreach ($transc_list->feed->entry as $o) { echo "\n Transc has filename = " . $o->content->params->filename; $transc_filename = $o->content->params->filename; } # retrieve a single transc instance based on the filename $transc = $rats->getTranscInstance($transc_filename); echo "\nRetrieved transc with filename = " . $transc->entry->content->params->filename; # retrieve a single transc instance based on the filename $downloaded_filepath = $rats->getTranscFile($transc_filename, DOWNLOAD_PATH); echo "\nDownloaded transc to location = " . $downloaded_filepath; # delete transc $rats->deleteTransc($transc_filename);
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # To run this sample, define these variables first define('USER', "xxx"); # name of your Rambla user account define('PWD', "xxx"); # password of your Rambla user account define('LOCAL_PATH', '/path/to/local/video/file'); # add path to local (video) file, to be uploaded to the CDN require_once 'raws_json/json_client.php'; require_once 'raws_json/rats_service.php'; try { $rats = new RatsService(USER, PWD); # upload src file $src = $rats->createSrc("test_rats_api_src", LOCAL_PATH); echo "\nUploaded src: " . $src->entry->id; echo "\nSrc has filename = " . $src->entry->content->params->filename; # retrieve a single src instance based on the filename $src = $rats->getSrcInstance($src->entry->content->params->filename); echo "\nRetrieved src with filename = " . $src->entry->content->params->filename; echo "\nGetting src list:"; $src_list = $rats->getSrcList(); foreach ($src_list->feed->entry as $o) { echo "\n Src has filename = " . $o->content->params->filename; } # delete src $rats->deleteSrc($src->entry->content->params->filename); echo "\nDeleted src with filename = " . $src->entry->content->params->filename;
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # To run this sample, define these variables first define('USER', "xxx"); # name of your Rambla user account define('PWD', "xxx"); # password of your Rambla user account define('LOCAL_PATH', '/path/to/local/video/file'); # add path to local (video) file, to be uploaded to the CDN require_once 'raws_json/json_client.php'; require_once 'raws_json/rats_service.php'; try { $rats = new RatsService(USER, PWD); # upload file to RATS echo "\nUploading file to RATS, please wait.."; $src = $rats->createSrc("test_rats_api_src", LOCAL_PATH); echo "\nCreated src: " . $src->entry->id . "\n"; echo "\nSrc has filename = " . $src->entry->content->params->filename . "\n"; # launch single encoding job $job = $rats->createSingleJob(RATS_FORMAT_MP4_KEEP_SIZE, $src->entry->content->params->filename, "test/rats_single_job/mymovie", "some_client_specific_info", RATS_PROC_EMAIL_TXT . "," . RATS_PROC_EMAIL_JSON); # comma-separated list of procs => instruct RATS to send emails when encoding is done echo "\nCreated single job with id: " . $job->entry->id; # wait until job has completed while (!$rats->isJobComplete($job)) { echo "\n.. job not yet complete, sleeping 10 seconds before checking again"; sleep(10); # sleep number of seconds before asking again }
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # To run this sample, define these variables first define('USER', "xxx"); # name of your Rambla user account define('PWD', "xxx"); # password of your Rambla user account define('LOCAL_PATH', '/path/to/local/video/file'); # add path to local (video) file, to be uploaded to the CDN require_once 'raws_json/json_client.php'; require_once 'raws_json/rats_service.php'; try { $rats = new RatsService(USER, PWD); # upload file to RATS echo "\nUploading file to RATS, please wait.."; $src = $rats->createSrc("test_rats_api_src", LOCAL_PATH); echo "\nCreated src: " . $src->entry->id; echo "\nSrc has filename = " . $src->entry->content->params->filename . "\n"; # launch batch encoding job $job = $rats->createBatchJob(RATS_FORMATGROUP_MP4_JPG_480P, $src->entry->content->params->filename, "test/rats_batch_job/mymovie", "40", "some_client_specific_info", RATS_PROC_EMAIL_TXT . "," . RATS_PROC_EMAIL_JSON); # comma-separated list of procs => instruct RATS to send emails when encoding is done echo "\nCreated batch job with id: " . $job->entry->id; # wait until job has completed while (!$rats->isJobComplete($job)) { echo "\n.. job not yet complete, sleeping 10 seconds before checking again"; sleep(10); # sleep number of seconds before asking again }
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # To run this sample, define these variables first define('USER', "xxx"); # name of your Rambla user account define('PWD', "xxx"); # password of your Rambla user account require_once 'raws_json/json_client.php'; require_once 'raws_json/rats_service.php'; try { $rats = new RatsService(USER, PWD); # INPUT # ----- # create input profile $input = $rats->createInput(array("name" => "test_rats_api_input", "method" => "cdn")); echo "\n\nCreated input: " . $input->entry->id; # retrieve a single input instance based on the id $input = $rats->getInputInstance($input->entry->content->params->id); echo "\nRetrieved input with name = " . $input->entry->content->params->name . " and method = " . $input->entry->content->params->method; # update input instance $input->entry->content->params->description = "Importing files from CDN"; $input = $rats->updateInput($input); echo "\nRetrieved input with name = " . $input->entry->content->params->name . " and description = " . $input->entry->content->params->description; # get list of your own input instances echo "\nGetting list of my input profiles:"; $input_list = $rats->getInputList("owner=self");
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # To run this sample, define these variables first define('USER', "xxx"); # name of your Rambla user account define('PWD', "xxx"); # password of your Rambla user account define('LOCAL_PATH', '/path/to/local/image/file'); # add path to local (image) file, to be uploaded to the CDN require_once 'raws_json/rats_service.php'; try { $rats = new RatsService(USER, PWD); # upload overlay file $overlay = $rats->createOverlay("test_rats_api_overlay", LOCAL_PATH); echo "\nUploaded overlay: " . $overlay->entry->id; echo "\nOverlay has filename = " . $overlay->entry->content->params->filename . " and position = " . $overlay->entry->content->params->position; # update overlay position $overlay->entry->content->params->position = "10:10"; $overlay = $rats->updateOverlay($overlay); echo "\nSet new overlay position: " . $overlay->entry->content->params->position; # retrieve a single overlay instance based on the ID $overlay = $rats->getOverlayInstance($overlay->entry->content->params->id); echo "\nRetrieved overlay with filename = " . $overlay->entry->content->params->filename . " and position = " . $overlay->entry->content->params->position; echo "\nGetting overlay list:"; $overlay_list = $rats->getOverlayList(); foreach ($overlay_list->feed->entry as $o) { echo "\n Overlay has filename = " . $o->content->params->filename . " and position = " . $o->content->params->position;