Hello, I need a streaming plugin with the standards of the video plugin.
Users can add their streams to rate and leave comment.
allowed platforms Twitch.tv, ustream.tv
Can someone help me?
Hello, I need a streaming plugin with the standards of the video plugin.
Users can add their streams to rate and leave comment.
allowed platforms Twitch.tv, ustream.tv
Can someone help me?
Thank you and Happy New Year.
Thank you for your interest but I need a little help.
My question is this code correct?
class StreamProviderTwitch
{
const clipUidPattern = '@^.*twitch.tv/.*/b/([\d]+).*$@i';
const thumbJsonPattern = 'https://api.twitch.tv/kraken/streams/()';
private static function getUid( $code )
{
$pattern = self::clipUidPattern;
return preg_match("~{$pattern}~", $code, $match) ? $match[1] : null;
}
public static function getThumbUrl( $code )
{
if ( ($uid = self::getUid($code)) !== null )
{
$jsonUrl = str_replace('()', $uid, self::thumbJsonPattern);
$fileCont = @file_get_contents($jsonUrl);
if ( strlen($fileCont) )
{
$fileCont = trim($fileCont);
$fileCont = substr($fileCont, 6, strlen($fileCont) - 9);
$metaObj = @json_decode($fileCont);
if ( $metaObj )
{
$url = @$metaObj->preview;
}
}
return !empty($url) ? $url : StreamProviders::PROVIDER_UNDEFINED;
}
return StreamProviders::PROVIDER_UNDEFINED;
}
}