Patch to get Flvmediaplayer to work with XSPF playerlist to work with PHP strict

Robin van Emden - September 23, 2008 - 11:18
Project:FLV Media Player
Version:5.x-1.0-alpha3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:patch (code needs review)
Description

Hi,

I had some trouble getting Flvmediaplayer 5.x-1.0-alpha3 to work on a linux apache php5 server.

Used:

SWFObject API 5.x-2.0-beta2 with SWFObject 2.1
Flvmediaplayer 5.x-1.0-alpha3 with JW Player 3.16
XSPF Playlist 5.x-0.12

Attached quick patch was needed to fix things.

I did not have enough time to really delve into the code, but most the problems proved to be easily solvable php4-php5 array related stuff.

The only strange change I had to make was this one:

- if (module_exists($module_name) && $output = module_invoke($module_name, $hook, $op, $name, $node, $config)) {
+ if (module_exists($module_name) && $output = module_invoke($module_name, $hook, $op, $node, $config)) {

Why the $name variable? It doesn't seem to be used in the current XSPF 5.x-0.12 version (dev versions neither, I believe?) :

function xspf_playlist_flvmediaplayer_file_use($op, $node, $config)

(which I changed to
function xspf_playlist_flvmediaplayer_file_use($op=null, $node=null, $config=null)
just to be on the safe side)

Still, its wonderfull how easily I got my media mover / s3 / flv media player / XSPF drutube-like site up and running!

Keep up the good work!

AttachmentSize
module.flvmediaplayer.php5_.patch2.12 KB

#1

Robin van Emden - September 24, 2008 - 09:12

Hmm, its seems there was still one more bug left needing squishing :

-function theme_flvmediaplayer_profile_display($profile_name, $node, $config = array())
+function theme_flvmediaplayer_profile_display($profile_name, $config = array())

Without it movies inserted as an Asset give an error.

Attached: extended patch file.

AttachmentSize
flvmediaplayer.php5_.p2.patch3.06 KB

#2

Robin van Emden - September 24, 2008 - 09:50

In order to get a white background for (the fill surrounding) the player I added

$data['params']['bgcolor'] = "#ffffff";

as a quick hack before

// render the player

@1401

should work out why the assigned params do not reach this stage.
but no time to patch things up any better right now.
information might come in handy as a temporary fix though.

#3

arthurf - September 24, 2008 - 15:59
Title:Patch to get Flvmediaplayer to work with XSPF playerlist on PHP5» Patch to get Flvmediaplayer to work with XSPF playerlist to work with PHP strict

Thanks for your patch. I think you've missed a few things though, especially in removing parameters from some of the hook calls- this will cause some issues. I instead set the value to null, which I think which I think should help with PHP warnings- this isn't php 5 compatibility, it's just improving it to not throw warnings when php is set to strict- something that is really important, but your title threw me off a bit. I applied some of it already, and am willing to refactor more.

#4

Robin van Emden - September 25, 2008 - 09:26

Hi ArthurF!

Thanks for renaming the issue! Mine are just a quick set of patches that made all modules (Asset, Flv Player, Media Mover, etc) work peacefully together on my server. I do not have the time (yet) to delve into the code and fix things properly, so it would be great if you'd be able to refactor! Still not clear to me which signature is correct though;

if (module_exists($module_name) && $output = module_invoke($module_name, $hook, $op, $name, $node, $config)) --> Flvmediaplayer 5.x-1.0-alpha3

doesn't seem to send the correct variables when used to call xspf_playlist_flvmediaplayer_file_use in flvmediaplayer_extend_fire

in xspf 0.12 the function called is

function xspf_playlist_flvmediaplayer_file_use($op, $node, $config) --> XSPF Playlist 5.x-0.12

which is called with $name variable instead of $node, i.e. xspf_playlist_flvmediaplayer_file_use('file',1, [nodeobject])

so these versions of both modules do not seem to play well together?

Flvmediaplayer_asset's use of theme_flvmediaplayer_profile_display seems to have the same kind of communication problem with theme('flvmediaplayer_profile_display', $attr['format'], $config) calling function theme_flvmediaplayer_profile_display($profile_name, $node, $config = array())?

#5

arthurf - November 6, 2008 - 16:52

XSPF has been updated quite a bit and resolves the above issue I think. I've also done a major revision in FLVMediaPlayer ALPHA 6, so I'm advising folks to start using that and start bug fixing off that. Hopefully that will be a much more sustainable base to fix from. One note is that I haven't fixed the Asset support yet- I just wanted to get the refactor done.

 
 

Drupal is a registered trademark of Dries Buytaert.