1

I am trying to get JW Player to work inside Fancy Box. Fancy Box opens OK at the dimensions set below, but the video doesn't display (this is on a server). An example link that I'm using on a page (which is on the same level as the scripts and content diectories - the mp4 is in the content directory)

<a href='content/brat.mp4' class='video' data-width="600" data-height="345" title='me'>Robot</a>

and in the page:

    $(".video").fancybox({
    fitToView: false, // to show videos in their own size
    content: '<span></span>', // create temp content
    scrolling: 'no', // don't show scrolling bars in fancybox
    afterLoad: function () {
      // get dimensions from data attributes
      var $width = $(this.element).data('width'); 
      var $height = $(this.element).data('height');
      // replace temp content
      this.content = "<embed src='scripts/jwplayer/jwplayer.swf?file=" + this.href + "&autostart=true&amp;wmode=opaque' type='application/x-shockwave-flash' width='" + $width + "' height='" + $height + "'></embed>"; 
    }
  });

in scripts/jwplayer/ there is jwplayer.flash.swf, jwplayer.js and jwplayer.html5.js

enter image description here

IlludiumPu36
  • 4,196
  • 10
  • 61
  • 100
  • 1
    I have always had a different approach to open videos with specific swf players, mostly using the `embed` method. If you are using fancybox v2.x check http://stackoverflow.com/a/14429717/1055987 and/or http://stackoverflow.com/a/14326919/1055987 for samples of code. – JFK Feb 08 '13 at 07:28
  • Thanks JFK, I had seen those and played around but no luck. I have edited my original question showing the code that I am now using from your second example. Again, fancy box pops up, but no video. I have also changed the link to suit as above. – IlludiumPu36 Feb 08 '13 at 08:24
  • notice that I am not using the `.click()` method in my examples ... and notice that you don't have `data-width` or `data-height` attributes in your link – JFK Feb 08 '13 at 08:42
  • Yep, just tried exactly the same and still no show...see edited question. – IlludiumPu36 Feb 08 '13 at 08:48
  • any chance to share a link to see the issue? ... I suspect is a path issue – JFK Feb 08 '13 at 08:50
  • your link targets to http://130.95.21.121/content/brat.mp4 and returns 404 error (not found) ... why you don't try an absolute path – JFK Feb 08 '13 at 08:55
  • ok, you found your video http://130.95.21.121/vpath/content/brat.mp4 so set `` (you had an unwanted `;`) – JFK Feb 08 '13 at 09:07
  • ... AND make sure that you have the right path for the jwplayer (it seems to have the same path issue) – JFK Feb 08 '13 at 09:11
  • Also, if I remove content: '', // create temp content the video plays in a full screen with what seems to be jwplayer – IlludiumPu36 Feb 11 '13 at 01:22
  • Sorted...the problem was jwplayer 6. I downloaded version 5 and all works! – IlludiumPu36 Feb 11 '13 at 02:09

1 Answers1

0

Sorted...the problem was jwplayer 6. I downloaded version 5 and all works!

http://developer.longtailvideo.com/trac/browser/tags/mediaplayer-5.3#js

Jeez...

IlludiumPu36
  • 4,196
  • 10
  • 61
  • 100
  • This is because in JW6 you need to use jwplayer.js to embed the player. In your code above is being used, which won't work with JW6. – emaxsaun Feb 11 '13 at 22:31
  • I have tried embedding with jwplayer.js using JW6 but can't get it to work. See http://stackoverflow.com/questions/14846926/jwplayer-in-fancybox-not-playing-on-ipad-iphone – IlludiumPu36 Feb 14 '13 at 02:53
  • This is because you need to use our JS embedder in this case. – emaxsaun Feb 14 '13 at 15:30