PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Checking upload status

After uploading a video, it will immediately be visible in an authenticated user's uploads feed. However, it will not be public on the site until it has been processed. Videos that have been rejected or failed to upload successfully will also only be in the authenticated user's uploads feed. The following code checks the status of a Zend_Gdata_YouTube_VideoEntry to see if it is not live yet or if it has been rejected.

Example 472. Checking video upload status

<?php
try {
    
$control $videoEntry->getControl();
} catch (
Zend_Gdata_App_Exception $e) {
    echo 
$e->getMessage();
}

if (
$control instanceof Zend_Gdata_App_Extension_Control) {
    if (
$control->getDraft() != null &&
        
$control->getDraft()->getText() == 'yes') {
        
$state $videoEntry->getVideoState();

        if (
$state instanceof Zend_Gdata_YouTube_Extension_State) {
            print 
'Upload status: '
                  
$state->getName()
                  .
' '$state->getText();
        } else {
            print 
'Not able to retrieve the video status information'
                  
.' yet. ' "Please try again shortly.\n";
        }
    }
}

Zend Framework