« Home | StarCraft 2 GPU Overheating FIX » | Starcraft 2 - 0day Download Experience - Boosted » | How To Downgrade Windows 7 Ultimate to Professional » | first impressions of Google’s Skipfish WVS » | My New ESXi Lab System » | Released : JSecurityModule » | Install MySQL 5.1 on Debian 5.0.3 HOW-TO » | הזמנה – הרצאה על אבטחת מסדי נתונים, במיקרוסופט ישראל » | איך להתקין Windows 7 מ USB DiskOnKey » | iSCSI Storage Initiator / Target in a Linux Enviro... »

Checking if a Stream is Online/Offline (PHP)

For the past year I have been watching SOOO many streams online. it got to a point where it almost completely replaces my TV view time.

as of 2011 the main streaming sites for video games are Justin.TV, Own3d.TV, Regame.TV.

all of these sites allow you to stream video over RTMP, and have become very popular with many sites and companies embedding such mechanisms to broadcast video on demand, and live streaming of events and games/tournaments.

each site therefor has its own API for developers/site builders to be able to embed things from their streams, and the most basic thing is an ONLINE Indicator.

so my 0.02 cents here will be to list functions that will enable you to have an Online indicator for each of the above, hoping that its saves some time…

for the examples, I used PHP for some quick and dirty coding.

for Justin.TV --

//justintv status check
function justinTVcheck ($channelName) {
$channelName = strtolower($channelName);
$json_file =
http://api.justin.tv/api/stream/list.json?channel=" . $channelName;
$json = file_get_contents($json_file);
if (strpos($json, 'name')) {
return (1); //online
} else {
return (0); //offline
}
}

for own3d.TV --

//own3d status check
function ownedTVcheck ($channelName) {
$request = '
http://api.own3d.tv/liveCheck.php?live_id=';
$arg = $channelName;
$session = curl_init($request.$arg);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session);

if (preg_match("/true/",$response, $result)) {
return (1); //online
} else {
return (0); //offline
}
}

for regame.TV --

//regame status check
function regameTVcheck ($channelName) {
$url = '
http://www.regame.tv/liveview_xml_multiple.php?stream_ids=';
$arg = $channelName;
$xml = simplexml_load_file($url.$arg);
$status=$xml->stream->online;
if (strcmp($status,'true')==0) {
return (1); //online
} else {
return (0); //offline
}
}

pretty straight forward, functions return 1 if the stream is online, and 0 if not. and should be easily transferable to other languages.

Syndication : Digg It  Add to Technorati Favorites  Stumble It  Worth Reading 

so you watch starcraft instead of posting in the blog ?:(

i admit i have been quite inactive in this blog due to the high demand of time of my current job. but ill try to post more :)

happy new year !

I tried to use the own3d.TV code, but it didn't work. I've just put the id of the stream in the $request and replaced return (1) by echo "online" (same at offline).
Am I doing something wrong? Thanks for help

Hi Barry, I'm having trouble implementing your code.

I saved the own3d status check as streamStatus.php and changed "return (1)" to "echo "Online"" etc.

Then in my html I added:



But it doesn't seem to output anything on my site when the stream is on or off line.

Could you shed any light on this problem?

Whoops! I meant to take out the php brackets...


I should have said:

include 'streamStatus.php';

ownedTVcheck(123456);//example stream id

That single ball bounced back and forth, and my love for mass effect tali face, and the best part about vacations is
that I get a lesson in how not to judge a book by its cover.
It's likely that if a classification law was passed nationally, large retailers such as Walmart would limit their stock of games with legally enforceable age ratings; as a result of mass effect tali face, most U. Just follow these steps to remove stress.

My weblog; mass effect 1 windows 7

Would you recommend employing someone to carry out the SEO, or would you do it yourself?

Having read this I believed it was very enlightening. I appreciate you spending some time and energy to put this content together.

I once again find myself spending a significant amount of time both reading and leaving
comments. But so what, it was still worthwhile!


Look into my blog ... paleo recipe book

Hi! Do you use Twitter? I'd like to follow you iff that would be okay.
I'm absolutely enjoying your blog and look forward to new posts.



My web blog Clash of Clans Free Gems

I every time used to study piece of writing in news papers but now as I am a user of internet
therefore from now I am using net for articles or
reviews, thanks to web.

Feel free to visit my webpage; belanger plumbing ottawa

Incredible! This blog looks just like my old
one! It's on a totally different topic but it has pretty much the same page layout and design.
Great choice of colors!

Also visit my blog post; tinyurl.com

Link exchange is nothinng else but it is just placing the
other person'swebpage link on your page at suitable place and other person will also ddo same in support
of you.

Checkk out my homepage - iron force hack download

If you are going for finest contents like me, just pay a visit this web site everyday for
the reason that it presents feature contents,
thanks

my web-site; installing vinyl fence

Hey! Do you know if they make any plugins to assist with SEO?
I'm trying to get my blog to rank for some targeted keywords
but I'm not seeing very good results. If you know of any
please share. Kudos!

Visit my website cheats for hay day app ()

After the release of Sony PS3 the hackers got down to business to break into it.
It also allows you to resize and hide the icons of couple of
apps. Following completion of installation you would discover HS2300 driver.


Here is my web page ... http://tinyurl.snovabits.net/; etsyireland.blogspot.ie,

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
http://www.kuwait.prokr.net/
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
"http://www.emirates.prokr.net/
"
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Post a Comment

About

    My Name is Barry Shteiman, im a devoted tech junkie, and this is my blog.
    E: barry.shteiman -at- gmail.com
    Twitter : bshteiman

Tags & Categories

Mailing List & RSS

Stay Updated  
Add to Technorati Favorites