Adding Flowplayer 3.* in ATutor

We have used Flowplayer as our preferred movie player in ATutor for a long time now, and I have written a post about how you can integrate it in you install.
That was for version 2.2.1 of Flowplayer, but we're now at version 3 (3.0.7 at the time of writing). Flowplayer is now more elegant, and you have to integrate it in a different way.
Again, first thing is to download the player.
Then, copy the js file you need to your server, and add a reference to it in you theme file (/your_theme_path/header.tmpl.php):
<script type="text/javascript" src="/flowplayer307/flowplayer-3.0.6.min.js"></script>
This file will be in the example folder when you download it, and yes the version number for the js is 3.0.6 even though the player is at 3.0.7.
Third, edit your include/lib/output.inc.php. Around line 650, add the following to get ATutor to output the right code when it finds a .flv file inside the media tag:
<?php
// .flv - uses Flowplayer 3.0 from flowplayer.org (playing file via full URL)
preg_match_all("#\[media[0-9a-z\|]*\]http://([\w\./-]+)\.flv\[/media\]#i",$text,$media_matches[11],PREG_SET_ORDER);
$media_replace[11] ="<a class=\"flowplayerholder\"
style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\"
href=\"http://##MEDIA1##.flv\">
</a>";
// .flv - uses Flowplayer 3.0 from flowplayer.org (playing file from AT_content_dir)
preg_match_all("#\[media[0-9a-z\|]*\]([\w\./-]+)\.flv\[/media\]#i",$text,$media_matches[12],PREG_SET_ORDER);
$media_replace[12] ="<a class=\"flowplayerholder\"
style=\"display:block;width:##WIDTH##px;height:##HEIGHT##px;\"
href=\"".AT_BASE_HREF."get.php/##MEDIA1##.flv\">
</a>"; ;
?>(not including the php start and stop tags!)
That's it for the output.inc.php, no more changes needed! Note that the earlier inline javascript Flowplayer needed now is gone, and all it inserts is a slighty styled link.
You do however need to change one more file to compensate for this, and that is your theme's footer.tmlp.php. Add this at the top of it:
<script language="JavaScript">
window.onload = function() {
// for Flowplayer
$f("a.flowplayerholder", "/flowplayer307/flowplayer-3.0.7.swf", {
clip: { autoPlay: false, autoBuffering: true },
plugins: {
controls: {
all: false,
play: true,
scrubber: true,
fullscreen:true
}
}
});
}
</script>For those of you familiar with the magic that is jQuery you will recognize the syntax. This basically says that the Flowplayer (flowplayer-3.0.7.swf) should load whenever the page finds an a-element with the class "flowplayerholder", and it passes some instructions that you can change to your liking by looking at the Flowplayer documentation.
To make ATutor insert .flv files in the media tag I suggest you read about the changes done in include/html/filemanager_display.inc.php that I described in my original post.
To have a look at the new player, have a look-see here!
Comments
Flowplayer 3
May 21, 2009 - 11:33 — Anonymous (not verified)Hi,
thanks a lot for the script to embed flowplayer 3 width parameters.
Unfortunately the flowplayer.org is obviously no longer online, you was my last help....
If you have an Idea, where i can get the full documentation, it was great!
Once more thanks a lot, and a good Day!
Rudi
flowplayer.org
May 21, 2009 - 18:57 — Vegard A. Johansenhia, I'm sure flowplayer is just temporarily down, I used it as recent as yesterday so just check back there later - glad you found some help here anyways!
Flowplayer not showing up for students
December 14, 2009 - 16:54 — Paul Foos (not verified)I am working on a test installation of ATutor, running version 1.6.4 on Ubuntu Linux, PHP 5, MySQL 5, with the standard ATutor template installed. I followed your instructions and got Flowplayer working, using an FLV file streamed from a remote source. The video and player show up fine for an Instructor, but Students cannot see it. Students get the link to the FLV but not the player. Is this a permissions issue? Or do students see a different template? What do you think?
Try the module
December 15, 2009 - 14:13 — Vegard A. Johansenhia, that was weird. ATutor does not have any fine grained permissions for content as such. If the content is made public (that is not time limited) it should show for all user roles..
However, this might be due to changes done in ATutor from 1.6.2 to 1.6.4 (which BTW is only beta!), and I do know that the team made some changes in 1.6.3 and also added a Flowplayer module that works from 1.6.3 and up: http://www.atutor.ca/atutor/modules/index.php
I haven't testes this though as we're still on 1.6.2, where this recipe works (I've used it on several installs)..
Post new comment