How to integrate a standalone HD FLV Player in PHP Vibe?

This technical blog is a step-by-step guide that educates how to integrate HD FLV Player, a standalone video module, into a website developed using PHP Vibe video script.

What is HD FLV Player?
HD FLV Player is a simple flash video player developed by Apptha. This video player can be installed into any website, irrespective of the platform used to develop it and can be customized to any level. This video player is available in both free and premium packages.

What is PHP Vibe?
PHP Vibe is a video script developed for those who would like to create a video sharing portal, online channel or simply a video blog. PHP Vibe is arguably the best script for such requirements as it holds certain pre-loaded controls and features which contribute to the smart and easy management of video sharing websites.

For those who would like to integrate our standalone player in PHP Vibe please follow the steps given below.

Also Read: How to Speed Up Your Joomla Website

1) Open /moderator/players.php and find

<label class="radio inline"><input type="radio" name="choosen-player" value="3" <?php if(get_option('choosen-player') == 3 ) { echo "checked"; } ?>>jPlayer</label>

and replace with

<label class="radio inline"><input type="radio" name="choosen-player" value="3" <?php if(get_option('choosen-player') == 3 ) { echo "checked"; } ?>>jPlayer</label>
<label class="radio inline"><input type="radio" name="choosen-player" value="6" <?php if(get_option('choosen-player') == 6 ) { echo "checked"; } ?>>HD FLV Player</label>

Now find the following code in the same file

<label class="radio inline"><input type="radio" name="remote-player" value="3" <?php if(get_option('remote-player') == 3 ) { echo "checked"; } ?>>jPlayer</label>

and replace with

<label class="radio inline"><input type="radio" name="remote-player" value="3" <?php if(get_option('remote-player') == 3 ) { echo "checked"; } ?>>jPlayer</label>
<label class="radio inline"><input type="radio" name="remote-player" value="6" <?php if(get_option('remote-player') == 6 ) { echo "checked"; } ?>>HD FLV Player</label>

Find the following code in the same file

<label class="radio inline"><input type="radio" name="youtube-player" value="3" <?php if(get_option('youtube-player') == 3 ) { echo "checked"; } ?>>Easy Video Player</label>

and replace with

<label class="radio inline"><input type="radio" name="youtube-player" value="3" <?php if(get_option('youtube-player') == 3 ) { echo "checked"; } ?>>Easy Video Player</label>
<label class="radio inline"><input type="radio" name="youtube-player" value="4" <?php if(get_option('youtube-player') == 4 ) { echo "checked"; } ?>>HD FLV Player</label>

Find the following code in the same file

<div class="span3">
<input type="text" name="jwkey" value="<?php echo get_option('jwkey'); ?>"><span class="help-block align-right">Optional <strong>JwPlayer key</strong> (mostly if PRO)</span>
</div>

and replace with

<div class="span3">
<input type="text" name="jwkey" value="<?php echo get_option('jwkey'); ?>"><span class="help-block align-right">Optional <strong>JwPlayer key</strong> (mostly if PRO)</span>
</div>
<div class="span3">
<input type="text" name="hdflvkey" value="<?php echo get_option('hdflvkey'); ?>"><span class="help-block align-right">Optional <strong>HD FLV Player key</strong> (mostly if PRO)</span>
</div>

2) Open /com/com_video.php and find the code given below

//jPlayer
if((get_option('remote-player',1) == 3) || (get_option('choosen-player',1) == 3)) { add_filter( 'addplayers', 'jpsup' );

}

and place the following code next to the above mentioned code.

// HD FLV Player
if((get_option('remote-player',1) == 6) || (get_option('choosen-player',1) == 6)) {

add_filter( ‘addplayers’, ‘hdflvsup’ );
}

3) Open /lib/functions.php and find the code given below.

//JwPlayer
function jwplayersup($ini = ''){

$jp = '<script type="text/javascript" src="' . site_url() . 'lib/players/jwplayer/jwplayer.js"></script>';
if (get_option('jwkey')) { $jp .= '<script type="text/javascript">jwplayer.key="' . get_option('jwkey') . '";</script>';}
return $ini.$jp;
}

and place the following code next to the above mentioned code

function hdflvsup($ini = ''){
$jp = '';
if (get_option('hdflvkey')) { $jp .= '<script type="text/javascript">hdplayer.key="' . get_option('hdflvkey') . '";</script>';}
return $ini.$jp;
}

4) Open /lib/class.providers.php and find the code given below

