Internet Handholding posted on September 13, 2010 10:39

Ustream.tv lets you stream live videos. After your live show, Ustream automatically archives the videos.
You can embed your live show on our website.
A useful application is to list your archived videos on your website and give our visitors the opportunity to view them.
The Ustream data API documentation is here.
http://developer.ustream.tv/data_api/docs
You need a method to send a request to Ustream or any other website. You can use the following method to send a URI to Ustream and get the response back as a string.
Using System.IO;
Using System.Net;
...
public string Get_Response(string uri)
{
//----- Create request
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
//----- Get Response
WebResponse response = req.GetResponse();
StreamReader receive = new StreamReader(response.GetResponseStream());
string sout = receive.ReadToEnd();
receive.Close();
return sout;
}
You will need a method to format the URI for Ustream, which follows.
First, you need to go to http://developer.ustream.tv and get a developer key.
In the code that follows, use html option to display the results in a web page as is. Use the xml option to parse the results and display them in your own format.
The default limit is 20. You may want to increase the limit to 100, which Ustream says is the maximum, but I have not tested that. Some of their other documentation is wrong, so you may be able to try a bigger number if you need to.
public string Ustream_Get_Videos_For_User(
string devkey, string user)
{
string uri = ustream_uri
+ "html"
//+ "xml"
+ "/user/" + user
+ "/listAllVideos"
+ "?key=" + devkey
+ "&limit=" + 100
;
string sout = Get_Response(uri);
return sout;
}
You can call this code in your Asp.net webpage like this.
<%=Ustream_Get_Videos_For_User("your-dev-key"
, "ustream-username") %>
This is only an example to get you started programming.
Although this will display the results, this is not a format useful for your visitors.
I have written code to do the whole job, retrieve the results by user or channel and display as a list. The visitor can then click on the video and then watch the archived webcast. Maybe I will get around to posting that code one day.
By Andrew Weitzen, Bronze Inc. (c) 2010
Bronze is the publisher of several online Internet journals including: InternetHandholding.com, DomainNames.gs, DotNetNuke.bz, Programmer.bz, Software.vg, WebHosting.vg