My .FLV files play just fine in the JW player, but when loading an .MP4 file, the quicktime player loads.

How do I set up the jquery media plugin to load .MP4 files in the JW player?

Files: 
CommentFileSizeAuthor
#16 jquery.media_.js_.txt15.22 KBseaneffel
#6 jquery.media_.js_.txt14.8 KBB.P.B

Comments

B.P.B’s picture

Status:Active» Fixed

I fixed it. It was a matter of changing some code around in jquery.media.js

aaron’s picture

You could also call $.fn.media.mapFormat('mp4', 'flash'); on the page. I think there's already a todo to add this functionality to the UI for this module.

Anonymous’s picture

Status:Fixed» Closed (fixed)

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

txcrew’s picture

Where do you put this on the page?
<?php drupal_add_js($.fn.media.mapFormat('mp4', 'flash');)

I'm using contemplate.

TIA,
txcrew

txcrew’s picture

Status:Closed (fixed)» Active

Sorry, you can ignore that <?php drupal_add_js

txcrew

B.P.B’s picture

StatusFileSize
new14.8 KB

txcrew,

Attached is my modified jquery.media.js file.

seaneffel’s picture

Status:Active» Needs review
akolahi’s picture

Thanks for the update! it fixed the issue for me.

txcrew’s picture

Fixed for me too.

Thanks much!

txcrew

seaneffel’s picture

Aaron, I've tested this and it does play MP4 video through the flash player - though while I hear audio I am not getting video yet. I'll check other issues and see whats up with this.

kalesco’s picture

Same here! I successfully added the Player to my node and got it to play the video file. But there's no video, only the audio!
It would be great, if someone could find a solution!
Thank you!

seaneffel’s picture

Status:Needs review» Reviewed & tested by the community

I found this too, and I don't think it has anything to do with the module or Drupal. I'm pretty sure its a weakness in the media player itself. MP4 files don't play back right, often the video stays black while the audio plays fine.

A recommendation from the media player website is to encode MP4 files in h.264 before uploading. I just did this with about 2 gigs of movie files, re-encoded and re-uploaded the entire video directory, and now everything is peachy.

Follow up on this issue over on the media player website so that the author of this flash app can try to address the root problem:

http://www.longtailvideo.com/support/forum/Setup-Problems/14239/Problems...

Until then, I think that the new file up there on reply #6 is a winner.

aaron’s picture

Status:Reviewed & tested by the community» Needs work

I just replaced jquery.media.js version 0.81 with 0.84, just available a couple of weeks ago. Could you try out on that version, available from the dev version (in CVS just now) and see if it helps? If not, we'll need to make the relevant changes to that file, and file an issue at http://malsup.com/jquery/media/

Thanks,
Aaron

seaneffel’s picture

Aaron, no dice. The new 0.84 file does not play MP4 files through the player. The quicktime player takes over instead of the media player. The original 0.81 file also behaves the same way. The edited 0.81 file from B.P.B. on #6 is the only version playing MP4 files through the media player.

seaneffel’s picture

Oh, Aaron, also I'm working on Drupal 5. I don't think this matters in this case because your jquery.media.js files look the same from D5 to D6.

seaneffel’s picture

Status:Needs work» Needs review
StatusFileSize
new15.22 KB

I know this isn't the orthodox way to share code, but I never learned how to create patches and stuff. These are the changes to the jquery.media.js 0.84 file to match the changes to BPB's changes to the earlier file on reply #6. It was just one addition to a line of code right about line 312. Also attached the edited file. This little change is allow all of my MP4 files to play properly in the media player. Someone else give it a test to verify?

// map flv and mp3 files to the swf player by default
$.fn.media.mp4 = $.fn.media.flv = $.fn.media.mp3 = function(el, opts) {
    var src = opts.src;
    var player = /\.mp3\b/i.test(src) ? $.fn.media.defaults.mp3Player : $.fn.media.defaults.flvPlayer;
    var key = opts.flvKeyName;
    src = encodeURIComponent(src);
    opts.src = player;
    opts.src = opts.src + '?'+key+'=' + (src);
    var srcObj = {};
    srcObj[key] = src;
    opts.flashvars = $.extend({}, srcObj, opts.flashvars );
    return $.fn.media.swf(el, opts);
};
Agileware’s picture

I have tried with jquery.media.js 0.78, 0.84 and 0.87 and still I just get the audio and not the video.

Agileware’s picture

This issue has a duplicate at http://drupal.org/node/328701

There is a patch on that issue (comment #3) that works in a preferable manner to this one (gives an option in the settings screen). I have tested that patch and it works the same as the changes in this issue but still the video isn't playing.

Agileware’s picture

Because the video file is being picked up and rendered in the JW FLV player I assume this modue with this patch is doing what it should be but the JW FLV player is failing to do what it should be doing as it is not playing the video file back properly.

Has anyone been able to view mp4 audio and video in JW FLV player and this module?

seaneffel’s picture

Yes, I am playing H.264 MP4 files with jquery_media.module and mediaplayer in Drupal 5. I'm trying to figure out why I can't get it to work with Drupal 6 and its driving me crazy.

To make it work with D5 I used the changes in jquery.media.js from above. H.264 video with MPEG4 audio turns up silent, so I choose a different codec when encoding media.

Example:
http://www.cctvcambridge.org/emmas

seaneffel’s picture

Status:Needs review» Closed (duplicate)

I'm marking this one as a duplicate because there is another issue with a working and now well-tested patch. Take any followup on this issue to this one instead:

http://drupal.org/node/328701