Playing movies with the Quicktime plugin

222 views
Skip to first unread message

guy

unread,
Feb 29, 2008, 10:10:01 AM2/29/08
to ResourceSpace
I found a way to play Quicktime movies (or Quicktime compatible) in
the view mode of RS. I was inspired by the flv implementation.

Ffmpeg needed on the webserver (for creating the poster frames). If
somebody is interested, I will post the trick here.

lmolmud

unread,
Feb 29, 2008, 11:51:49 AM2/29/08
to ResourceSpace
Give it up, man.

guy

unread,
Feb 29, 2008, 2:07:07 PM2/29/08
to ResourceSpace
you mean "give it" or "give up"? my english is not very good.

Dan Huby

unread,
Feb 29, 2008, 2:36:07 PM2/29/08
to resour...@googlegroups.com
Approx. translation (although my American English is not very good ;) )

"Don't keep it from us"

guy

unread,
Feb 29, 2008, 5:46:39 PM2/29/08
to ResourceSpace
Ok. Be warned: I'm not a developer! so my code is probably weird.
It's just a proof of concept. Waiting for your feedback.
--------------------
1. I removed in "view.php" the lines related to flv files
(this code is now into plugins/players/type3.php: I presume that every
video file should be processed first by type3.php ).
Removed lines are commented with a double slash below.

// $flvfile=get_resource_path($ref,"",false,"flv");
if (file_exists("plugins/players/type" . $resource["resource_type"] .
".php"))
{
include "plugins/players/type" . $resource["resource_type"] . ".php";
}
// elseif (file_exists($flvfile) &&
(strpos(strtolower($flvfile),".flv")!==false))
// {
// # Include the Flash player if an FLV file exists for this resource.
// include "flv_play.php";
// }
--------------------
2. I put these two files on the server:
type3.php (video files have type 3 on my installation)
quicktime_play.php

below is the code for each
--------------------
type3.php

<?
$flvfile=get_resource_path($ref,"",false,"flv");
# quicktime compatible extensions
$movfile=get_resource_path($ref,"",false,"mov");
$mp4file=get_resource_path($ref,"",false,"mp4");
$m4vfile=get_resource_path($ref,"",false,"m4v");
$mpgfile=get_resource_path($ref,"",false,"mpg");
$mpegfile=get_resource_path($ref,"",false,"mpeg");
$avifile=get_resource_path($ref,"",false,"avi");
$wmvfile=get_resource_path($ref,"",false,"wmv");
$threegpfile=get_resource_path($ref,"",false,"3gp");
$dvfile=get_resource_path($ref,"",false,"dv");

if (file_exists($flvfile) && (strpos(strtolower($flvfile),".flv")!
==false))
{
# Include the Flash player if an FLV file exists for this resource.
include "flv_play.php";
}
else
{
# Include quicktime player.
include "quicktime_play.php";
}
?>
--------------------
quicktime_play.php

<?
# display a quicktime compatible movie.

if (file_exists($movfile) && (strpos(strtolower($movfile),".mov")!
==false))
{
$ext = "mov";
}
elseif (file_exists($mp4file) && (strpos(strtolower($mp4file),".mp4")!
==false))
{
$ext = "mp4";
}
elseif (file_exists($m4vfile) && (strpos(strtolower($m4vfile),".m4v")!
==false))
{
$ext = "m4v";
}
elseif (file_exists($mpgfile) && (strpos(strtolower($mpgfile),".mpg")!
==false))
{
$ext = "mpg";
}
elseif (file_exists($mpegfile) &&
(strpos(strtolower($mpegfile),".mpeg")!==false))
{
$ext = "mpeg";
}
elseif (file_exists($wmvfile) && (strpos(strtolower($wmvfile),".wmv")!
==false))
{
$ext = "wmv";
}
elseif (file_exists($avifile) && (strpos(strtolower($avifile),".avi")!
==false))
{
$ext = "avi";
}
elseif (file_exists($threegpfile) &&
(strpos(strtolower($threegpfile),".3gp")!==false))
{
$ext = "3gp";
}
elseif (file_exists($dvfile) && (strpos(strtolower($avifile),".dv")!
==false))
{
$ext = "dv";
}
# image created by ffmpeg
$thumb=get_resource_path($ref,"tmp.$ext",false,"jpg");

