Bug Tracker

Changeset 2255

Show
Ignore:
Timestamp:
07/06/07 01:38:34 (1 year ago)
Author:
malsup
Message:

Improve support for mediabox on mac/ff platform.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/media/jquery.media.js

    r2074 r2255  
    99 * 
    1010 * @author: M. Alsup 
    11  * @version: 0.66 (6/08/2007) 
     11 * @version: 0.70 (7/05/2007) 
    1212 * @requires jQuery v1.1.2 or later 
    1313 * 
     
    2626 *     Other: bmp, html, pdf, psd, qif, qtif, qti, tif, tiff, xaml 
    2727 * 
    28  * Thanks to Mark Hicken for helping me debug this on Safari! 
     28 * Thanks to Mark Hicken and Brent Pedersen for helping me debug this on the Mac! 
    2929 */ 
    3030(function($) { 
     
    7070             
    7171            // post-conversion callback, passes original element, new div element and fully populated options 
    72             if (typeof f2 == 'function') f2(this, $div[0], o); 
     72            if (typeof f2 == 'function') f2(this, $div[0], o, player.name); 
    7373            break; 
    7474        } 
     
    8787$.fn.mediabox = function(options, css) { 
    8888    return this.click(function() { 
    89         if (typeof $.blockUI == 'undefined' || typeof $.fn.displayBox == 'undefined') { 
     89        if (typeof $.blockUI == 'undefined' || typeof $.blockUI.version == 'undefined' || $.blockUI.version < 1.26) { 
    9090            if (typeof $.fn.mediabox.warning != 'undefined') return this; // one warning is enough 
    9191            $.fn.mediabox.warning = 1; 
    92             alert('The mediabox method requires blockUI v1.20 or later.'); 
     92            alert('The mediabox method requires blockUI v1.26 or later.'); 
    9393            return false; 
    9494        } 
    95         var o, div=0, $e = $(this).clone(); 
     95        var o, p, div=0, $e = $(this).clone(); 
    9696        $e.appendTo('body').hide().css({margin: 0}); 
    9797        options = $.extend({}, options, { autoplay: 1 }); // force autoplay in box mode 
    98         $e.media(options, function(){}, function(origEl, newEl, opts) { 
     98        $e.media(options, function(){}, function(origEl, newEl, opts, player) { 
    9999            div = newEl; 
    100100            o = opts; 
     101            p = player; 
    101102        }); 
    102103        if (!div) return false; 
     
    117118        $div.displayBox( { width: o.width, height: o.height }, function(el) { 
    118119            // quirkiness; sometimes media doesn't stop when removed from the DOM (especially in IE) 
    119             $(el).find('object,embed').each(function() { 
     120            $('object,embed', el).each(function() { 
    120121                try { this.Stop();   } catch(e) {}  // quicktime 
    121122                try { this.DoStop(); } catch(e) {}  // real 
    122123                try { this.controls.stop(); } catch(e) {} // windows media player 
    123124            }); 
    124         }); 
     125        }, p == 'flash'); // <-- mac/ff workaround 
    125126        return false; 
    126127    }); 
     
    178179$.fn.media.defaults.players = { 
    179180    flash: { 
     181        name:         'flash', 
    180182        types:        'flv,mp3,swf', 
    181183        oAttrs:   { 
     
    190192    }, 
    191193    quicktime: { 
     194        name:         'quicktime', 
    192195        types:        'aif,aiff,aac,au,bmp,gsm,mov,mid,midi,mpg,mpeg,mp4,m4a,psd,qt,qtif,qif,qti,snd,tif,tiff,wav,3g2,3gp', 
    193196        oAttrs:   { 
     
    200203    }, 
    201204    realplayer: { 
     205        name:         'real', 
    202206        types:        'ra,ram,rm,rpm,rv,smi,smil', 
    203207        autoplayAttr: 'autostart', 
     
    211215    }, 
    212216    winmedia: { 
     217        name:         'winmedia', 
    213218        types:        'asf,avi,wma,wmv', 
    214219        autoplayAttr: 'autostart', 
     
    225230    // special cases 
    226231    iframe: { 
     232        name:  'iframe', 
    227233        types: 'html,pdf' 
    228234    }, 
    229235    silverlight: { 
     236        name:  'silverlight', 
    230237        types: 'xaml' 
    231238    }