I know that @rickvug's primary use case is playing uploaded files, but it would also be helpful to play files from URLs provided in Link fields. http://drupal.org/project/link

I'll be working on this today, and I'll provide a link to my fork shortly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

michaek’s picture

michaek’s picture

I've committed my changes to the github repository. In case I push any other commits, here's a tag of the current state: https://github.com/michaek/drupal_jw_player/tree/link_field-1494436

rickvug’s picture

@michaek Thank you for the patch (pull request, I guess I should say). The module should definitely support external video. I've been a bit hesitant to support link fields because I'd (personally) rather use http://drupal.org/project/remote_stream_wrapper which registers the link with the File API. I find cleaner and more correct. However I still see user requesting support for link fields so I guess I should add in support, perhaps with help text point out other options.

Can you talk me through what you're doing with the video provider code? At first glance I don't like the idea of building in support for different providers within the module itself as it should really only be about display. Via (upcoming) link field support, remote stream wrapper and Media YouTube (http://drupal.org/project/media_youtube) it should be possible to format the output of any file on a CDN or YouTube videos. Separately I do need to add in support for RTMP streaming using the flash video player.

Thanks again for your work on this! I hope to work with you on these issues. Note that I'm travelling a lot over the next few months and have spotty Internet access. I want to carve out some time to work on the module but can't offer any guarantee on response time.

michaek’s picture

Hi, @rickvug. I agree that including provider support in the module can be problematic. Other modules should be able to provide their own video_provider plugins, which is certainly a better pattern, though I haven't actually tested that.

As far as the remote_stream_wrapper goes, I don't think I understand the reason for treating remote files like files when PHP doesn't really have to do anything with the file other than to output its URL for jwPlayer. The media module, and its related provider modules, seemed like overkill to me.

rickvug’s picture

@michaek The nice thing with the remote stream wrapper is that the file URL will behave like any other Drupal file. This means that it can be formatted by any file based formatter, re-used by a media gallery, fields can be added by file entity, the files can be listed by views and so on. While I used to make "videos nodes" in Drupal 6 in most cases nodes no longer have any advantage over file entities. In some cases none of these advantages matter so a link field formatter is just simpler but in many (most?) cases I think it is a matter of users not understanding the new possibilities in Drupal 7. The situation with Media module trying to do everything doesn't help much. I wish that the module was split into separate projects in the way file entity was factored out.

michaek’s picture

I guess I just don't see the value in a file-based formatter for something that's (always) just a URL. Even for an uploaded video file, outputting a player for the file doesn't require us to know anything about the file other than the URL, so introducing some abstraction around the stream wrapper seems like design for design's sake.

HongPong’s picture

This may be helpful (or not), we were able to introduce a file-based formatter for link and text fields in the Views RSS module. the get_header() function grabs the needed length and content type strings. In our use case, a third-party server was being used to host media files so it was essential to use something besides the filefield, in order to get needed podcast metadata.
http://drupalcode.org/project/views_rss.git/commitdiff/69321d0

Hopiu’s picture

Is there any progress on this issue? If time is the problem, I'm willing to help.

John Bickar’s picture

Status: Active » Needs review
FileSize
7.06 KB

This functionality would be greatly appreciated. I've created a patch based on the current 7.x-1.x-dev and michaek's github sandbox project.

Berdir’s picture

Status: Needs review » Needs work
+++ b/jw_player.admin.incundefined
@@ -19,5 +19,34 @@ function jw_player_settings_form($form) {
+    '#description' => 'Choose the providers you\'d like your site to support.',

Missing t(), \' should not be used in translatable strings, instead use " for the string.

+++ b/jw_player.admin.incundefined
@@ -19,5 +19,34 @@ function jw_player_settings_form($form) {
+        '#title' => t('%name Settings', array('%name' => $name)),

Not sure if settings should be lower case here.

+++ b/jw_player.moduleundefined
@@ -166,11 +167,29 @@ function jw_player_field_formatter_view($entity_type, $entity, $field, $instance
+          // TODO: respect active provider setting.

todo's should be formatted with @todo, not sure if this is something that needs to be implemented in this patch or not.

+++ b/jw_player.moduleundefined
@@ -166,11 +167,29 @@ function jw_player_field_formatter_view($entity_type, $entity, $field, $instance
+            'file_path' => $url,
+            'file_mime' => 'video/mp4',

Might not be safe to hardcode this?

+++ b/plugins/video_provider/AbstractVideoProvider.class.phpundefined
@@ -0,0 +1,12 @@
+
+abstract class AbstractVideoProvider {
+  ¶
+  public function process_url(&$url, &$settings) {
+  }
+  ¶
+  public function global_settings() {
+    return array();

Should have some basic documentation on the class and the functions.

+++ b/plugins/video_provider/limelight.incundefined
@@ -0,0 +1,29 @@
+class LimelightVideoProvider extends AbstractVideoProvider {
+  ¶
+  public function process_url(&$url, &$settings) {
+    $parts = drupal_parse_url($url);

Same here.

+++ b/plugins/video_provider/youtube.incundefined
@@ -0,0 +1,31 @@
+require_once('AbstractVideoProvider.class.php');
+
+class YoutubeVideoProvider extends AbstractVideoProvider {

And here :)

Jorrit’s picture

Attached you'll find a patch that implements this feature request without adding any extras like video providers and such.

This is from #1395584: Provide image poster (with configuration to select the source) #20.

Berdir’s picture

Status: Needs work » Needs review
kingfisher64’s picture

#11 patch applied cleanly against 26th Jan 2013 dev version.

Hunk #1 succeeded at 59 (offset 1 line).
Hunk #2 succeeded at 162 with fuzz 1 (offset 1 line).
Jorrit’s picture

Rerolled the patch.

Artusamak’s picture

Status: Needs review » Needs work
+++ b/jw_player.module
@@ -162,7 +162,28 @@ function jw_player_field_formatter_view($entity_type, $entity, $field, $instance
+          if (substr($item['url'], -5) == '.webm') {
+            $mime = 'video/webm';
...
+            $mime = file_get_mimetype($item['url']);

This should not be here. Fix Drupal upstram if it's not doing the job.

Jorrit’s picture

I have tried that, but the effort is stranded in an issue that is growing hopelessly out of scope: #1443070: Add support for popular e-book formats, Google web formats, mkv and mka in file_default_mimetype_mapping().

garnett2125’s picture

#14 patch applied and works with 7.x-1.0-alpha1 version of jw_player.

Jorrit’s picture

Status: Needs work » Needs review
FileSize
1.89 KB

Here is a patch without the special treatment of files ending in .webm. Personally, I prefer the version from #14.

antpre’s picture

Hi, from a user's point of view this feature would be very welcome. hope it can be included soon.
I played a bit with remote_stream_wrapper and Media and found it a bit of an overkill.
This feature (ability to have link to play remote media files) is already operational in other player modules for Drupal (video.js player, media front..) it would be great to have it here.
This been said I am sorry I can't help (I m not a developer).
Good luck.

John Bickar’s picture

I rolled this functionality out into a separate module, that provides the formatter for link fields, and provides a scaffolded way to build the link URL. It's built with some specifics of our on-campus streaming video provider, but should work with any RTMP streaming URL.

Project on Github
tar.gz of latest release

deanflory’s picture

Issue summary: View changes

Has this still not be committed after that issue was fixed upstream in Drupal (#16)?

ron_s’s picture

Support for link fields exists in our recent 7.x-2.x patches. Please download 7.x-2.x-dev, add the following patches, and post if you have any issues or questions. Thanks.

* Refactor theming: https://www.drupal.org/node/2713725
* Add not empty checks and Repeat option: https://www.drupal.org/node/2719995
* Add js file to build player: https://www.drupal.org/node/2719977