case 'create_playlist':
        createPlaylist($_POST['playlistTitle'], $_POST['playlistDescription']);
        break;
    case 'delete_playlist':
        deletePlaylist($_POST['playlistTitle']);
        break;
    case 'update_playlist':
        updatePlaylist($_POST['newPlaylistTitle'], $_POST['newPlaylistDescription'], $_POST['oldPlaylistTitle']);
        break;
    case strcmp(substr($operation, 0, 7), 'search_') == 0:
        // initialize search specific information
        $searchType = substr($operation, 7);
        searchVideos($searchType, $_POST['searchTerm'], $_POST['startIndex'], $_POST['maxResults']);
        break;
    case 'show_video':
        echoVideoPlayer($_POST['videoId']);
        break;
    default:
        unsupportedOperation($_POST);
        break;
}
/**
 * Perform a search on youtube. Passes the result feed to echoVideoList.
 *
 * @param string $searchType The type of search to perform.
 * If set to 'owner' then attempt to authenticate.
 * @param string $searchTerm The term to search on.
 * @param string $startIndex Start retrieving search results from this index.
 * @param string $maxResults The number of results to retrieve.
 * @return void
 */
예제 #2
0
/*
 * The main controller logic of the YouTube video browser demonstration app.
 */
$queryType = $_POST['queryType'];

if ($queryType === null) {
    /* display the entire interface */
    include 'interface.html';
} else if ($queryType == 'show_video') {
    /* display an individual video */
    if (array_key_exists('videoId', $_POST)) {
        $videoId = $_POST['videoId'];
        echoVideoPlayer($videoId);
    } else if (array_key_exists('videoId', $_GET)) {
        $videoId = $_GET['videoId'];
        echoVideoPlayer($videoId);
    } else {
        echo 'No videoId found.';
        exit;
    }
} else {
    /* display a list of videos */
    $searchTerm = $_POST['searchTerm'];
    $startIndex = $_POST['startIndex'];
    $maxResults = $_POST['maxResults'];
    
    $yt = new Zend_Gdata_YouTube();
    $query = $yt->newVideoQuery();
    $query->setQuery($searchTerm);
    $query->setStartIndex($startIndex);
    $query->setMaxResults($maxResults);
예제 #3
0
function searchYoutubeVideoDetail($id, $type)
{
    $retval = array();
    $data = array();
    $data = echoVideoPlayer($id);
    $retval['status'] = 'OK';
    $retval['statusmsg'] = 'OK';
    $retval['data'] = $data;
    return $retval;
}