CVS edit link for LongTail Video
The JW Player for Flash Module has been designed to enable Drupal users to deliver video content through their Drupal websites. It is meant to be the official module for embedding the JW Player and has been developed by LongTail Video, the creator of the JW Player.The development of this module is part of a greater initiative by LongTail Video. Due to the popularity of the JW Player and the fact that many users are employing CMS solutions we feel that we should improve the ease at which the JW Player can be deployed in these systems. This module is designed to simplify the use of the JW Player in Drupal for our users.
It provides support for all of the player’s configuration options, including skins, plugins and the LongTail Ad Solution. In addition, it supports a tag system that allows for dynamic customization at embed time, providing the capability of referencing external video content or node attachments created by the Upload module.
Based on our research there are currently only a small number of modules that deal with video content, and fewer still that work with the JW Player. Having investigated these modules we feel they do not leverage the full capabilities of our player. Namely they provide inadequate support for the numerous plugins available for the JW Player, and they do not directly support the LongTail Ad Solution. In addition our tagging system is much more robust and provides a lot more customization at embed time.
Our module is currently ready for a version 1 release and a list of additional features have already been outlined for subsequent releases.
As a result, we feel this module will be a valuable contribution to the Drupal community.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | jwplayermodule.zip | 369.59 KB | JW Player |
| #1 | jwplayermodule.zip | 454.68 KB | JW Player |
Comments
Comment #1
JW Player commentedComment #2
avpadernoComment #3
atheneus commentedOn the whole this looks good. There are a few points though:
Some minor issues to point out:
™instead.The licensing issue is major and needs to be resolved. I would also say implementing an uninstall to clean up what you write to the variables table is also necessary. For example, I'm not even going to install this to see how well it works until I know I can remove it cleanly.
Comment #4
atheneus commentedComment #5
JW Player commentedThanks for the feedback.
In regards to the licensing issue for swfobject.js I have two questions.
1. Would it be acceptable to refer to Google's own hosted version of swfobject.js as opposed to including it?
2. Our player is not available under GPL 2 so would it be possible to include the download of the .swf file as part of the install hook?
Ultimately, we would like to make setup of this module as streamlined as possible and not require the user to have to perform several non-Drupal related steps.
The clean up issue will be addressed and was an oversight on my part.
The coding standard issue is a bit complicated. As you've probably noticed the .module file adheres to the Drupal coding standards. However, the PHP files in the framework directory will likely evolve into a framework for developing plugins for other web platforms. As such, I would prefer to have those files adhere to the LongTail Video coding standards if possible.
The trademark symbol will be updated to be properly encoded.
Thanks again for your time.
Comment #6
atheneus commentedThe license restrictions apply to what can be hosted on cvs.drupal.org. Provided the actual licensed files are not hosted by Drupal you can include them. I think using the Google CDN would be acceptable, though I would suggest making this configurable to allow users to download their own local copy if they want/need to. That's just a suggestion for something that could be added later.
For your player, trying to do an automated download and install would trigger some concerns about security and also filesystem permissions on shared hosting environments. Allowing the web server access to modify module code opens up a whole can of little security worms.
I'd want someone a little more heavyweight than me to assess any attempt at downloading and installing code from a module installer. If you attempted that I think there would need to be very close scrutiny for security issues. I might suggest looking at the Plugin Manager module: http://drupal.org/project/plugin_manager - perhaps doing something in collaboration with this project would be the right approach for streamlining the install process and in a way that other similar modules could leverage.
On the coding standard issues, it's obvious that you have used variable naming standards in jwplayer.module except for a couple that got missed. For external library files that will be used in other contexts outside of Drupal there is no Drupal coding standard requirements, obviously, but they should be treated as external libraries. The recommended way of integrating Drupal modules with such libraries is to install them in a separate 'libraries' directory on the same directory level as the contributed 'modules' directory. E.g. 'sites/all/libraries'. That way other modules can easily share your framework files even if the rest of your module is not installed, without having their own copy local to their module.
With the framework libraries all licensing requirements for hosted files would obviously apply. If the framework libraries are GPL 2 even if the player itself isn't it can be hosted on cvs.drupal.org.
On the positive side. I really like your player and the additional capabilities that it gives webmasters. The fact that you are including a free version of the player and trying to make things easy for your users indicate to me that this would be a very well maintained and supported project.
Comment #7
avpadernoatheneus is correct in what he says; I will just add a note about coding standards.
All PHP code hosted in Drupal.org CVS should be written following Drupal coding standards; if there would be two different standards, then a module could not respect its namespace (simply because the other standard doesn't contemplate such thing that is clearly contemplated by Drupal), and that is not something we want for module / themes hosted in Drupal.org.
Comment #8
JW Player commentedThanks for the reply.
It certainly would not be a problem to add the ability to host your own version of the swfobject.js. We will include this functionality in the next version.
In regards to the automated download of the player.swf I can understand your concerns. However, it would only be the download of the player.swf (which is a binary), there would be no installation or download of additional code. Is this still a concern? It would not be much different than the user manually downloading the file themselves. We really want to make getting live with video as easy as possible.
Out of curiosity, how does distribution of libraries work? Is there a repository for them and a standard means of installing them? I'm just thinking of what extra steps would be required of the user.
Comment #9
atheneus commentedWith regard to the security of file management practices applicants for a CVS account are expected to be aware of all security best practices and to follow them. A couple of handbook pages that you should refer to are:
https://drupal.org/node/117054 - File management security best practices
https://drupal.org/node/244924 - Securing file permissions & ownership
With regard to the management of external libraries, there is a project currently in active development to handle just that:
http://drupal.org/project/libraries
Provided your code is secure and you are handling external libraries sensibly with a view to working well with other modules, then there's no real problem.
One thing to point out with regard to file permissions, if you place a binary in a directory where PHP code will be stored, this could be a problem if you require that directory to be writable by the web server, it would make it difficult for the site owner to secure their site in accord with the recommended best practices. Please be sensitive to that issue, not just the security of your own code, but the overall security of a complete site installation.
Comment #10
JW Player commentedHi Atheneus,
I've read over the documentation you have provided. It sounds like the general rule of thumb is to limit Apache to read only status unless it's a special directory where users can upload content. An obvious example being the sites/all/files directory used by the Upload module which we support.
In your review of the code you likely noticed that I'm creating XML files in a separate configs directory. You didn't make note of this as a problem. I'm assuming this is because I'm creating these files in a separate directory that does not contain executable code. Is this correct?
Since the ultimate goal is to restrict Apache's access to directories containing executable code would it not be sufficient to download the player.swf to a separate directory?
As for the library issue that sounds like it would add unneeded complexity. I will go ahead and apply the Drupal coding standards to the LongTail Framework classes.
Comment #11
JW Player commentedI have made the coding standards changes to the LongTail Framework classes. I can't really submit the updated code yet as the answer to whether or not I can download the .swf to a separate directory will obviously require code changes either way.
We would really like to move ahead with this module.
Comment #12
JW Player commentedComment #13
arthurf commentedAny interest in taking over http://drupal.org/project/flvmediaplayer code? I wrote this to provide support for the JW player. There is quite a bit there that could be reused I think. There are also hooks to allow other modules to provide content directly to the player.
Comment #14
arthurf commentedoh, and on the swfobject question, you can use the jquery plugin module (http://drupal.org/project/jquery_plugin) and use flashembed. I did an implementation of this for the JW player like this:
Javascript is simple:
Comment #15
aaron commentedI'd like to see the other changes you've made. Also, looks like the doxygen could use some cleanup, at least by adding @file sections and wrapping comments to 80 characters. See http://drupal.org/node/1354. Additionally, we don't end php files with ?> (as you've done, for instance, in LongTailFramework.php).
Much of that module could probably be broken into smaller include files to make it lighter to load. At the very least, hook_theme allows 'file' parameters for auto-loading. Same with hook_menu(). You can also make use of http://api.drupal.org/api/function/module_load_include/6 in a few judiciously chosen places, although just moving the admin screen, admin helper, and theme functions out should do wonders.
//Drupal automatically convers URLs into <a> tags. Must strip this out.It automatically converts URLs into a tags ONLY when going through the URL filter, which although enabled initially, may not actually happen. As written, your module appears not to honor the filter settings, which means an editor would have no recourse to override the behavior if desired. (Normally, one would simply choose another filter, if they wanted to override that.)
I'm a little concerned about the current usage of hook_nodeapi for its filter; that would normally happen through hook_filter, which would have the benefit of working automatically with comments as well, and for text fields. It would also allow admins to disable the filter for certain node types, which may be necessary for security or layout issues. However, you would need to do some trickiness to add the JS as needed; perhaps by simply adding it automatically with hook_init, which many modules take the liberty of doing. As far as the issue w/ the URL filter processing would be easily solved by adding your filter above that, so the tags are not removed inadvertently.
I think for the module to be more widely accepted and used by the developer community, it needs to expose its API a bit more. I know that's substantially more work, and may not be necessary for an initial code review. However, I would hope to at least see that in the planned road map.
I really appreciate your offering to come on board with Drupal integration; there are a lot of Drupal sites that use your player. I hope you don't take my suggestions as criticism; it's tricky to write code reviews without sounding too critical. I also recognize that you presumably come from another coding background, and I applaud your efforts: Drupal is tricky enough when its API changes every year and a half. I'm impressed by the general level of the code; you've made an obvious effort to adhere to current Drupal standards, for instance by wrapping outputted text with t() and by using Drupal behaviors in the js (although I note that it should really be namespaced as in Arthur's example above).
Finally, I'm concerned about code duplication: there are already a few modules integrating the JW Flash Player, some of which are more mature and stable. I think you might be better off taking up Arthur's offer of co-maintainership; firstly, that module is used by a large number of sites anyway, and secondly, it might help it be of more use to other modules (for instance, the Embedded Media Module already utilizes its API for embedding YouTube modules w/ the JW player).
Thanks,
Aaron Winborn
Comment #16
JW Player commentedArthur and Aaron -Thanks for the additional feedback.
In regards to the documentation (doxygen) issue I will definitely make the effort to clean up the documentation and ensure that it wraps at 80 characters.
I will remove the ‘?>’ tags from the framework classes.
I will break up the module into smaller files. This was neglected in an effort to get the module out quicker.
The hook_filter vs. hook_nodeapi was a tricky issue for me during development. In my initial implementation I had made use of hook_filter for the exact reasons you mention. However, one of the key pieces of functionality that this module was intended to provide was allowing player embeds to reference node attachments. Hook_filter does not provide a reference to the node so I was not able to reference the attachments. As a result I switched to using hook_nodeapi as this gave me the node reference I needed. I believe Arthur also makes use of hook_nodeapi as well.
Aaron, is there any way to get around this problem? I should note that I only apply the regex to strip out the html tags to the [jwplayer] tag and leave the rest of the node content untouched.
In regards to the API, I made two functions available, most notably the function that generates the embed code for the player. What kinds of things are you looking for in this API? Maybe this is a case where I can take up Arthur on his offer and use his API as a model.
We did consider reaching out to other module developers and I personally reviewed a number of modules as part of my initial research before beginning development. Support for the player was varying and since this is an important part of building the ecosystem around the JW Player we ultimately decided to create our own. You can be assured that this will be a well maintained module and will mature very quickly.
Comment #17
JW Player commentedActually I had some additional questions.
You mentioned a roadmap for the module. Much of what you outlined here was already added as part of the roadmap for this module. We have some additional features we would like to add already planned out as well. However, solidifying this roadmap is somewhat difficult without actually having the product live on the Drupal site.
In regards to getting the module live on your site, I’m curious as to what the bar for approval is. Does it still need to be reviewed by more people? Do we need to implement all the changes listed in the feedback? We are excited to work with Drupal but some additional clarity into the process would be really helpful as it would help us better plan our development cycle.
Thanks,
Cameron
Comment #18
aaron commentedyes, that's a difficult limitation of hook_filter. there might not be a better way around it in d6. if you keep things in hook_nodeapi, you might at least configure it to use some node type settings to toggle functionality. for instance, one might want to allow videos in blog posts but not in articles. this can be even trickier with user permissions. however, if this is working off uploads, then perhaps that will be somewhat self-limiting, as file extensions and user perms are already fine-tuned w/ that. otoh, if your filter allows embedding content from anywhere (regardless of whether it's attached to a node) there might be more security issues to be dealt with.
re. the bar for approval: my personal opinion is your coding standards are up to par with what's expected from module contributors. However, I'd like to see another posting of your current progress before I'd feel comfortable marking the issue RTBC, just to see some closure on some of the discussed items. I think that the large majority of modules in the wild are perpetual works in progress, and if we required each module to be absolutely bug free and polished before release, we wouldn't have any modules available (or even a Drupal core for that matter)...
Thanks,
Aaron
Comment #19
arthurf commentedTotally understood that you'd want to roll your own given what's out there. There are a few things that I'd like to see from your module from my own selfish perspective (well largely because I want to convert all the flvmediaplayer users to use your module)
* some mechanism for a "use file" option- perhaps this is on the node object, which is done on node load. I do something (albeit quite poorly) with hook_flvmediaplayer_file_use() which allows modules to declare files accessible to the player. The reason why I want to do this is that I use xspf_playlist to deliver content to the player the majority of the time (so it implements hook_flvmediaplayer_file_use()) but sometimes I want this to be overridden. Having a hook that does this is handy and makes your module very extensible- think views, cck, etc
* support external configuration - I use node/X/flvmediaplayer/PROFILE to populate config data into the player. While this is another page load, it's extremely useful for postfacto changes- especially for embeded players. I think this is one of the best features of the JW player- one that is often overlooked.
I'm happy to contribute code or hand over flvmediaplayer to do this.
Comment #20
JW Player commentedHi guys,
Just to summarize the feedback and what's been done and what still needs to be done, I will break it down below.
Things I have currently changed:
- modified variable names to fall in line with the coding standards.
- the module now uses swfobject on the google cdn.
- The Player.swf is no longer included. Instructions have been included on how to get the Player. We will also be building a landing page on the LongTail site.
Things I will be changing.
- Documentation fixes and additional code standards updates.
- Breaking up the admin code into separate files.
Future Changes (Roadmap)
- Expanding the API
- User Permission level control of Player embeds
- Content level control over Player embeds
Once I change what I mentioned above I will upload the updated code. I'm currently in the middle of some other development so there will be a bit of delay before I can do so. Would this be a problem?
Thanks,
Cameron
Comment #21
JW Player commentedHi guys,
I have gone ahead and made the changes I listed, as well as a couple of bug fixes.
I look forward to hearing your feedback.
Thanks,
Cameron
Comment #22
aaron commentedI don't see anything glaring. I would suggest you utilize spl_autoload_register for autoloading classes rather than forcing the files on every page load, and I'm still wary about doing your magic in hook_nodeapi rather than as a filter or without any configuration for node types or content fields. The second would be a blocker for me using or recommending the module as it currently stands, but other users might not be so discerning, and there's nothing verboten about your method that I'm aware of.
Comment #23
avpadernoComment #26
avpaderno