public function _jwplayer($file,$thumb, $logo = null, $type=null) {
/** Switch jwplayer versions **/
if(get_option('jwp_version') == 5 ) {
return $this->_jwplayer5($file,$thumb, $logo, $type);
} else {
return $this->_jwplayer6($file,$thumb, $logo, $type);
}
}

and paste the following code next to the above mentioned code.

public function hdflvplayer ($file,$thumb, $logo = null, $type=null) {
$embed = '<script type="text/javascript" src="'.site_url().'lib/players/hdflvplayer/swfobject.js"></script>';
$embed .= '<div id="mediaspace">You need to have the <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> installed and a browser with JavaScript support.</div>';
$embed .= " <script type='text/javascript'>
var so = new SWFObject('".site_url()."lib/players/hdflvplayer/hdplayer.swf','mpl','".$this->width."','".$this->height."','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('file','".$file."');";
$embed .= " so.addVariable('preview','".$thumb."');
so.write('mediaspace');
</script>";
return $embed._ad('1');
}
  • Now find public function remotevideo($url) in the same file. Inside the function you’ll be able to find the code given below.
elseif ($choice == 5) {
$embedCode = $this->evplayer($url,thumb_fix($video->thumb),thumb_fix(get_option('player-logo')),$ext);
}

now paste the following code next to the code mentioned above.

elseif ($choice == 6) {
$embedCode = $this->hdflvplayer($url,thumb_fix($video->thumb),thumb_fix(get_option('player-logo')),$ext);
}
  • Find private function generateEmbedCode($videoProvider). Inside the function find the code given below.
elseif ($choice == 5) {
$embedCode = $this->evplayer($real_link,thumb_fix($video->thumb),thumb_fix(get_option('player-logo')),$ext);
}

and replace with

elseif ($choice == 5) {
$embedCode = $this->evplayer($real_link,thumb_fix($video->thumb),thumb_fix(get_option('player-logo')),$ext);
} elseif ($choice == 6) {
$embedCode = $this->hdflvplayer($real_link,thumb_fix($video->thumb),thumb_fix(get_option('player-logo')),$ext);
}
  • Find the code given below inside the same function
elseif ($choice == 3) {
$embedCode = $this->evplayer($videoId,thumb_fix($video->thumb),thumb_fix(get_option('player-logo')));
}

and replace with

elseif ($choice == 3) {
$embedCode = $this->evplayer($videoId,thumb_fix($video->thumb),thumb_fix(get_option('player-logo')));
}
elseif ($choice == 4) {
$real_link = 'http://www.youtube.com/watch?v=' . $videoId;
$img = 'http://i2.ytimg.com/vi/' . $videoId . '/mqdefault.jpg';
$embedCode = $this->hdflvplayer($real_link,$img,thumb_fix(get_option('player-logo')));
}

5) Place the hdflvplayer (standalone package) folder in the following path /lib/players/hdflvplayer and open /lib/players/hdflvplayer/xml/config.xml. Here find “<license>” tag and paste the license key. For logo find “<logopath>” tag and paste the logo URL.

6) Finally login to the site and access the admin panel (eg: http://sitename.com/moderator/) and go to Settings -> Player Settings and select “Default“, “Remote” and “YouTube” players as “HD FLV Player” and check.

If you wish to integrate the Player into your website, you can visit HD FLV player here. For further customizations contact bdm@apptha.com.

Related posts

4 thoughts on “How to integrate a standalone HD FLV Player in PHP Vibe?

  1. Marius

    Nice work, this is the best way to integrate it. I’ve linked it from our mods forum since many look for this player.
    Thank you for the nice words about PHPVibe, just an small note: the brand is ‘PHPVibe’ not ‘PHP Vibe’ :)

  2. Muhammad Mahtab Saleem

    Good job ,

    You have to develop more mods for phpvibe along different needed plugins

  3. lienkhuong

    Hi, i integrated standalone HD FLV Player to PHP Vibe but in PC HD FLV player good work but in Mobile not work (error: you need to have the flash player installed and browser with javascript support).

    Please help me

    • ramanathan

      Hi lienkhuong,
      The code provided in this blog is to add HD FLV Player in PHPVibe. Please note, HD FLV Player is a flash player whereas mobile devices does not support flash player by default. You need to install flash in your mobile. Else you need to go for HTML5 player for mobile devices alone.

      So you should check the platform (whether the URL is accessed in mobile or desktop) and based on the result, you should call the player. If it is desktop, you need to call HD FLV Player and if it is mobile device, then call HTML5 player.

      Even if you enable JW Player in admin panel, it will not work in mobile device. You should customize the code for HTML5 support.

      If you want to customize from our side, then contact our Business Development Team at bdm@contus.in

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code lang=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" extra="">