Minded Systems

PHP: JustinTV Object Class

Recently, video streaming services such as Justin.tv and Ustream have had noticeably higher volumes of traffic. The ever-changing landscape of the world of television is slowly finding its home(s) on the net. With this increased use of these specialized services, specialized software solutions will be needed to ensure successful integration into existing systems. Using both the ShoutCast object class and the IceCast object class as building models, a simple PHP object class has been built for basic data collection.

Since the information provided for any given JustinTV channel is limited (due to the nature of the service), the available functions for obtaining the retrieved data are limited accordingly. This limitation makes the object an analytics data collection tool primarily.

Once the PHP class file has been included, the JustinTV() function can be used to build a new JustinTV object. Here’s some example code of how to make use of the object class:

$j = new JustinTV();
$j->usernm = 'justintv-channel-id';

if($j->openstats()) {
  if($j->getStreamStatus()) {
    //stream is online and information loaded
  } else {
    //stream is offline
  }
} else {
  //server could not be connected to or is offline
}

As indicated, built on previous objects of similar nature, the JustinTV object class is reliable, simple, and easy to use. A full function list will be added to this post soon.

I’m working on trying to adapt this object to be able to pull UStream channel statistics as well.

September 30, 2009 Tyler Winfield
Please provide a valid email address

Trackback URL

http://www.minded.ca/2009-09-25/php-justintv-object-class/trackback/