public function signRtmpUrl($bucket, $channelName, $timeout = 60, $options = NULL)
    {
        $this->precheckCommon($bucket, $channelName, $options, false);
        $expires = time() + $timeout;
        $proto = 'rtmp://';
        $hostname = $this->generateHostname($bucket);
        $cano_params = '';
        $query_items = array();
        $params = isset($options['params']) ? $options['params'] : array();
        uksort($params, 'strnatcasecmp');
        foreach ($params as $key => $value) {
            $cano_params = $cano_params . $key . ':' . $value . "\n";
            $query_items[] = rawurlencode($key) . '=' . rawurlencode($value);
        }
        $resource = '/' . $bucket . '/' . $channelName;

        $string_to_sign = $expires . "\n" . $cano_params . $resource;
        $signature = base64_encode(hash_hmac('sha1', $string_to_sign, $this->accessKeySecret, true));

        $query_items[] = 'OSSAccessKeyId=' . rawurlencode($this->accessKeyId);
        $query_items[] = 'Expires=' . rawurlencode($expires);
        $query_items[] = 'Signature=' . rawurlencode($signature);

        return $proto . $hostname . '/live/' . $channelName . '?' . implode('&', $query_items);
    }
public function signRtmpUrl($bucket, $channelName, $timeout = 60, $options = NULL)
    {
        $this->precheckCommon($bucket, $channelName, $options, false);
        $expires = time() + $timeout;
        $proto = 'rtmp://';
        $hostname = $this->generateHostname($bucket);
        $cano_params = '';
        $query_items = array();
        $params = isset($options['params']) ? $options['params'] : array();
        uksort($params, 'strnatcasecmp');
        foreach ($params as $key => $value) {
            $cano_params = $cano_params . $key . ':' . $value . "\n";
            $query_items[] = rawurlencode($key) . '=' . rawurlencode($value);
        }
        $resource = '/' . $bucket . '/' . $channelName;

        $string_to_sign = $expires . "\n" . $cano_params . $resource;
        $signature = base64_encode(hash_hmac('sha1', $string_to_sign, $this->accessKeySecret, true));

        $query_items[] = 'OSSAccessKeyId=' . rawurlencode($this->accessKeyId);
        $query_items[] = 'Expires=' . rawurlencode($expires);
        $query_items[] = 'Signature=' . rawurlencode($signature);

        return $proto . $hostname . '/live/' . $channelName . '?' . implode('&', $query_items);
    }
public function signRtmpUrl ( $ bucket , $ channelName , $ timeout = 60 , $ options = NULL ) { $ this -> precheckCommon ( $ bucket , $ channelName , $ options , false ) ; $ expires = time ( ) + $ timeout ; $ proto = 'rtmp://' ; $ hostname = $ this -> generateHostname ( $ bucket ) ; $ cano_params = '' ; $ query_items = array ( ) ; $ params = isset ( $ options [ 'params' ] ) ? $ options [ 'params' ] : array ( ) ; uksort ( $ params , 'strnatcasecmp' ) ; foreach ( $ params as $ key => $ value ) { $ cano_params = $ cano_params . $ key . ':' . $ value . "\n" ; $ query_items [ ] = rawurlencode ( $ key ) . '=' . rawurlencode ( $ value ) ; } $ resource = '/' . $ bucket . '/' . $ channelName ; $ string_to_sign = $ expires . "\n" . $ cano_params . $ resource ; $ signature = base64_encode ( hash_hmac ( 'sha1' , $ string_to_sign , $ this -> accessKeySecret , true ) ) ; $ query_items [ ] = 'OSSAccessKeyId=' . rawurlencode ( $ this -> accessKeyId ) ; $ query_items [ ] = 'Expires=' . rawurlencode ( $ expires ) ; $ query_items [ ] = 'Signature=' . rawurlencode ( $ signature ) ; return $ proto . $ hostname . '/live/' . $ channelName . '?' . implode ( '&' , $ query_items ) ; }
Generates the signed pushing streaming url

@param string $bucket bucket name
@param string channelName $channelName
@param int timeout timeout value in seconds
@param array $options
@throws OssException
@return The signed pushing streaming url
Generates the signed pushing streaming url