开发者

Create an video gallery with UStream API

I'm trying to create a simple video gallery that pulls the videos from the recorded shows of a specific Ustream user. I've been doing some research and looking at the API Documentation but can't seem to figure it out.

This is what I have so far.

$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'];

I'm not really sure what to do after this to turn it into a simple gallery. Anyone have any experience with the UStream API or have suggestions on what to do next?


I know this is an old post, but I have been looking into the API myself for the first time today and came across this. Try using arguments without the square brackets around your values? example:

$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';

You also had an extra space before the-crossfader-show. I haven't tried this code, but perhaps this will help. Also, setting subject=user would get you all the videos for a user, vs subject=channel which i believe to only be a single video stream?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