We're interested in housing the videos on a separate server other than the Drupal server. Theoretically, hosting the FLV files on a separate Flash Media Server (which we already own) would allow for true streaming of the videos and provide better performance for the users.

I guess my two questions are:

  1. How do I get the FLV, once converted, moved over to the other server? Should I write a new module to do the moves?
  2. What's the easiest way to embed those files that now have an external filepath with FlashVideo?

Comments

attheshow’s picture

Just an update on my situation. I've noticed that the JW Player has a "streamer" parameter (http://www.longtailvideo.com/support/jw-player-setup-wizard?example=4) that can be used to stream videos from a Flash Media Server using the RTMP protocol. I think I'll be using this during the embed process.

I'm looking at building a FlashVideo sub-module/plugin to do the file moves that I need. We're going to be using Cygwin on the Windows 2003 Flash Media Server we're using to enable scp, ssh, etc. file moving processes. I'll keep posting updates here as we get this working. ...in case anyone else is in the same boat.

NeilPorter’s picture

This sounds like an interesting project, please do keep us updated on it, thanks.

Michael Beechey’s picture

Hi,

I'm trying to host on S3 and play mixed media files using JW...can't get the jw or flashvideo drupal modules working correctly, but anyway... using the jw wizard, I can get different files working using the jw player hosted in S3....but haven't found one player to do all video and all audio....

BTW - what is the External Communication field in that wizard?

thanks in advance
Michael Beechey
www.musementors.com

attheshow’s picture

Assigned: Unassigned » attheshow
Category: support » feature
Status: Active » Needs review
StatusFileSize
new6.08 KB

Ok, so I've built my new plugin/module and it's working well in my setup. I wonder if anyone else will even be able to test this? If you can, it would be much appreciated!

FYI, this goes into the "plugins" directory. There is also a README.txt included.

attheshow’s picture

StatusFileSize
new2.55 KB
new7.66 KB

For better functionality, I had to make a small patch to the core FlashVideo module. I've attached that patch (streaming.patch) to this message. I've also updated the streaming module slightly. Please see all of the latest code below.

attheshow’s picture

Title: Hosting FLVs on a Separate Flash Media Server » New Plugin Module: FlashVideo Streaming
Component: Miscellaneous » Code

Adjusting the name of the issue to match up with the changes in the issue.

Also, just to clarify, this code goes along with FlashVideo 6.x-1.4.

perandre’s picture

I'm interested in the mentioned soulution, and will check it out!

attheshow’s picture

StatusFileSize
new7.73 KB

Latest module code is attached.

perandre’s picture

I'm not sure if the patch to the original flashvideo module is applied; I can't tell any difference before and after, and this is what I get (using patch in terminal.app...new to patching, btw):

pesh$ patch < streaming.patch
patching file flashvideo.admin.inc
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 succeeded at 295 with fuzz 2 (offset -10 lines).
patching file flashvideo.module
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 FAILED at 1.
1 out of 2 hunks FAILED -- saving rejects to file flashvideo.module.rej

Edit: Patch works; I now see the "Streaming URL: *"-field. Now testing...

perandre’s picture

