Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('DIR_APP'))
- die('Access denied');
- class Common {
- //encrypt
- public static function encrypt($x, $key = PRIVATE_KEY) {
- $x .=$key;
- $s = '';
- foreach (str_split($x) as $c)
- $s.=sprintf("%02X", ord($c));
- return($s);
- }
- //decrypt
- public static function decrypt($x, $key = PRIVATE_KEY) {
- $x .=$key;
- $s = '';
- foreach (explode("\n", trim(chunk_split($x, 2))) as $h)
- $s.=chr(hexdec($h));
- return(substr($s, 0, -3));
- }
- //== check number type int
- function checkInt($int) {
- $ktra = is_numeric($int);
- if ($ktra == 0)
- return 0;
- else if ($ktra == 1) {
- if ($int < 0)
- return 0;
- else if ($int > 9999)
- return 0;
- else
- return 1;
- }
- }
- //====substring
- function cutString($strorg, $limit) {
- if (strlen($strorg) <= $limit) {
- return $strorg;
- } else {
- if (strpos($strorg, " ", $limit) > $limit) {
- $new_limit = strpos($strorg, " ", $limit);
- $new_strorg = substr($strorg, 0, $new_limit) . "...";
- return $new_strorg;
- }
- $new_strorg = substr($strorg, 0, $limit) . "...";
- return $new_strorg;
- }
- }
- //=====alert & redirect
- function aRedirect($strUrl = "", $msg) {
- ?>
- <script language="javascript">
- <?php if ($msg != "") { ?>
- alert('<?php echo $msg ?>');
- <?php } ?>
- window.location.href='<?php echo $strUrl ?>';
- </script>
- <?php
- }
- //generate string number
- function rand_str($length = 8, $chars = '0123456789') {
- // Length of character list
- $chars_length = (strlen($chars) - 1);
- // Start our string
- $string = $chars{rand(0, $chars_length)};
- // Generate random string
- for ($i = 1; $i < $length; $i = strlen($string)) {
- // Grab a random character from our list
- $r = $chars{rand(0, $chars_length)};
- // Make sure the same two characters don't appear next to each other
- if ($r != $string{$i - 1})
- $string .= $r;
- }
- // Return the string
- return $string;
- }
- //download file name
- function download_file($filename, $name) {
- $file_extension = strtolower(substr(strrchr($filename, "."), 1));
- switch ($file_extension) {
- case "pdf": $ctype = "application/pdf";
- break;
- case "exe": $ctype = "application/octet-stream";
- break;
- case "zip": $ctype = "application/zip";
- break;
- case "doc": $ctype = "application/msword";
- break;
- case "xls": $ctype = "application/vnd.ms-excel";
- break;
- case "ppt": $ctype = "application/vnd.ms-powerpoint";
- break;
- case "gif": $ctype = "image/gif";
- break;
- case "png": $ctype = "image/png";
- break;
- case "jpeg":
- case "jpg": $ctype = "image/jpg";
- break;
- default: $ctype = "application/force-download";
- }
- header("Pragma: public");
- header("Expires: 0");
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- header("Cache-Control: private", false);
- header("Content-Type: $ctype");
- header("Content-Disposition: attachment; filename=\"" . basename($name . '.' . $file_extension) . "\";");
- header("Content-Transfer-Encoding: binary");
- header("Content-Length: " . filesize($filename));
- ob_end_clean();
- readfile("$filename");
- exit();
- }
- //format number
- function formatNumber($number, $ext = " VNĐ") {
- $strResult = "";
- if ($ext == "")
- $strResult = number_format($number, 0, ',', '.') . " VNĐ";
- else
- $strResult = number_format($number, 0, ',', '.') . $ext;
- return $strResult;
- }
- //get next/prev week
- function getNextPrevWeek($today, $type = '+') {
- $week = strtotime(date("Y-m-d", strtotime($today)) . " " . $type . "1 week");
- $week = strftime("%Y-%m-%d", $week);
- return $week;
- }
- //get next/prev month
- function getNextPrevMonth($today, $type = '+') {
- $month = strtotime(date("Y-m-d", strtotime($today)) . " " . $type . "1 month");
- $month = strftime("%Y-%m-%d", $month);
- return $month;
- }
- /*
- * @author Vu Tran <tmvu.it@gmail.com>
- *
- * @param string $date - Date to be converted
- * @param string $func - which function is to be used (1 for input to mysql, 2 for output from mysql)
- * @local string $local - local format
- */
- function dateconvert($date, $func, $local) {
- if ($func == 1) { //insert conversion
- if (strlen($date) > 10)
- $date = substr($date, 0, 10);
- if ($local == 'en')
- list($month, $day, $year) = split('[/.-]', $date);
- else
- list($day, $month, $year) = split('[/.-]', $date);
- $date = "$year-$month-$day";
- return $date;
- }
- if ($func == 2) { //output conversion
- if (strlen($date) > 10)
- $date = substr($date, 0, 10);
- list($year, $month, $day) = split('[-.]', $date);
- if ($local == 'en')
- $date = "$month/$day/$year";
- else
- $date = "$day/$month/$year";
- if ($day == '00' || $day == '')
- return "";
- else
- return $date;
- }
- }
- //addition date
- function dateAdd($date, $month) {
- $date = new DateTime($date);
- $interval = new DateInterval('P' . $month . 'M');
- $date->add($interval);
- return $date->format('Y-m-d');
- }
- //format currenccy
- function formatCurrencyMysql($str) {
- if (strpos($str, '$') === false) {
- $str = $str;
- } else {
- $str = str_replace('$', '', $str);
- }
- return $str;
- }
- //get date
- function _getDate($date, $type = 'vn') {
- $arrDate = explode(' ', $date);
- $arrDateOut = explode('-', $arrDate[0]);
- $theDay = "";
- if ($type == 'vn') {
- if ($arrDateOut[2] == '00') {
- $theDay = $arrDateOut[1] . '/' . $arrDateOut[0];
- } else {
- $theDay = $arrDateOut[2] . '/' . $arrDateOut[1] . '/' . $arrDateOut[0];
- }
- } else {
- $theDay = $arrDateOut[1] . '/' . $arrDateOut[2] . '/' . $arrDateOut[0];
- }
- return $theDay;
- }
- function loadVideo_V2($containerVideo, $flashDiv, $w, $h, $url, $suburl, $rtmpHost = '', $httpHost = '', $appName = '', $fileName = '', $quanlity = '', $trailer = '', $nextEpisode = '', $isPlay = "false") {
- $detect = new Mobile_Detect;
- $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
- if ($deviceType != "computer") {
- $iosUrl = "http://$httpHost/$appName/mp4:$fileName.720p/playlist.m3u8";
- ?>
- <video width="<?php echo $w ?>px" height="<?php echo $h ?>px" controls="controls" preload="auto">
- <source src="<?php echo $iosUrl ?>" type="video/mp4"/>
- </video>
- <?php
- } else {
- $rtmpHost = "rtmp://$rtmpHost/$appName";
- if ($quanlity == "FullHD" || $quanlity == "FullHD-HD") {
- $rtmpFile['1080p'] = ",mp4:" . trim($fileName) . '.1080p';
- } else {
- $rtmpFile['1080p'] = "";
- }
- if ($quanlity == "SD" || $quanlity == "TS" || $quanlity == "SDHD") {
- $rtmpFile['360p'] = ",mp4:" . trim($fileName) . '.360p';
- } else {
- $rtmpFile['360p'] = "";
- }
- if ($quanlity == "HD" || $quanlity == "SDHD" || $quanlity == "FullHD-HD") {
- $rtmpFile['720p'] = ",mp4:" . trim($fileName) . '.720p';
- } else {
- $rtmpFile['720p'] = "";
- }
- if ($quanlity == "clip") {
- $rtmpFile['480p'] = ",mp4:" . trim($fileName) . '.480p';
- } else {
- $rtmpFile['480p'] = "";
- }
- if($_GET['p']=="livetv") $isLive="isLive=true";else $isLive="isLive=false";
- $mediaPath = "mediaPathUrl=$rtmpHost{$rtmpFile['360p']}{$rtmpFile['480p']}{$rtmpFile['720p']}{$rtmpFile['1080p']}";
- $s = "mediafilm" . (strlen($url) + 6);
- ?>
- <object width="<?php echo $w ?>" height="<?php echo $h ?>" type="application/x-shockwave-flash" id="smartplayer" data="player/smartplayer.swf?v=2508" style="background:#000">
- <param name="menu" value="false">
- <param name="movie" value="player/smartplayer.swf?v=2508" />
- <param name="scale" value="default">
- <param name="allowFullscreen" value="true">
- <param name="allowScriptAccess" value="always">
- <param name="salign" value="tl">
- <param name="wmode" value="transparent" />
- <param name="bgcolor" value="#000000">
- <param name="flashvars" value="configUrl=player/config.xml&logoImage=player/resources/images/non_logo.png&playerWidth=<?php echo $w ?>&playerHeight=<?php echo $h ?>&secureTokenUrl=<?php echo BASE_NAME ?>player/config.sub&introXmlUrl=<?php echo $url ?>&s=<?php echo $s ?>&subUrl=<?php echo $suburl == "" ? "," : $suburl ?>&trailerPathUrl=<?php echo $trailer ?>&nextUrl=<?php echo $nextEpisode ?>&autoPlay=<?php echo $isPlay; ?>&isSingleFilm=<?php echo $nextEpisode != "" ? "false" : "true" ?>&isFullScreen=1&uid=&version=2508&<?php echo $isLive; ?>&<?php echo $mediaPath ?>">
- </object>
- <?php
- }
- }
- /* function loadVideo_admin($containerVideo, $flashDiv, $w, $h, $url, $suburl, $rtmpHost = '', $httpHost = '', $appName = '', $fileName = '', $quanlity = '', $trailer = '', $nextEpisode = '', $isPlay = "false") {
- $detect = new Mobile_Detect;
- $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
- if ($deviceType != "computer") {
- $iosUrl = "http://$httpHost/$appName/mp4:$fileName.720p/playlist.m3u8";
- ?>
- <video width="<?php echo $w ?>px" height="<?php echo $h ?>px" controls="controls" preload="auto">
- <source src="<?php echo $iosUrl ?>" type="video/mp4"/>
- </video>
- <?php
- } else {
- $rtmpHost = "rtmp://$rtmpHost/$appName";
- if ($quanlity == "FullHD" || $quanlity == "FullHD-HD") {
- $rtmpFile['1080p'] = ",mp4:" . trim($fileName) . '.1080p';
- } else {
- $rtmpFile['1080p'] = "";
- }
- if ($quanlity == "SD" || $quanlity == "TS" || $quanlity == "SDHD") {
- $rtmpFile['360p'] = ",mp4:" . trim($fileName) . '.360p';
- } else {
- $rtmpFile['360p'] = "";
- }
- if ($quanlity == "HD" || $quanlity == "SDHD" || $quanlity == "FullHD-HD") {
- $rtmpFile['720p'] = ",mp4:" . trim($fileName) . '.720p';
- } else {
- $rtmpFile['720p'] = "";
- }
- if ($quanlity == "clip") {
- $rtmpFile['480p'] = ",mp4:" . trim($fileName) . '.480p';
- } else {
- $rtmpFile['480p'] = "";
- }
- $isLive="isLive=true";
- $mediaPath = "mediaPathUrl=$rtmpHost{$rtmpFile['360p']}{$rtmpFile['480p']}{$rtmpFile['720p']}{$rtmpFile['1080p']}";
- ?>
- <object width="<?php echo $w ?>" height="<?php echo $h ?>" type="application/x-shockwave-flash" id="smartplayer" data="adcp/player/smartplayer.swf?v=1908" style="background:#000">
- <param name="menu" value="false">
- <param name="movie" value="adcp/player/smartplayer.swf?v=1908" />
- <param name="scale" value="default">
- <param name="allowFullscreen" value="true">
- <param name="allowScriptAccess" value="always">
- <param name="salign" value="tl">
- <param name="wmode" value="transparent" />
- <param name="bgcolor" value="#000000">
- <param name="flashvars" value="configUrl=adcp/player/config.xml&logoImage=adcp/player/resources/images/non_logo.png&playerWidth=<?php echo $w ?>&playerHeight=<?php echo $h ?>&introXmlUrl=<?php echo $url ?>&subUrl=<?php echo $suburl == "" ? "," : $suburl ?>&trailerPathUrl=<?php echo $trailer ?>&nextUrl=<?php echo $nextEpisode ?>&autoPlay=true&isFullScreen=1&uid=&version=2008&<?php echo $isLive; ?>&<?php echo $mediaPath ?>">
- </object>
- <?php
- }
- }*/
- function loadVideo_admin($containerVideo, $flashDiv, $w, $h, $url, $suburl, $rtmpHost = '', $httpHost = '', $appName = '', $fileName = '', $quanlity = '', $trailer = '', $nextEpisode = '', $isPlay = "false") {
- $detect = new Mobile_Detect;
- $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
- if ($deviceType != "computer") {
- $iosUrl = "http://$httpHost/$appName/mp4:$fileName.720p/playlist.m3u8";
- ?>
- <video width="<?php echo $w ?>px" height="<?php echo $h ?>px" controls="controls" preload="auto">
- <source src="<?php echo $iosUrl ?>" type="video/mp4"/>
- </video>
- <?php
- } else {
- $rtmpHost = "rtmp://$rtmpHost/$appName";
- if ($quanlity == "FullHD" || $quanlity == "FullHD-HD") {
- $rtmpFile['1080p'] = ",mp4:" . trim($fileName) . '.1080p';
- } else {
- $rtmpFile['1080p'] = "";
- }
- if ($quanlity == "SD" || $quanlity == "TS" || $quanlity == "SDHD") {
- $rtmpFile['360p'] = ",mp4:" . trim($fileName) . '.360p';
- } else {
- $rtmpFile['360p'] = "";
- }
- if ($quanlity == "HD" || $quanlity == "SDHD" || $quanlity == "FullHD-HD") {
- $rtmpFile['720p'] = ",mp4:" . trim($fileName) . '.720p';
- } else {
- $rtmpFile['720p'] = "";
- }
- if ($quanlity == "clip") {
- $rtmpFile['480p'] = ",mp4:" . trim($fileName) . '.480p';
- } else {
- $rtmpFile['480p'] = "";
- }
- if($_GET['p']=="livetv") $isLive="isLive=true";else $isLive="isLive=false";
- $mediaPath = "mediaPathUrl=$rtmpHost{$rtmpFile['360p']}{$rtmpFile['480p']}{$rtmpFile['720p']}{$rtmpFile['1080p']}";
- ?>
- <object width="<?php echo $w ?>" height="<?php echo $h ?>" type="application/x-shockwave-flash" id="smartplayer" data="adcp/player/smartplayer.swf?v=2907" style="background:#000">
- <param name="menu" value="false">
- <param name="movie" value="adcp/player/smartplayer.swf?v=2907" />
- <param name="scale" value="default">
- <param name="allowFullscreen" value="true">
- <param name="allowScriptAccess" value="always">
- <param name="salign" value="tl">
- <param name="wmode" value="transparent" />
- <param name="bgcolor" value="#000000">
- <param name="flashvars" value="configUrl=adcp/player/config.xml&logoImage=adcp/player/resources/images/non_logo.png&playerWidth=<?php echo $w ?>&playerHeight=<?php echo $h ?>&secureTokenUrl=<?php echo BASE_NAME ?>adcp/player/config.sub&introXmlUrl=<?php echo $url ?>&s=&subUrl=<?php echo $suburl == "" ? "," : $suburl ?>&trailerPathUrl=<?php echo $trailer ?>&nextUrl=<?php echo $nextEpisode ?>&autoPlay=<?php echo $isPlay; ?>&isFullScreen=1&uid=&version=2907&<?php echo $isLive; ?>&<?php echo $mediaPath ?>">
- </object>
- <?php
- }
- }
- function loadVideo_V2_small($containerVideo, $flashDiv, $w, $h, $url, $suburl, $rtmpHost = '', $httpHost = '', $appName = '', $fileName = '', $quanlity = '', $trailer = '', $nextEpisode = '', $isPlay = "false") {
- $detect = new Mobile_Detect;
- $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
- if ($deviceType != "computer") {
- $iosUrl = "http://$httpHost/$appName/mp4:$fileName.720p/playlist.m3u8";
- ?>
- <video width="<?php echo $w ?>px" height="<?php echo $h ?>px" controls="controls" preload="auto">
- <source src="<?php echo $iosUrl ?>" type="video/mp4"/>
- </video>
- <?php
- } else {
- $rtmpHost = "rtmp://$rtmpHost/$appName";
- if ($quanlity == "FullHD" || $quanlity == "FullHD-HD") {
- $rtmpFile['1080p'] = ",mp4:" . trim($fileName) . '.1080p';
- } else {
- $rtmpFile['1080p'] = "";
- }
- if ($quanlity == "SD" || $quanlity == "TS" || $quanlity == "SDHD") {
- $rtmpFile['360p'] = ",mp4:" . trim($fileName) . '.360p';
- } else {
- $rtmpFile['360p'] = "";
- }
- if ($quanlity == "HD" || $quanlity == "SDHD" || $quanlity == "FullHD-HD") {
- $rtmpFile['720p'] = ",mp4:" . trim($fileName) . '.720p';
- } else {
- $rtmpFile['720p'] = "";
- }
- if ($quanlity == "clip") {
- $rtmpFile['480p'] = ",mp4:" . trim($fileName) . '.480p';
- } else {
- $rtmpFile['480p'] = "";
- }
- if($_GET['p']=="livetv") $isLive="isLive=true";else $isLive="isLive=false";
- $mediaPath = "mediaPathUrl=$rtmpHost{$rtmpFile['360p']}{$rtmpFile['480p']}{$rtmpFile['720p']}{$rtmpFile['1080p']}";
- ?>
- <object width="<?php echo $w ?>" height="<?php echo $h ?>" type="application/x-shockwave-flash" id="smartplayer" data="player_small/smartplayer.swf?v=1808" style="background:#000">
- <param name="menu" value="false">
- <param name="movie" value="player_small/smartplayer.swf?v=1808" />
- <param name="scale" value="default">
- <param name="allowFullscreen" value="true">
- <param name="allowScriptAccess" value="always">
- <param name="salign" value="tl">
- <param name="wmode" value="transparent" />
- <param name="bgcolor" value="#000000">
- <param name="flashvars" value="configUrl=player_small/config.xml&logoImage=player_small/resources/images/non_logo.png&playerWidth=<?php echo $w ?>&playerHeight=<?php echo $h ?>&introXmlUrl=<?php echo $url ?>&subUrl=<?php echo $suburl == "" ? "," : $suburl ?>&trailerPathUrl=<?php echo $trailer ?>&nextUrl=<?php echo $nextEpisode ?>&autoPlay=<?php echo $isPlay; ?>&isFullScreen=1&uid=&version=1808&<?php echo $isLive; ?>&<?php echo $mediaPath ?>">
- </object>
- <?php
- }
- }
- //indicator
- function getIndicator() {
- global $mod;
- require 'nusoap/nusoap.php';
- require 'wsdl/ws_function.php';
- $rs = ws_indicator();
- if (stripos($rs, "Error") !== false) {
- $filename = "indicator_IP.txt";
- if (is_writable($filename)) {
- if (!$handle = fopen($filename, 'a')) {
- echo "Cannot open file ($filename)";
- exit;
- }
- if (fwrite($handle, $_SERVER['REMOTE_ADDR'] . " ($rs) (" . date('d-m-Y H:i:s', time()) . ")\n") === FALSE) {
- echo "Cannot write to file ($filename)";
- exit;
- }
- fclose($handle);
- } else {
- echo "The file $filename is not writable";
- exit;
- }
- header("Location:" . BASE_NAME . "redirect/");
- }
- else
- return $rs;
- }
- //indicator
- function getIndicator_service($del = null) {
- global $mod, $cache_time;
- $test = $_SERVER['REMOTE_ADDR'];
- $t = explode(", ", $test);
- if (!empty($t[1])) {
- $remote_add = $t[1];
- } else {
- $remote_add = $_SERVER['REMOTE_ADDR'];
- }
- $indicator = Cache::get('i_' . $remote_add);
- //$indicator = FALSE;
- if ($indicator === FALSE) {
- require_once('nusoap/nusoap.php');
- $wsdl = "http://indicator.hayhaytv.vn/API/indicator_api_mem.php?wsdl";
- $client = new nusoap_client($wsdl, 'wsdl');
- if ($del == "deletecache") {
- $param = array($remote_add, "deletecache");
- $val = $client->call('GetLink', $param);
- $mod->redirect("index.php");
- } else {
- $param = array($remote_add, "wsencrypt");
- }
- $val = $client->call('GetLink', $param);
- $indicator = $val;
- Cache::set('i_' . $remote_add, $val, TRUE, $cache_time['level_05']);
- }
- return $indicator;
- }
- //indicator
- function getIndicatorVIP_service($del = null) {
- global $mod, $cache_time;
- $test = $_SERVER['REMOTE_ADDR'];
- $t = explode(", ", $test);
- if (!empty($t[1])) {
- $remote_add = $t[1];
- } else {
- $remote_add = $_SERVER['REMOTE_ADDR'];
- }
- $indicator = Cache::get('i_vip_' . $remote_add);
- //$indicator = FALSE;
- if ($indicator === FALSE) {
- require_once('nusoap/nusoap.php');
- $wsdl = "http://indicator.hayhaytv.vn/API/indicator_api_mem_vip.php?wsdl";
- $client = new nusoap_client($wsdl, 'wsdl');
- if ($del == "deletecache") {
- $param = array($remote_add, "deletecache");
- $val = $client->call('GetLink', $param);
- $mod->redirect("index.php");
- } else {
- $param = array($remote_add, "wsencrypt");
- }
- $val = $client->call('GetLink', $param);
- $indicator = $val;
- Cache::set('i_vip_' . $remote_add, $val, TRUE, $cache_time['level_05']);
- }
- return $indicator;
- }
- //indicator
- function getIndicator_allow_ip($del = null) {
- global $mod, $cache_time;
- $test = $_SERVER['REMOTE_ADDR'];
- $t = explode(", ", $test);
- if (!empty($t[1])) {
- $remote_add = $t[1];
- } else {
- $remote_add = $_SERVER['REMOTE_ADDR'];
- }
- $indicator = Cache::get('i_deny_' . $remote_add);
- //$indicator = FALSE;
- if ($indicator === FALSE) {
- require_once('nusoap/nusoap.php');
- $wsdl = "http://indicator.hayhaytv.vn/API/indicator_allow_ip.php?wsdl";
- $client = new nusoap_client($wsdl, 'wsdl');
- $param = array($remote_add, "wsencrypt");
- $val = $client->call('GetLink', $param);
- $indicator = $val;
- if($val == "0" || $val == "1"){
- Cache::set('i_deny_' . $remote_add, $val, TRUE, $cache_time['level_05']);
- }
- }
- return $indicator;
- }
- //indicator
- function getBalance_service($uid) {
- global $mod, $cache_time;
- $paramMT['UserID'] = $uid;
- $paramMT['token_key'] = TOKEN_PAYMENT;
- require_once('nusoap/nusoap.php');
- $wsdl = 'http://billing.hayhaytv.vn/charge/hayhaytv_api.php?wsdl';
- $client = new nusoap_client($wsdl, 'wsdl');
- $rs = $client->call('MOGetBalanceID', $paramMT);
- unset($client);
- return $rs;
- }
- function loadVideo_V3($containerVideo, $flashDiv, $w, $h, $url, $subs, $rtmpHost = '', $httpHost = '', $appName = '', $fileName = '', $quanlity = '', $trailer = '', $nextEpisode = '', $isPlay = "false") {
- $rtmpHost = "rtmp://$rtmpHost/$appName/";
- if ($quanlity == "FullHD" || $quanlity == "FullHD-HD") {
- $rtmpFile['1080p'] = trim($fileName) . '.1080p.mp4';
- } else {
- $rtmpFile['1080p'] = "";
- }
- if ($quanlity == "SD" || $quanlity == "TS" || $quanlity == "SDHD") {
- $rtmpFile['360p'] = trim($fileName) . '.360p.mp4';
- } else {
- $rtmpFile['360p'] = "";
- }
- if ($quanlity == "HD" || $quanlity == "SDHD" || $quanlity == "FullHD-HD") {
- $rtmpFile['720p'] = trim($fileName) . '.720p.mp4';
- } else {
- $rtmpFile['720p'] = "";
- }
- if ($quanlity == "clip") {
- $rtmpFile['480p'] = trim($fileName) . '.480p.mp4';
- } else {
- $rtmpFile['480p'] = "";
- }
- if($_GET['p']=="livetv") $isLive="isLive=true";else $isLive="isLive=false";
- $mediaPath = "$rtmpHost{$rtmpFile['360p']}{$rtmpFile['480p']}{$rtmpFile['720p']}{$rtmpFile['1080p']}";
- if(strpos($trailer, ',mp4:') !== FASLE){
- $trailer = str_replace(',mp4:', '/', $trailer) . ".mp4";
- }
- ?>
- <script type="text/javascript">
- var initVideoUrl = "<?php echo $mediaPath?>"; // Link chính thức của video
- var initTrailerUrl = '<?php echo $trailer?>';
- var adsXMLUrl = "<?php echo $url?>?t=<?php echo time()?>";
- // var adsXMLUrl = "http://live.hayhaytv.vn/new_player/ads.xml";
- var imageSrc = "";//background image cho player
- var videoSubs = [
- <?php if ($subs):
- $default = TRUE;
- foreach ($subs as $lang => $sub_file) :
- if(!empty($sub_file)) :
- if(!$default)
- echo ',';
- ?>
- {
- file: "<?php echo $sub_file?>",
- label: "<?php echo $lang?>",
- kind: "captions",
- encoded: "<?php echo substr($sub_file, -3) == 'srt' ? 'false' : 'true' ?>",
- "default": <?php echo $default ? 'true' : 'false'?>
- }
- <?php
- $default = !$default;
- endif;
- endforeach;
- endif;
- ?>
- ];
- var defaultObj = {duration: -1
- , position: 0
- , buffered: 0
- , fileSrc: ""
- , imageSrc: ""
- , userId : "-1" // User ID
- , isError: false
- , volume: 100
- , playerWidth: 960
- , playerHeight: 482
- };
- var playerInfo = defaultObj;
- var ready = false;
- </script>
- <?php
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement