views:

187

answers:

1

Background

I built a site for a film-production client. They needed a way to demo their showreels to the public and agreed upon a modal <iframe> approach (using jQuery and Fancybox) to showing their reels, all streamed via a third party provider.

You can see the functionality in action here: http://groundglass.co.za/directors/ by clicking on "View Reel" underneath each director photo.

The Bug

Try the following:

  1. Click 'View Reel'
  2. Wait for the video to start playing and then immediately:
  3. Close the modal window

At this point, other browsers unload the playing movie, but for some reason Safari carries on playing the video (You can hear the video playing, even if not visible).

Solution?

What can I do to get Safari to play nice? Fancybox has a callback function onClose. What should I do to the iframe to make it unload? Trying .remove() doesn't work, one can still hear the audio playing (and could be streaming too - what a waste of bandwidth!)

Thoughts? - Thanks!

--nd

A: 

Change the location of the iframe to a blank page when the dialog is closed.

Jonathan Sampson
Ahh yes. Something was wrong with my callback arguement, that explains it :) Thanks Jonathan.
ndorfin
to be clearer, onClose I called destroy_iframes() which just set the src attribute to: '#'.
ndorfin
It pays to be of average intelligence, we come up with easy solutions ;) You smart people think too much. Hehe.
Jonathan Sampson
lol, if I was smart, I'd know not to pass '$.destroy_iframes()' as the callbackOnClose. Changing it to '$.destroy_iframes' worked.Changes uploaded. Thanks again. :)
ndorfin