What is the the url format of the live stream ?

Everytime I save my content I have the error:

"You have specified an invalid media URL or embed code."

I tried the format:

http://www.ustream.tv/channel/my_channel_name
http://www.ustream.tv/channel/my_ID_channel
http://www.ustream.tv/embed/my_ID_channel
http://ustream.tv/channel/username
http://ustream.tv/username

Comments

karlis’s picture

This module seems to require the numerical embed code. If you're using the ustream.tv/channel style url, you can find it in the html meta headers:

so you can post that URL into this module. I modified the extract function in ustreamlive.inc at line 104 so it grabs that code for you:

function emvideo_ustreamlive_extract($embed = '') {
  if (stripos($embed,'channel') ) {
        $channel = file_get_contents($embed);
        if (preg_match('/ustream\.tv\/embed\/(\d+)\"/',$channel,$matches)) {
                $code = $matches[1];
                return($code);
        }
  } else {

  return array(
    '@ustream\.tv/flash/live/([^"\&\?]+)@i', // This seems to be the old embed
    '@ustream\.tv/channel/([^"\&\?]+)@i',
    '@ustream\.tv/embed/([^"\&\?]+)@i',  
    '@flashvars="autoplay=false&brand=embed&cid=(\d+)@i', // This is th
    // TODO: Need to parse the code for direct channel URLs eg http://ustream.t
    // or http://ustream.tv/USERNAME and also need to consider there may be a U
  );
}   
    
}
mstrelan’s picture

Status: Active » Needs work

if (stripos($embed,'channel') ) {
We need a better regex test for this. Channel could appear in any embed code, in any part of the URL. We need to ensure it comes directly after ustream.tv/ and is followed by another / and then the channel name.

$channel = file_get_contents($embed);
I don't like this. What if file_get_contents() fails? Also it seems like overkill. Does anyone want to look in to the UStream API to see if we can extract a number from a channel alias?

Rob C’s picture

See the 7.x version. We still have 1 issue open with this in 7.x, the ustream.tv/channel-name, but the rest works. (see MediaInternetUStreamHandler.inc for details on the api calls)