Skip to main content

PHPMOTION JW Player SD/HD Integration.

jw player is really a great video player.it contains great features like it allows users to choose from SD/HD video. so user may play video as per his/her internet speed. in this post i am going to show how its possible to integrate jw player with its SD/HD options with phpmotion video script.


phpmotion jw player sd/hd feature integration



follow below steps for phpmotion jw player integration.
01. download jw player files from here. and place it into public_html/jwp location.
02. make a directory named hd in uploads so it will be like public_html/uploads/hd
03. modify public_html/convertor.php so that it place the hd version of video in public_html/uploads/hd directory.
04. take backup of following files before changing these files.
    1.public_html/index.php
    2.public_html/make_player.php
    3.public_html/themes/default/inner_index.htm
    4.public_html/themes/default/make_player.html
 
05. open  public_html/index.php

goto

$browse_videos = array();
and above to this code add the below code. this code basically select random video to play at home page you may change it as per your requirement.

$sql = "SELECT indexer, video_id, title, title_seo, date_uploaded,type, user_id, video_length, featured, approved, public_private FROM videos WHERE  approved='yes' AND public_private = 'public' ORDER BY RAND() DESC LIMIT 1";
$query = @mysql_query($sql);

if ($result_videos = @mysql_fetch_array($query))
{
       $my_video_id = mysql_real_escape_string($result_videos['video_id']);
       $type = mysql_real_escape_string($result_videos['type']);
       $title = mysql_real_escape_string($result_videos['title']);
       $filesd = $base_url.'/uploads/'.$my_video_id.'.'.$type;
       $titlesd = "sd video";
       $filehd = $base_url.'/uploads/hd/'.$my_video_id.'.'.$type;
       $titlehd = "hd video";
}
06. open  public_html/themes/default/inner_index.htm
 
    goto

<div id="index-player-container">
 
and remove the code that this div block contains and add below code in between this div block

<script type="text/javascript" src="[var.base_url]/jwp/jwplayer.js"></script>
        <div id="myElement">Loading the player ...</div>
             <script type="text/javascript">
                   jwplayer("myElement").setup({
                         height: 350,
                         width: 710,
                        playlist: [{
                          image: "[var.base_url]/uploads/thumbs/[var.my_video_id].jpg",
                          sources: [{
                            file: "[var.filesd]",
                            label: "[var.titlesd]"
                          },{
                            file: "[var.filehd]",
                            label: "[var.titlehd]"
                          }]
                        }]
                      });
            </script>
   
07. open  public_html/make_player.php
    goto

    if(!file_exists($thumb_file)) $thumb_file = 'uploads/thumbs/'.$video_id.'.jpg';
   
and add below code

  $titlesd = "sd video";
  $titlehd = "hd video";
   
08. open  public_html/themes/default/make_player.html
  delete the content of this file and add the below code to this file. 

  <script type="text/javascript" src="[var.base_url]/jwp/jwplayer.js"></script>
        <div id="myElement">Loading the player ...</div>
             <script type="text/javascript">
                   jwplayer("myElement").setup({
                         height: 420,
                         width: 560,
                        playlist: [{
                          image: "[var.base_url]/[var.thumb_file]",
                          sources: [{
                            file: "[var.base_url]/uploads/[var.video_play]",
                            label: "[var.titlesd]"
                          },{
                            file: "[var.base_url]/uploads/hd/[var.video_play]",
                            label: "[var.titlehd]"
                          }]
                        }]
                      });
            </script>
   
good day,

Comments

  1. i have add your code but


    Powered Free by PHPmotion - Video Script has been displayed how delete it

    ReplyDelete
  2. hi welcome to blog,
    would you please give me the link so i may see the issue ?

    good day,
    Hiren Patel

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. hi thanks,
    i have added jwp for the welcome page that work fine.
    for play page the message file not found was displayed.

    regards

    ReplyDelete
  5. Thanks for posting this tutorial Hiren! I've got some other things to take care of but I will let you know how it works once I have implemented it.

    ReplyDelete
  6. By the way, did you really mean to refer to make_player.html in both steps 7 and 8? First you say to add code, then to delete the content of the file. I think you mean public_html/make_player.php for one of those steps.

    Thanks.

    ReplyDelete
  7. hi
    yes i just fixed the step number 7 . it should be public_html/make_player.php.

    thanks Dan Parks for this.

    good day,
    Hiren Patel.

    ReplyDelete
  8. hi ,
    yes i have added this to make_player.php
    but it deos'nt work for .mp4 video but ok for .flv.
    good night

    ReplyDelete
  9. hi elmissaoui habib,
    thanks for using this tutorial,

    actually this tutorial show very basic level of integration. at present i used same extension for hd as of sd video. so to make it work you need to do some little work on this. you may apply hd extension as .mp4 if you have all the hd videos in .mp4 videos . if hd extension is not fixed you may store the extension in database and may use it here at index and play pages.

    hope it will help you.
    good day,
    Hiren Patel.

    ReplyDelete
  10. Hi,
    i fixed the problem.
    .flv extension are hard coded i have changed it to variable .

    regards

    ReplyDelete

Post a Comment

Hi, Thanks for the comment will try to reply at the earliest.

Good Day,
Hiren Patel
http://www.renruhak.org

Popular posts from this blog

PHPMOTION VIDEOJS PLAYER INTEGRATION

videojs is the open source HTML5 video player. today we are going to see how videojs player can be integrated with phpmotion video script. some popular sites using videojs are  http://twitpic.com/  ,  http://telly.com/  ,  http://vine.co/  ,  http://www.theonion.com/  , http://web.mit.edu/   ,  https://www.airbnb.com/?cdn_locale_redirect=1

PHPMOTION JW Player Integration

phpmotion  is a popular video script.by default phpmotion uses flash player to show/play videos at home page as well as video play page.The JW Player is the Internet's most advanced and flexible media player. in this tutorial I am going to show how it is really easy to do phpmotion jw player integration.