示例#1
0
 function run()
 {
     $src = $this->flashvars['src'];
     $width = $this->width . "px";
     $height = $this->height . "px";
     if (DxdUtil::endWith($src, 'flv')) {
         $type = 'video/x-flv';
     } else {
         $type = 'video/mp4';
     }
     echo "\r\n\t\t<video id='{$this->id}' class='video-js vjs-default-skin'\r\n\t\t\t  controls preload='auto' width='{$this->width}' height='{$this->height}'\r\n\t\t\t  data-setup='{}'>\r\n\t\t\t <source src='{$src}' type='{$type}' />\r\n        ";
 }
示例#2
0
 public function getDownloadUrl($path)
 {
     if (DxdUtil::endWith($path, '.m3u8')) {
         $url = $this->getSourceUrl() . $path . '?pm3u8/0&e=' . strval(3600 + time());
     } else {
         $url = $this->getSourceUrl() . $path . '?e=' . strval(3600 + time());
     }
     $url = trim($url);
     $sign = hash_hmac('sha1', $url, $this->_secretKey, true);
     //	error_log("length of sign:".strlen($sign));
     $find = array('+', '/');
     $replace = array('-', '_');
     $token = str_replace($find, $replace, base64_encode($sign));
     //	error_log("length of tocken:".strlen($token));
     return $url . '&token=' . $this->_accessKey . ':' . $token;
 }