?>
<object type="video/quicktime" classid="clsid:02BF25D5-8C17-4B23-BC80-
D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/
qtplugin.cab#version=6,0,2,0" width="480" height="376"
class="Picture">
<param name="width" value="480" />
<param name="height" value="376" />
<param name="autoplay" value="false" />
<param name="controller" value="true" />
<param name="src" value="<?=$thumb?>" />
<param name="href" value="<?=$ref?>.<?=$ext?>" />
<param name="target" value="myself" />
<param name="scale" value="aspect" />
<embed type="video/quicktime" autoplay="false" controller="true"
width="480" height="376" src="<?=$thumb?>" href="<?=$ref?>.<?=$ext?>"
target="myself" scale="aspect" />
</object>
--------------------
As a result, I can now play quicktime compatible movies in the "view"
mode. One click on the poster frame launches the movie.
As you see, supported extensions are: mov, mp4, mpg, mpeg, avi, m4v,
3gp, dv and possibly wmv.
(DV files on a web server is probably not a good idea! your choice ).

Bugs/malfunctions:
- Ffmpeg has an issue with WMV 9 files: It does not output a poster
frame on these files, so there is no image to link to the movie.
- Strangely, movie scaling doesn't work. Maybe trivial but I don't
find how to fix this.

For Mac users: WMV support is added to Quicktime throught the Flip4Mac
Plugin (but you know that if you are really a Mac user....).

Let me know your comments.

---
Guy



lmolmud

unread,
Mar 5, 2008, 12:18:55 PM3/5/08
to ResourceSpace
Yes, the flv implementation is very, very cool. Does this mean that
Quicktime and AVI files will play just as flv files do? I am going
to try this, but first: can you be more specific about the **exact**
location or directories in the resourcespace directory for the files
that I need to create. Thanks in advance,

- Larry

guy

unread,
Mar 5, 2008, 2:31:19 PM3/5/08
to ResourceSpace
type3.php is here: plugins/players/type3.php

quicktime_play.php is at the root level of Resourcespace (like
flv_play.php).

lmolmud

unread,
Mar 5, 2008, 3:36:22 PM3/5/08
to ResourceSpace
I can't get this to work. I get only a resource name in resource view,
with no controls. According to Dan, "With the 'plugins' folder now
being used exclusively for the new
plugins, the 'viewers' subfolder has been moved to the root level."

Are you sure about those locations? Would it be possible for you to
post your actual pages to the group so I am sure I'm not making any
coding errors? Thanks.

- Larry

guy

unread,
Mar 5, 2008, 7:39:27 PM3/5/08
to ResourceSpace
I installed the last version of RS this afternoon (v 1.3), and now my
view.php file is exactly the same as the official version.
Movies are displaying as well as precedently.

I don't see a "viewers" subfolder at the root level (?). Do you mean a
"players" subfolder? Mine is always located in /plugins/.

I confirm the locations of the files I added:
resourcespace/plugins/players/type3.php
resourcespace/quicktime_play.php

I really don't understand why this doesn't work for you.
Does the "view" mode displays at least the jpg created by ffmpeg
($thumb)?

lmolmud

unread,
Mar 5, 2008, 8:19:44 PM3/5/08
to ResourceSpace
I had assumed you had developed this for, and it was working in, 1.3.
That's what I was trying it in and it didn't seem to work. Yes, I get
a jpeg from ffmpeg, all of that is ok. I can also get browser previews
of just about any video format by adding "typeX.php" files to me
"plugins/viewers" directory, and adding the appropriate mime types to
download.php. Your solution just looked so elegant I really want to
make it work for me. I'll try the files you sent and let you know.
Thanks again, Guy.

When you make an assumption, you make an ass out of "you" and
"umption."
- Samuel Jackson, Pulp Fiction

lmolmud

unread,
Mar 6, 2008, 11:42:15 AM3/6/08
to ResourceSpace
Very cool. Not to be critical, but some feedback:

The Quicktime controls appear under the poster frame, but are non-
functional; to get the video to play, you have to click on the poster
frame. Is this the way it's supposed to be?

Also, line 7 of your type3.php refers out to type7.php, which I do not
have (and is apparently specific to your resource id type scheme.) I
commented it out and it works.

- Larry

On Mar 5, 4:39 pm, guy <guyto...@gmail.com> wrote:
Reply all
Reply to author
Forward
Message has been deleted
0 new messages