LoudBlog - Podcasting-Software for PHP - Forum

You are not logged in.

Announcement

Unfortunatelly, we received lots of spam in the LoudBlog forum. We closed registrations so far. Please check again later.

#1 May 26th 2010 14:10

doorwish
Member

Video Podcasts with Shadowbox

Hi Everyone!

I am using Loudblog for a while now and I love it! It is the easiest way to publish your podcasts without hassle.

Well since I have gained a lot from loudblog I thought I could give a little bit back to the community.

I am not sure if someone already has done this but I could not find any solution to my problem in the forum today, so I gave it a try myslef and VOILA! it worked out! ;) Although I am just a rookie php coder!


Now what does the plugin do?

Well first of all if you have a lot of video Podcasts on your site you have certainly realized that the site is very slow in loading pages. And playing the videos can even get a bigger pain.  Second of all if you or another user of the admin tool accidently uploads a bigger video your whole template design will mess up.

What I did is I implemented shadowbox to it so that everytime a mp4 video is postet instead of putting the QT player a small image (whatever you wish) is loaded as a placeholder and if you click on that image the shadowbox is activated and your video will play.

On ther other hand all MP3 Podcasts will stay playing with the standard flash player.






Here is how it works.

1. Get Shadowbox and upload it to loudblog/custom/template/default folder on your server.

2. Include the piece of code described on the shadowbox homepage into your header. Make sure you have the right root to the shadowbox css and js files. If you upload it to the folder I said it should look something like this:

Code:

<link rel="stylesheet" type="text/css" href="shadowbox/shadowbox.css">
<script type="text/javascript" src="shadowbox/shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({
         language: 'de',
             players:  ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv', 'mp3']
});
</script>

3. Now copy paste the following code into an empty file (you can do this with any TextEdit Software on your computer) name it niiceeplayer.php and save it.

Code:

<?php

#################################################
#################################################

function niiceeplayer($content) {
//puts emff-flash-app OR quicktime player on screen (works within postings-loop)
global $postings;
global $currentid;
global $settings;
$att = getattributes($content);
$audioexamine = "";
$return = "";

//decide: flash or quicktime
$thetype = $postings[$currentid]['audio_type'];

//redirect or direct link? Only Flash can be redirected for counting
if (($thetype == "1") AND ($settings['countfla'] == "1")) {
    $before = "get.php?fla=";
} else {
    if ($postings[$currentid]['filelocal'] == "1") {
        $before = "audio/";
        $audioexamine = $GLOBALS['audiopath'].$postings[$currentid]['audio_file'];
    } else {
        $before = "";
    }
}

if (!veryempty($postings[$currentid]['audio_file'])) {

//possible attributes and default-values
if (isset($att['width']))  { $width  = $att['width']; }  else { $width  = 200; }
if (isset($att['height'])) { $height = $att['height']; } else { $height = 62; }
if ($postings[$currentid]['filelocal'] == 1) {
    $audio = $before.$postings[$currentid]['audio_file'];
} else {
    $audio = $postings[$currentid]['audio_file'];
    if ($settings['countfla'] == "1") {
        $audio = $before.$audio;
    }
}

//if mp3, show flash!
if ($thetype == "1") {
    $return .= showflash(
    "loudblog/custom/templates/".$settings['template']."/emff.swf?src=".$audio,
    $width, $height);
}





//if quicktime video
if (($thetype == "10")) {

    //making an absolute link
    if ($postings[$currentid]['filelocal'] == "1") {
        $audio = $settings['url'] . "/" . $audio;
        $target = "myself";
    } else {
        $target = "quicktimeplayer";
    }

    //getting width and height from getid3()
    $fileinfo = getid3data($audioexamine,"front");

    //build html-code for quicktime plugin (video)
    
    $return = "<a class=\"preview\" href=\"". $audio . "\" rel=\"shadowbox\">";
    $return .= "<img src=\"loudblog/backend/clicktoplayvideo.jpg\" </>";
    $return .= "</a>\n";   
}


return $return;

} else { return ""; }

}



?>

4. Upload this file to loudblog/custom/plugins

5. Now open the index.html file in your template folder on the server and replace everything from <lb:if_audio> to </lb:if_audio> with the following code.

Code:

<lb:if_audio>
                <p>
                <class="flash"><lb:niiceeplayer width="355" height="28" />
                </p>
                <p>
                <lb:link_audio>
                    Download <lb:audiotype />
                </lb:link_audio> (<lb:audiolength />min, <lb:audiosize />MB)
                </p>                                
</lb:if_audio>

6. Last but not least upload the image you want to be shown instead of the video on the post to loudblog/backend/ and name it clicktoplayvideo.jpg

7. Try it out!!!! It should work. If not I might have forgotten to write down something since it is late and I am sleepy!  ;) Post and I will try help.



I am sure there are other cracks out there who can programm this little piece of code much more elegently. But I am pretty proud of what I have managed to accomplish and felt like sharing with you guys.

But if anyone has a better and more efficiant way to solve this problem please let me know!!!

Keep up the good work and share your ideas!

Peace!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson