FLV Player Plugin based on FLASH VIDEO PLAYER 2.4

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
wp_user
Regular
Posts: 8
Joined: Thu Jul 13, 2006 10:08 am

FLV Player Plugin based on FLASH VIDEO PLAYER 2.4

Post by wp_user »

Hello Forum,

I'm using currently Wordpress and I'm planning to migrate to serendipity if it fits my needs.

Currently I'm testing serendipity an there is something I need.

In worpress there is a plugin that uses the FLASH VIDEO PLAYER to display previously uploaded flv Files.

The Difference to the Posts concerning Media Players I found via the Forum search is this: I don't want to include flashfiles directly, I want to post bbcode which is used by s9y to generate the code needed to include the flv-player and play a movie.

I'm not a php newbie, so possibly I could write some plugin myself, unfortunately there is not enough time at the moment to read in the s9y plugin system.

I didn't find anything concerning this at google or the Forums, so could you please tell me if there is a plugin that does exactly what I need or even something similar and would need just some small adjustmenst?

Any help would be appreciated, thanks in advance!

Peter
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: FLV Player Plugin based on FLASH VIDEO PLAYER 2.4

Post by garvinhicking »

Hi!

Actually our current "podcast" plugin serves some kind of that purpose. It could be easy to adapt to your needs, I think.

Inside the serendipity_event_podcast.php line that'S a var $playerHTML you could enhance with a:

Code: Select all

'avi' => '<object ...>'
line that points to your FLV video player. Embedding such a video should then be as easy as just putting an <a href="....avi"> link into your entries, even straigth with videos uploadde to the s9y media database.

Since I personally have never really dealt with such video files, I don't know if that is all you need. Maybe you'd need specific options which would need to be added as preg/regexp patterns within the strings. But I'm sure we could work them out together?

The other straight forward way for you would be to use the "serendipity_event_regexpmarkup" plugin file. There just create a "FLV.php" file in its regexps subdirectory, with something like this code:

Code: Select all

<?php
// Flash Player.
//
$regexpArray = array(
    'SearchArray'=>array(
		"/<flv:([^>]+)/>/U"
    ),
    'ReplaceArray'=>array(
		'object type="application/x-shockwave-flash" width="320" height="240" data="http://yourdomain/flv.swf?file=%s"><param name="movie" value="http://yourdomain/flv.swf?file=%s" /></object>'
    )
);
Then you could just insert "<flv:http://host/yourvideo.avi />" into your entries and it would get rewritten.

Please tell me if that helps, or how we could enhance the plugins to make them better. :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
wp_user
Regular
Posts: 8
Joined: Thu Jul 13, 2006 10:08 am

Post by wp_user »

Hi again!

Garvinhicking, thank you so much! Your second idea is exactly what I need.

I'll test it as soon as possible and post the result. :)
As today is my companys summer party I'll have to wait until tomorrow.

My english is too bad to express how enthused I am because of this quick and .. well, professional answer. :)

Thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

No problem! Go ahead and have fun, tell us if you have suggestions or might create some cool patches :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
wp_user
Regular
Posts: 8
Joined: Thu Jul 13, 2006 10:08 am

Post by wp_user »

Hello again! :)

Since I'm not experienced in using regex, I'm stuck.

I'm trying to get this:

Code: Select all

<flv href="/wp-videos/uploads/sample.flv" width="512" height="384" autostart="false" />< br/>
transformed into this:

Code: Select all

<object type="application/x-shockwave-flash" width="512" height="384" data="http://yourdomain/flv.swf?file=/wp-videos/uploads/sample.flv&autostart=false">
<param name="movie" value="http://yourdomain/flv.swf?file=/wp-videos/uploads/sample.flv&autostart=false" />
</object>
using the regex plugin.
This is what I've got so far:

Code: Select all

<?php
// Flash Player.
//
$regexpArray = array(
    'SearchArray'=>array(
		"/<flv href=\"([^>]+)\" width=\"([^>]+)\" height=\"([^>]+)\" autostart=\"([^>]+)\"/>/U"

    ),
    'ReplaceArray'=>array(
		'<object type="application/x-shockwave-flash" width="\\2" height="\\3" data="http://yourdomain/flv.swf?file=\\1&autostart=\\4"><param name="movie" value="http://yourdomain/flv.swf?file=\\1&autostart=\\4" /></object>'      
    )
);
Plugin is activated and works as it should do, but not in this case.

Could anybody give me a hint?

Thanks in advance, Peter
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

And I used to think I was good at this.

I think it's grabbing a lot more than you want. Try this instead:

Code: Select all

$regexpArray = array(
    'SearchArray'=>array(
      '/<flv href="([^"]+)" width="([^"]+)" height="([^"]+)" autostart="([^"]+)">/U'
    ),
    'ReplaceArray'=>array(
      '<object type="application/x-shockwave-flash" width="$2" height="$3" data="http://yourdomain/flv.swf?file=$1&autostart=$4"><param name="movie" value="http://yourdomain/flv.swf?file=$1&autostart=$4" /></object>'     
    )
); 
Tell me what that actually outputs.
Judebert
---
Website | Wishlist | PayPal
wp_user
Regular
Posts: 8
Joined: Thu Jul 13, 2006 10:08 am

Post by wp_user »

judebert wrote:Tell me what that actually outputs.
It works. The funny thing is: the script I've posted works, too!
Don't ask me why. I've changed the filename from FlashVideoPlayer.php to flv.php and it worked!!

The sad thing is, it doesn't take changes. When I change some code nothing happen, I think there is some sort of cache besides templates_c. *sigh*

But hey.. Thanks a lot, I'm using your code. :D

Oh, one thing, regarding the flashplayer itself.
The correct variable is "autoStart", "autostart" won't work!

The hole thing:

Code: Select all

<?php
// Flash Player.
//
$regexpArray = array(
    'SearchArray'=>array(
      '/<flv href="([^"]+)" width="([^"]+)" height="([^"]+)" autostart="([^"]+)>"/U'
    ),
    'ReplaceArray'=>array(
      '<object type="application/x-shockwave-flash" width="$2" height="$3" data="YOURDOMAIN/flvplayer.swf?file=$1&autoStart=$4"><param name="movie" value="YOURDOMAIN/flvplayer.swf?file=$1&autoStart=$4" />"'
    )
);
save as flv.php (755) and you're done! I'm loving it. *gg*

Thanks!
wp_user
Regular
Posts: 8
Joined: Thu Jul 13, 2006 10:08 am

Post by wp_user »

wp_user wrote:The sad thing is, it doesn't take changes. When I change some code nothing happen, I think there is some sort of cache besides templates_c. *sigh*
Fixed... Just pressed "Cachen aller Artikel" (don't know in English, should be sth like "cache all articles") once in the admin area and it worked. :)
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Well, that makes sense, then. With "cache all articles" enabled, Serendipity doesn't run the plugins if it already has a complete version of the article. So your changes were never seen.

Glad it works! I'm going to go add your solution to the documentation right now.
Judebert
---
Website | Wishlist | PayPal
Post Reply