Hey, i just recently found out about Drupal and am still toying around with all of its features. I have since set up a fully working install with the video module, using the default flowplayer.

What i would like to know is, how to use the video module with a different flv player, more specifically, http://jeroenwijering.com/?item=Flash_Video_Player, because it has the volume controls feature and also a full screen function. Although i am no programmer, i do know that by using this simple script in the body of my posts i can play flash videos using the other player.

var FO = { movie:"http://website.com/Player.swf",width:"450",height:"350",majorversion:"7",build:"0",bgcolor:"#FFFFFF";, flashvars:"file=/files/videos/video.flv&showdigits=true&autostart=false" }; UFO.create(FO,"player1");

What i would however like to do is, make it so when you click on the play tab of a video post, the flash video is played using the other flash video player. I have set the video.module settings to use the Player.swf file, which is the new flash video player, Although the flash player loads on the play page, it doesn't load the video.
I would like to know if i can edit the video.module file and make it so that when i click on the play tab of my
video post it uses my flash player and plays the video.

I understand that this might be a really basic question, but i have searched google and the community for a solution, i even unsuccessfully attempted to edit the video.module myself. Any help will be appreciated.

Comments

fax8’s picture

The player you are trying to use support two installing type. One using javascript (the one you wrote above)
and another using the embed tag.

I suggest using the second way which is more similar to how it works with flowplayer.

Well the function you have to modify is theme_video_play_flash($node).
Your modified module must generate something like:

<embed allowScriptAccess="always" src="http://www.myfileserver.com/folder/flvplayer.swf" width="300" height="200"
border="0" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" 
flashvars="file=file.flv&showdigits=true&autostart=true" />

replace this lines:

// this will be executed by not Internet Explorer browsers
  $output = '<!--[if !IE]> <-->
<object type="application/x-shockwave-flash" width="'. $node->videox .'" height="'. $node->videoy .'"
data="'. url() . check_plain($loader_location) .'">
<!--> <![endif]-->' . "\n";

  // this will be executed by Internet Explorer
  $output .= '<!--[if IE]>
<object type="application/x-shockwave-flash" width="'. $node->videox .'" height="'. $node->videoy .'"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">
<![endif]-->' . "\n";

  // params will be passed to both IE or not IE browsers
  $output .= '<param name="movie" value="' . url() . check_plain($loader_location) . '" />
               <param name="allowScriptAccess" value="sameDomain" />
               <param name="quality" value="high" />
               <param name="FlashVars" value="baseURL='. $base_url .'&videoFile='. $file .'&autoPlay=true&buff
erLength=5" />' . "\n"
  . _video_get_parameters($node) .
  '<p>'. t('Your browser is not able to display this multimedia content.') .'</p>
</object>';

with:

$output .= '<embed allowScriptAccess="always" src="'. url() . check_plain($loader_location) .'" width="'. $node->videox .'" height="'. $node->videoy .'" border="0" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" 
flashvars="file='. $file .'&showdigits=true&autostart=true" />';

This should work.. but I didn't tested.

Fabio

------------
www.varesano.net - Fabio Varesano Personal Homepage

roleychiu’s picture

I am also trying to use the FLV player instead of flowplayer. I have followed the above instructions and replaced the appropriate code in video.module, but the videos still do not load. the player loads just fine, however, as I have indicated the player in the video settings in the admin. But the videos still do not load even with the above changes.

Can anyone verify if Fabio's fixes work?

roleychiu’s picture

Fixed my problem: answer was a Dreamweaver issue. Editing in dreamweaver on remote server was not saving the changes.

Fabio's code works.

- Roley Chiu
www.rollsonline.com

digital_shiva’s picture

I had similar problems to those listed above. In fact, I was never able to get the video to run in the flowplayer. This was not an issue b/c I preferred to use the Flash Video Player anyway: http://www.jeroenwijering.com/?item=Flash_Video_Player.

Per Fabio, I replaced the PHP code in theme_video_play_flash($node). Works great. I only needed to go into settings to have the player reside with my flv video files. In my case, my video files are in files/videos dir (Settings > Video > Flash Settings > Filename of Flash loader: > files/videos/Player.swf). If you leave the value of Filename of Flash loader: as Player.swf, Player.swf will reside at the root of your Drupal installation, which is probably not really where you want it.

Also, if it is not already apparent, you will need to go to jeroenwijering.com to download this player.

I'm very happy with the video module. Good work!

vthirteen’s picture

for clarity's sake, i guess that the first step to change the default flowplayer player is modifying the template.php file within your theme with the code above (add it to template.php and cheange the name of the function from theme_.... to yourthemerealname_...).

then, digital_shiva says:
"I only needed to go into settings to have the player reside with my flv video files."

that's because the modified module does not recognize/apply the basename and so looks for the files in the same directory only.
i dont want the flash player to reside necessarily in the files/videos directory because my video files reside on another server and in various directories.

so, is there a way to solve this?
i dont know php enough to safely do the change myself. :-(

palvis’s picture

drupal 5.9
this is probably not the best way to resolve this issue (with probability=0, elegance=0)
anyway, created directory "player" or whatever.
uploaded player.jwf there, plus a skin, say snel.swf (rename it to skin.swf)
in administer -> site configuration -> video, flash settings, set
filename of flash loader: player/
finaly changed function theme_video_play_flash($node) in modules/video/includes/common.inc to:

function theme_video_play_flash($node) {
$loader_location = variable_get('video_flvplayerloader', 'FlowPlayer.swf');

$url = _video_get_fileurl($node->vidfile);
$file = basename($url);
$base_url = substr($url, 0, strrpos($url, '/'));

$height = $node->video_scaled_y + 24; // add commands height
$output .= 'videox .'" height="'. $node->videoy .'" border="0" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"
flashvars="file='. $url .'&fullscreen=true&skin='. url() . check_plain($loader_location) .'skin.swf" />';

$output = theme('video_format_play', $output, t('http://www.macromedia.com/go/getflashplayer'),
t('Link to Macromedia Flash Player Download Page'),
t('Download latest Flash Player'));
return $output;
}

after all, if i change parameter 'filename of flash loader' from flowplayer.swf to player.swf i have to change code in common.inc. hardcoding here or there. ended changing the semantics of 'filename of flash loader' from 'player file' to 'path to player'. awful, i know.

sandy-jr’s picture

I can see the player once I click "play" but nothing plays. The player seems to freeze. I modified the
"video.module" file and changed path to player in settings/video/flash player

Did I miss something?

newdru’s picture

Does this change have to be made in the video module or can i just override the theme function in template.php?

thanks

fax8’s picture

you can override them on template.php

------------
www.varesano.net - Fabio Varesano Personal Homepage

newdru’s picture

that's what i thought!

sandy-jr’s picture

I can see the flv player but none of the controls are working. I have tried to put the player in its own directory as well as putting it in files/videos/ directory - it still doesn't respond. I have modified "video.module" file as described.

Thank you