Update : pakplayer

Added : Pakplayer Embed option with configs
This commit is contained in:
Arslan Hassan 2011-01-22 18:02:45 +00:00
parent 7f1c596da6
commit 5467baa49c
6 changed files with 46 additions and 103 deletions

View file

@ -25,7 +25,8 @@ if(isset($_POST['update'])){
'logo_placement',
'use_playlist',
'youtube_enabled',
'embed_player_height',
'embed_player_width','autoplay_embed'
);
//Checking for logo

View file

@ -67,6 +67,27 @@
<input type="radio" name="youtube_enabled" value="no" id="youtube_enabled" {if $row.youtube_enabled=='no'} checked="checked"{/if} />
No</label></td>
</tr>
<tr>
<td valign="top"><strong>Embed Player Width</strong><br />
Enter embedable player width in pixels</td>
<td valign="top"><label for="embed_player_width"></label>
<input name="embed_player_width" type="text" id="embed_player_width" value="{$row.embed_player_width}" /></td>
</tr>
<tr>
<td valign="top"><strong>Embed Player Height</strong><br />
Enter embedable player width in pixels</td>
<td valign="top"><label for="embed_player_width"></label>
<input name="embed_player_height" type="text" id="textfield" value="{$row.embed_player_height}" /></td>
</tr>
<tr>
<td valign="top"><strong>Autoplay Embed</strong><br />
Autoplay embeded video by default</td>
<td valign="top"> <label>
<input type="radio" name="autoplay_embed" value="yes" id="autoplay_embed0" {if $row.autoplay_embed=='yes'} checked="checked"{/if} />
Yes</label>
<label><input type="radio" name="autoplay_embed" value="no" id="autoplay_embed1" {if $row.autoplay_embed=='no'} checked="checked"{/if} />
No</label></td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top">&nbsp;</td>

View file

@ -361,8 +361,8 @@ if(phpversion() < '5.2.0')
//Enable youtube videos
define("YOUTUBE_ENABLED",$row['youtube_enabled']);
define("EMBED_VDO_WIDTH","480");
define("EMBED_VDO_HEIGHT","385");
define("EMBED_VDO_WIDTH",$row['embed_player_width']);
define("EMBED_VDO_HEIGHT",$row['embed_player_height']);
include 'plugin.functions.php';
include 'plugins_functions.php';

View file

@ -133,102 +133,7 @@ if(!function_exists("pak_player"))
*/
function pakplayer_embed_src($vdetails)
{
//Checking for YT Referal
$ref = $vdetails['refer_url'];
//Checking for youtube
if(function_exists('is_ref_youtube'))
$ytcom = is_ref_youtube($ref);
if($ytcom)
$is_youtube = true;
else
$is_youtube = false;
if($is_youtube)
{
preg_match("/\?v\=(.*)/",$ref,$srcs);
$srcs = explode("&",$srcs[1]);
$srcs = $srcs[0];
$srcs = explode("?",$srcs);
$ytcode = $srcs[0];
}
$key = config('pak_license');
$placement = config('logo_placement');
switch($placement)
{
case "tl":
define('logo_top','5');
define('logo_left','5');
define('logo_position','"top":5,"left":5');
break;
case "tr":
define('logo_top','5');
define('logo_right','5');
define('logo_position','"top":5,"right":5');
break;
case "br":
define('logo_bottom','5');
define('logo_right','5');
define('logo_position','"bottom":5,"right":5');
break;
case "bl":
define('logo_bottom','5');
define('logo_left','5');
define('logo_position','"bottom":5,"left":5');
break;
}
if(!$key)
$player = PAK_PLAYER_URL.'/pak_player.swf?config=';
else
$player = PAK_PLAYER_URL.'/pak_player.unlimited.swf?config=';
$code = "";
$code .= '{';
if($key)
$code .= '"key":"'.$key.'",';
//adding file
if(!$is_youtube)
$code .= '"clip":{"url":"'.get_video_file($vdetails,false,true).'","scaling":"fit"}';
else
$code .= '"clip":{"url":"api:'.$ytcode.'","provider":"youtube","urlResolvers":"youtube"}';
//adding canvas link to video
$code .= ',"canvas":{"linkUrl":"'.videoLink($vdetails).'"}';
//Adding Pluginser
$code .= ',"plugins":{';
//addgin skin
$code .= '"controls":{"background":"url('.PAK_PLAYER_URL.'/bg.png) repeat","url":"pak_player.controls.swf"}';
//Checking for youtube
if($is_youtube)
$code .= ',"youtube":{"url":"'.PAK_PLAYER_URL.'/pak_player.youtube.swf","enableGdata":"true"}';
///Canvas
//$code .= ',"canvas":{"backgroundGradient":"none","backgroundColor":"#000000"}';
//Finishg Plugin
$code .= '}';
if($key)
{
$code .= ',"logo":{"url":"'.website_logo().'","fullscreenOnly":false,'.logo_position.',"linkUrl":"'.BASEURL.'"}';
}
//adding branding
//Finishing Player config
$code .= '}';
$final_code = $player.urlencode($code);
$embedCode .= '<object width="'.EMBED_VDO_WIDTH.'" height="'.EMBED_VDO_HEIGHT.'">';
$embedCode .= '<param name="movie" value="'.$final_code.'"></param>';
$embedCode .= '<param name="allowFullScreen" value="true"></param>';
$embedCode .= '<param name="allowscriptaccess" value="always"></param>';
$embedCode .= '<embed src="'.$final_code.'"';
assign('embedFinalCode',$final_code);
$embedCode .= 'type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'.EMBED_VDO_WIDTH.'" height="'.EMBED_VDO_HEIGHT.'"></embed>';
return $embedCode .= '</object>';
return ' ';
}
register_embed_function('pakplayer_embed_src');
register_actions_play_video('pak_player');

View file

@ -2,6 +2,12 @@
href="{$normal_vid_file}"
style="display:block;width:{$player_data.width}; height:{$player_data.height}"
id="the_Video_Player">
{if !$player_data.autoplay}
<div align="center" style="background-color:#222; height:100%; vertical-align:middle; position:relative">
<img src="{getThumb vdetails=$vdata num=big}" style=" height:100%" />
<img src="{$pak_player_url}/play.png" style="position:absolute; top:50%; left:50%; margin:-42px 0px 0px -42px; z-index:100"/>
</div>
{/if}
</a>
@ -98,9 +104,7 @@ flowplayer("the_Video_Player", "{$pak_player_url}/pakplayer{if $Cbucket->configs
clip:
{
{/literal}
autoPlay :false,
title : "some title goes herer",
autoPlay :true,
{if $youtube}
url : 'api:{$ytcode}',
provider : 'youtube',
@ -136,5 +140,16 @@ flowplayer("the_Video_Player", "{$pak_player_url}/pakplayer{if $Cbucket->configs
});
$(document).ready(function(){ flowplayer('the_Video_Player').embed({autoPlay:true}); var embedCode = flowplayer('the_Video_Player').getEmbedCode();
$('#embed_code').val(htmlDecode(embedCode));
$('#embed_code').val( $('#embed_code').val().replace(/\"autoPlay\":false/g,'"autoPlay":true') );
});
function htmlDecode(value){
return $('<div/>').html(value).text();
}
{/literal}
</script>

File diff suppressed because one or more lines are too long