Exemplo n.º 1
0
 /**
  * This function generates src for embedable link
  * which can be used in OBJECT tag to embed videos on a website
  *
  * @param video details
  * @return src link
  */
 function cbplayer_embed_src($vdetails)
 {
     $config = urlencode(BASEURL . "/player/" . CB_PLAYER . "/embed_player.php?vid=" . $vdetails['videoid'] . "&autoplay=" . config('autoplay_embed'));
     $embed_src = BASEURL . '/player/' . CB_PLAYER . '/player.swf?config=' . $config;
     if (function_exists('get_refer_url_from_embed_code')) {
         $ref_details = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code'])));
         $ytcode = $ref_details['ytcode'];
     }
     if (!$vdetails['embed_code'] || $vdetails['embed_code'] == 'none' || $ytcode) {
         $code = '<embed src="' . $embed_src . '" type="application/x-shockwave-flash"';
         $code .= 'allowscriptaccess="always" allowfullscreen="true"  ';
         $code .= 'width="' . config("embed_player_width") . '" height="' . config("embed_player_height") . '"></embed>';
         return $code;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 /**
  * Function used to play embed code
  * @param Video details
  */
 function play_embed_video($data)
 {
     global $swfobj;
     $vdetails = $data['vdetails'];
     $file = get_video_file($vdetails, false, false);
     if (!$file || $file == 'no_video.flv') {
         if (!empty($vdetails['embed_code']) && $vdetails['embed_code'] != 'none') {
             $embed_code = $vdetails['embed_code'];
             //Replacing Height And Width
             $h_w_p = array("{Width}", "{Height}");
             $h_w_r = array($data['width'], $data['height']);
             $embed_code = str_replace($h_w_p, $h_w_r, $embed_code);
             $embed_code = unhtmlentities($embed_code);
             $embed_code = preg_replace('/<b>(.*<\\/b>)?/', '', $embed_code);
             //Checking for REF CODE , if its youtube, add AUTOPLAY accordingly)
             $ref = get_refer_url_from_embed_code($embed_code);
             if (!empty($ref) && $ref['website'] == "youtube") {
                 //Add AutoPlay
                 if (config("autoplay_video") == "yes") {
                     $autoplay = 1;
                 } else {
                     $autoplay = 0;
                 }
                 $embed_code = preg_replace("/src=\"(.*)\"/Ui", "src=\"\$1&autoplay=" . $autoplay . "\"", $embed_code);
             }
             preg_match('/http:\\/\\/www\\.youtube\\.com\\/v\\/([a-zA-Z0-9_-]+)/', $embed_code, $ytmatches);
             $ytCode = $ytmatches[1];
             if (!$ytCode) {
                 preg_match('/http:\\/\\/www\\.youtube\\.com\\/embed\\/([a-zA-Z0-9_-]+)/', $embed_code, $ytmatches);
                 $ytCode = $ytmatches[1];
             }
             if (YOUTUBE_ENABLED == 'yes' && $ytCode) {
                 assign('youtube', $ytCode);
                 assign('ytcode', $ytCode);
                 return false;
             }
             echo $embed_code;
             return true;
             //$swfobj->EmbedCode($embed_code,$data['player_div']);
             //return $swfobj->code;
         }
     } else {
         return false;
     }
 }
Exemplo n.º 3
0
 /**
  * Function used to check embed video
  * if video is embeded , it will check its code 
  * if everthing goes ok , it will change its status to successfull
  * @param VID
  */
 function embed_video_check($vid)
 {
     global $myquery, $db;
     if (is_array($vid)) {
         $vdetails = $vid;
     } else {
         $vdetails = $myquery->get_video_details($vid);
     }
     if (!empty($vdetails['embed_code']) && $vdetails['embed_code'] != ' ' && $vdetails['embed_code'] != 'none') {
         //Parsing Emebd Codek, Getting Referal URL if possible and add AUTPLAY on of option
         $ref_url = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code'])));
         $ref_url = $ref_url['url'];
         $db->update(tbl("video"), array("status", "refer_url"), array('Successful', $ref_url), " videoid='{$vid}'");
     }
 }
Exemplo n.º 4
0
$vid = $_GET['vid'];
//gettin video details
$vdetails = get_video_details($vid);
if (!$vdetails) {
    exit(json_encode(array("err" => "no video details found")));
}
header('Content-Type: text/xml');
$video = $vdetails;
//Loading video files
$vid_file = get_video_file($vdetails, true, true);
$hd_file = get_hq_video_file($vdetails, false);
/* Checking for youtube */
$ref = $video['refer_url'];
//Trying other method
if (function_exists('get_refer_url_from_embed_code')) {
    $ref_details = get_refer_url_from_embed_code(unhtmlentities(stripslashes($video['embed_code'])));
    $ytcode = $ref_details['ytcode'];
}
?>
<config>

  <?php 
if (!$ytcode) {
    ?>
  <file><?php 
    echo $vid_file;
    ?>
</file>
  <?php 
} else {
    ?>
Exemplo n.º 5
0
 function html5_player($in)
 {
     global $html5_player;
     $html5_player = true;
     $vdetails = $in['vdetails'];
     $video_play = get_video_files($vdetails, true, true);
     if (function_exists('get_refer_url_from_embed_code')) {
         $ref_details = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code'])));
         $ytcode = $ref_details['ytcode'];
     }
     if ($video_play || $ytcode) {
         $hd = $data['hq'];
         if ($hd == 'yes') {
             $file = get_hq_video_file($vdetails);
         } else {
             $file = get_video_files($vdetails, true, true);
         }
         $hd_file = get_hq_video_file($vdetails);
         if ($ytcode) {
             assign('youtube', true);
             assign('ytcode', $ytcode);
         }
         if (!strstr($in['width'], "%")) {
             $in['width'] = $in['width'] . 'px';
         }
         if (!strstr($in['height'], "%")) {
             $in['height'] = $in['height'] . 'px';
         }
         // Allowing CB defalut player settings to Html5player
         if ($in['autoplay'] == 'yes') {
             assign('autoplay', 'true');
         }
         if ($in['player_logo_url']) {
             $player_logo_url = $in['player_logo_url'];
             assign('product_link', $player_logo_url);
         }
         assign('vdata', $vdetails);
         assign('height', $in['height']);
         assign('width', $in['width']);
         $l_details = BASEURL . '/images/icons/country/hp-cb.png';
         $l_convert = base64_encode(file_get_contents($l_details));
         assign('display', $l_convert);
         //Enable disable enlarge/smaal button
         $enlarge_button = $in['enlarge_button'];
         if (THIS_PAGE == 'watch_video' && $enlarge_button == 'yes') {
             assign('enlarge_small', 'true');
         } else {
             assign('enlarge_small', 'false');
         }
         assign('about', BASEURL);
         $jquery = BASEDIR . '/js/jquery.js';
         assign('jquery', $jquery);
         // logo placement
         $pos = config('logo_placement');
         switch ($pos) {
             case "tl":
                 $position = array("top" => '5px', "left" => '5px', "bottom" => '', "right" => '');
                 break;
             case "tr":
                 $position = array("top" => '5px', "left" => '', "bottom" => '', "right" => '5px');
                 break;
             case "br":
                 $position = array("top" => '', "left" => '', "bottom" => '5px', "right" => '5px');
                 break;
             case "bl":
                 $position = array("top" => '', "left" => '5px', "bottom" => '5px', "right" => '');
                 break;
         }
         assign('top', $position["top"]);
         assign('left', $position["left"]);
         assign('bottom', $position["bottom"]);
         assign('right', $position["right"]);
         assign('username', $username);
         assign('title', $title);
         assign('thumb', $default_thumb);
         assign('key', $videokey);
         assign('has_hq', $has_hq);
         assign('player_data', $in);
         // setting flash player fallback for Flashplayer Videos
         $ext = getExt($video_play[0]);
         if ($ext == 'flv') {
             assign('player_data', $in);
             assign('cb_skin', 'glow/glow.xml');
             assign('player_url', PLAYER_URL);
             assign('flashplayer', true);
         }
         if (!is_array($video_play)) {
             assign('normal_vid_file', $video_play);
             assign('application_videos', true);
         } else {
             if ($video_play[0]) {
                 $quality = get_quality($video_play[0]);
                 if ($quality == 'hd' || $quality == 'sd') {
                     assign('application_videos', true);
                     if ($video_play[1] == '') {
                         assign('normal_vid_file', $video_play[0]);
                         assign('hq_vid_file', '');
                     } else {
                         assign('normal_vid_file', $video_play[1]);
                         assign('hq_vid_file', $video_play[0]);
                         assign('HQ', true);
                     }
                 } else {
                     $video_play = process_app_videos($video_play);
                     $json_array = json_encode($video_play);
                     assign('json_videos', $json_array);
                     $video_play = array_reverse($video_play, true);
                     assign('ms_videos', $video_play);
                 }
             } else {
                 $json_array = json_encode($video_play);
                 assign('json_videos', $json_array);
                 $video_play = array_reverse($video_play, true);
                 assign('ms_videos', $video_play);
             }
         }
         if (CB_HTML5_PLAYER_SETTINGS == 'installed') {
             $html5_configs = get_html5_configs();
             $iv_logo_enable = $html5_configs['iv_logo_enable'];
             if ($iv_logo_enable == 'yes') {
                 $ov_details = BASEURL . '/images/icons/country/ov.png';
                 $ov_convert = base64_encode(file_get_contents($ov_details));
                 assign('ov', $ov_convert);
             }
             assign('iv_logo_enbale', $iv_logo_enable);
         }
         Template(HTML5_PLAYER_DIR . '/html5_player.html', false);
         return true;
     }
 }
Exemplo n.º 6
0
 function embed_video_src($params)
 {
     $pseudo_streaming = false;
     $ppfile = 'pakplayer.swf';
     if (config('pak_license')) {
         $ppfile = 'pakplayer.unlimited.swf';
     }
     $video = $params['video'];
     $array = array();
     $plugins['controls']['url'] = BASEURL . '/player/pak_player/pakplayer.controls.swf';
     $plugins['controls']['background'] = 'url(' . BASEURL . '/player/pak_player/bg.png) repeat';
     $canvas['backgroundColor'] = "#000000";
     $canvas['backgroundGradient'] = "none";
     /* Checking for youtube */
     $ref = $video['refer_url'];
     //Trying other method
     if (function_exists('get_refer_url_from_embed_code')) {
         $ref_details = get_refer_url_from_embed_code(unhtmlentities(stripslashes($video['embed_code'])));
         $ytcode = $ref_details['ytcode'];
     }
     if ($ytcode) {
         $plugins['youtube']['url'] = BASEURL . '/player/pak_player/pakplayer.youtube.swf';
         $plugins['youtube']['enableGdata'] = true;
         $clip['url'] = 'api:' . $ytcode;
         $clip['provider'] = 'youtube';
         $clip['urlResolvers'] = 'youtube';
     } else {
         if (config('pseudostreaming') == 'yes') {
             $plugins['pseudo']['url'] = BASEURL . '/player/pak_player/pakplayer.pseudo.swf';
             $clip['provider'] = 'pseudo';
             $pseudo_streaming = true;
         }
         $clip['url'] = get_video_file($video, true, true);
     }
     /* End Checking Youtube */
     // Setting AutoPlay
     if ($_GET['autoplay']) {
         $autoplay = $_GET['autoplay'];
     } else {
         $autoplay = $_GET['autoplay_embed'];
     }
     if ($autoplay == 'yes') {
         $autoplay = true;
     } else {
         $autoplay = false;
     }
     $clip['scaling'] = 'fit';
     $clip['autoPlay'] = $autoplay;
     $clip['linkUrl'] = videoLink($video);
     $clip['linkWindow'] = '_blank';
     $logo['url'] = website_logo();
     $logo['fullscreenOnly'] = false;
     $logoPlace = config('logo_placement');
     $padding = config('logo_padding');
     switch ($logoPlace) {
         case "tr":
             $logo['top'] = $padding;
             $logo['right'] = $padding;
             break;
         case "tl":
             $logo['top'] = $padding;
             $logo['left'] = $padding;
             break;
         case "br":
             $logo['bottom'] = $padding;
             $logo['right'] = $padding;
             break;
         case "bl":
             $logo['bottom'] = $padding;
             $logo['left'] = $padding;
             break;
     }
     $logo['opacity'] = 0.4;
     $logo['linkUrl'] = videoLink($video);
     $array['key'] = config("pak_license");
     $array['plugins'] = $plugins;
     $array['canvas'] = $canvas;
     $array['clip'] = $clip;
     $array['contextMenu'][][config("pakplayer_contextmsg")] = "";
     $array['logo'] = $logo;
     if (!$params['only_configs']) {
         return BASEURL . '/player/pak_player/' . $ppfile . '?config=' . json_encode($array);
     } else {
         return json_encode($array);
     }
 }