2011-04-12 95 views
1

我正在嘗試創建一個簡單的視頻庫,以便從特定Ustream用戶的錄製視頻中提取視頻。我一直在做一些研究,看着API Documentation,但似乎無法弄清楚。使用UStream API創建視頻庫

這是我到目前爲止。

$request = 'http://api.ustream.tv'; 
$format = 'php'; // this can be xml, json, html, or php 
$args .= 'subject=[channel]'; 
$args .= '&uid= [the-crossfader-show]'; 
$args .= '&command=[getCusomEmbedTag]'; 
$args .= '&params=[autoplay:false; mute:false; height:100; width:100;]'; 
$args .= '&page=[1]'; 
$args .= '&limit=[20]'; 
$args .= '&key=[4872929558631FEB4E9AEE8DDF080F28]'; 

// Get and config the curl session object 
$session = curl_init($request.'/'.$format.'?'.$args); 
curl_setopt($session, CURLOPT_HEADER, false); 
curl_setopt($session, CURLOPT_RETURNTRANSFER, true); 

//execute the request and close 
$response = curl_exec($session); 
curl_close($session); 

// this line works because we requested $format='php' and not some other output format 
$resultsArray = unserialize($response); 

// this is your data returned; you could do something more useful here than just echo it 
print_r $resultsArray['result']; 

我不知道該做些什麼之後才能把它變成一個簡單的畫廊。任何人都有使用UStream API的經驗,或者對接下來要做什麼有所建議?

回答

1

我知道這是一箇舊帖子,但我今天第一次一直在看API,並且遇到了這個問題。嘗試使用沒有圍繞你的值的方括號的參數?例如:

$args .= 'subject=channel'; 
$args .= '&uid=the-crossfader-show'; 
$args .= '&command=getCusomEmbedTag'; 
$args .= '&params=autoplay:false; mute:false; height:100; width:100;'; 
$args .= '&page=1'; 
$args .= '&limit=20'; 
$args .= '&key=4872929558631FEB4E9AEE8DDF080F28'; 

您在the-crossfader-show之前還有一個額外的空間。我沒有試過這段代碼,但也許這會有所幫助。另外,設置subject=user會讓你看到所有用戶的視頻,而我認爲這只是一個單一的視頻流,而不是subject=channel

+0

繼續爲其他人查看。使用命令'listAllVideos'或'listAllChannels'將返回一組結果,您可以從中建立視頻列表。 – 2013-05-30 15:38:00