I have an external RTMP-server with lots of flv-files, and all I want to do, is really to have a CCK-field where I can link to the proper file (rtmp://example.com/file1.flv) and use jw player to display the video on a drupal site. Is there a way to do this without having to go trough the upload+conversion process?

I have applied the patch in (#5) and installed the plugin (#8).

attheshow’s picture

perandre,

You might be able to do that with the Embedded Media Field. I'm not positive though and don't have a lot of experience with that module. Here's the link:

http://drupal.org/project/emfield

If it doesn't work, at least you'll be closer to your goal than with the FlashVideo module, I think.

perandre’s picture

Thanks for your reply!

Emfield would be a nice shortcut, but it doesn't work with RTMP. Secondly, I need the added functionality of the flashvideo module for new videos later on, just not for the videos that are already on the streaming server.

So, flashvideo + streaming plugin can do this, but only if I go through the upload/conversion-process? If there's a way to bypass this, I would be very interested to know.

Great work!

mrfelton’s picture

Interesting. I was just looking to develop something similar to this myself, although perhaps a slightly simpler implementation. I simply want to use the xmoov-php script (http://xmoov.com/xmoov-php/) in order to do some HTTP pseudo-streaming from the same server that Drupal is running on. I'm not anticipating high volumes of streaming, but I do want to provide stream-like features (such as randam access and scrubbing).

I was thinking of trying to incorporate this functionality into this module, but it may just over complicate things for my purposes so I'll probably just write a new one to add local xmoov-php support into flashvideo instead.

attheshow’s picture

Version: 6.x-1.4 » 6.x-1.x-dev

I need to test this plugin module with the development version 6.x-1.x-dev and the FileField integration. After that, I think I'll go ahead and add it to the project. It seems like there's enough interest.

mrfelton’s picture

StatusFileSize
new2.77 KB

For your reference, I got my xmoov-php streaming plugin working. It would be nice if your streaming plugin and this one I wrote could play nicely together - Users may want to use different streaming servers for different content types?...

Any, take a look at this quick version I made.

This one required much less of a change to the original flashvideo module by using form_alter and a custom form submit handler. I only needed the flashvideo.module part of your patch - I think yours could probably work in the same way.

perandre’s picture

Great thoughts, guys. This will be a great improvement in using Drupal with pro video solutions.

attheshow’s picture

mrfelton,

I'm not following you on the "yours could work the same way" idea. For things to truly be streamed via RTMP, they must live on a server that can stream video such as a Red5 or Flash Media server. Unless the streaming server and the Drupal server are one and the same (not the case in most instances), the files must be physically copied over to the streaming server. This is the bulk of what the FlashVideo Streaming module accomplishes.

mrfelton’s picture

@attheshow: I simply meant about using form_alter a little more rather than altering the core flashvideo.module. But, yes, I totally understand what you are saying. However, In my case, I do not have the resources to dedicate a separate server to streaming, yet I do want to offer stream-like capabilities - xmoov-php can do just that. And so in my case, the streaming module only needs to be turned on, and told the path to the xmoov-php.php script, which lives on the same server as Drupal, and the video files do not need to be moved/copied anywhere.

attheshow’s picture

mrfelton,

That sounds like it might be a fairly common setup in which to use xmoov-php, and sounds like it might be useful to a lot of people interested in streaming.

As far as my motivations for my two modifications to the core FlashVideo module (one in the module, one in the admin include), I did this primarily so that the form alterations received logical placement. I found it difficult to use form_alter and get these new form elements placed correctly. Can you think of a way to use form_alter and get those two elements placed in the same locations that I've got them currently? I found it to be impossible unless I rewrote the forms a lot and put weights everywhere, which I didn't like doing.

mrfelton’s picture

attheshow,

I can see that you wanted the streamer url textfield inserted into the Player settings fieldset, which does kind of make sense, although to be honest I found that rather confusing since the streaming options were all together at the bottom the problem of the page in their own fieldset, except that one. Also, that setting does not appear in the main Player fieldset until you have turned it on - ie. I go to the bottom and turn on streaming, but it is not until I submit the form and go and look in the Player settings fieldset again that I find this new option!

Anyway, regardless of the form element placement, if these two modules are to play nicely together, there needs to be some kind of way of ensuring that only one streaming plugin can be enabled per content type. As I see it, either this would need to be built into the main flashvideo module itself, or flashvideo_streaming itself should be more of a meta module providing plugin functionality for various streaming backend provider modules

Thoughts?

attheshow’s picture

StatusFileSize
new60.6 KB

I'm working on trying to integrate these two things, but I have to take a break for a few hours. :) I think I've got a good configuration figured out (see screenshot), but the API functions such as flashvideo_get_file become tricky when trying to make them run based on the node type. I'll keep you posted.

I guess you must be envisioning a scenario when a user would want to stream one content type and not another? I personally haven't considered that a realistic scenario, but maybe you can think of a use case when that would be necessary?

mrfelton’s picture

I like the screenshot.

In my case for instance, we have many small audio clips which have a low play count and we have no desire to move them to a separate streaming server. At the same time, we sometimes host some very popular video clips and are considering having these hosted for us on an external rtmp streaming server to take the load off our own servers. The ability for us to choose the streaming server per content type would give us the flexibility that we need to be able to keep our costs as low as possible.

I look forward to testing out your new code :) If there is anything I can do to help please let me know.

ps. I just reworked my validation handler a little to ensure that the path to xmoov-php was valid - perhaps you could incorporate if you haven't already.

function flashvideo_xmoov_admin_validate($form, &$form_state) {
  $node_type = $form['#parameters'][2];
  
  // Set the path to the streamer based on if they want to use the drupal root or not...
  $useroot = $form_state['values']['flashvideo_'. $node_type .'_xmoov_userootpath'];
  $user_path = $form_state['values']['flashvideo_'. $node_type .'_xmoov_streamer'];
  
  $xmoov_path = $useroot ? base_path() . $user_path : file_directory_path() .'/'. $user_path;

  // Check the xmoov path to make sure it exists..
  if(!file_exists(getcwd().$xmoov_path)) {
    form_set_error('flashvideo_'. $node_type .'_xmoov_streamer', "Can not find xmoov-php at ". $xmoov_path);
  }
  $form_state['values']['flashvideo_'. $node_type .'_streamer'] = $xmoov_path;
  $form_state['values']['flashvideo_'. $node_type .'_xmoov_streamer'] = $user_path;
}
perandre’s picture

I'm excited!

attheshow’s picture

mrfelton,

I want to put an example path into the description for the xmoov-php script path. Can you give us an example of the sort of path that would be entered into that box?

attheshow’s picture

Ok, here's a pass at combining everything together. I haven't been able to test this because I'm working from home today, but I'd appreciate any input or testing you can do.

Note, this patch and module go with the latest dev version of the module.

mrfelton, I'll put in that example path if you can provide one later on.

attheshow’s picture

StatusFileSize
new8.81 KB

A couple more minor changes to the module. Last patch still applies.

mrfelton’s picture

Great, I'll give this a test tomorrow.

Regarding the example of the path to xmoov-php. I don't really know the best place to put it, but on my setup I had it as follows it is as follows:

If relevant to the drupal root, I put it in the global files directory: files/xmoov-php.php
otherwise I had it in the sites files directory, in which case the path was simply: xmoov-php.php

of course, for this to work, xmoov-php.php also needs to be configured correctly and this was the one limitation I had with my version of the module. xmove-php needs to be configured with the two paths hardcoded into the script:

XMOOV_PATH_ROOT = /path/to/drupal/root/
XMOOV_PATH_FILES = path/toflv/output/directory

It would be nice if we could actually distribute this with our own version of xmoov-php where we could set these values dynamically, based on the known location of the flv files, but I expect that the licencing of xmoov-php would somehow forbid this - I haven't looked into this at all since it was not to much bother to enter these values manually.

Thanks for all your work on this, I look forward to giving it a try tomorrow.

asak’s picture

Wow. subscribing.

mrfelton’s picture

Just did a very quick test - none of my streaming settings are being saved.

mrfelton’s picture

StatusFileSize
new3.89 KB

Try with this patch. Seems to do the trick for me, although I haven't tested extensively.

mrfelton’s picture

Well, saving settings works now. But trying to view a node with an embeded video results in the following error several times:

warning: Missing argument 2 for flashvideo_streaming_flashvideo_get_file() in /home/tom/public_html/concern-6.x/sites/all/modules/flashvideo_streaming/flashvideo_streaming.module on line 176.

It seems in flashvideo_streaming to you are expecting hook_flashvideo_get_file() to be called with a second parameter - the node type, yet this isn't passed to it anywhere in flashvideo.module. Looks like the same thing with hook_flashvideo_save_file() too. I'm using the latest dev version of flashvideo. Perhaps you forgot to commit something?

perandre’s picture

I confirm that streaming settings are not being saved (using the files from #25 and #26).
-And I confirm that the streaming URL-field is now under RTMP Server Configuration :)

mrfelton’s picture

perandre: can you try applying my patch and see if the vars save properly?

perandre’s picture

@ mrfelton: The patch (#30) did not solve it, it seems. The behavior changed; instead of leaving the RTMP URL-field with a "0" (default), it showed up with "sites/default/files/0" after saving. I entered a URL in the format "rtmp://ipforthestreamingserver/subfolder".

Edit: It did however save the path to xmoov-php.php.

attheshow’s picture

I'm going to go ahead and add this module to the FlashVideo plugins directory so that it will appear as part of the dev package. That way we don't have to do so much manual labor to experiment with the code on this.

perandre’s picture

Great! Keep us posted about further development; I'm happy to test!

attheshow’s picture

Status: Needs review » Fixed

Marking as fixed since it's now committed and seems to be working. If we have further bugs or features on this, please start a new issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.