Make WordPress Core

Ticket #33798: 4.4.monkey.diff

File 4.4.monkey.diff, 21.6 KB (added by wonderboymusic, 11 years ago)
  • Gruntfile.js

    diff --git a/Gruntfile.js b/Gruntfile.js
    index 6921ceb..67e3dc6 100644
    a b module.exports = function(grunt) { 
    166166            buildFlash: {
    167167                command: function() {
    168168                    grunt.config.set("cdnBuild", 'false');
    169                     grunt.config.set("debugBuild", 'false');                   
     169                    grunt.config.set("debugBuild", 'false');
    170170                    grunt.config.set("flashOut", 'local-build/flashmediaelement.swf');
    171171                    return grunt.config.get("buildFlashCommand");
    172172                }
    module.exports = function(grunt) { 
    174174            buildFlashCDN: {
    175175                command: function() {
    176176                    grunt.config.set("cdnBuild", 'true');
    177                                         grunt.config.set("debugBuild", 'false'); 
     177                                        grunt.config.set("debugBuild", 'false');
    178178                    grunt.config.set("flashOut", 'local-build/flashmediaelement-cdn.swf');
    179179                    return grunt.config.get("buildFlashCommand");
    180180                }
    module.exports = function(grunt) { 
    182182            buildFlashDebug: {
    183183                command: function() {
    184184                    grunt.config.set("debugBuild", 'true');
    185                     grunt.config.set("cdnBuild", 'true');                   
     185                    grunt.config.set("cdnBuild", 'true');
    186186                    grunt.config.set("flashOut", 'local-build/flashmediaelement-debug.swf');
    187187                    return grunt.config.get("buildFlashCommand");
    188188                }
    module.exports = function(grunt) { 
    194194        'shell:buildFlash', 'shell:buildFlashCDN', 'shell:buildFlashDebug', 'clean:temp']);
    195195
    196196    grunt.registerTask('html5only', ['concat', 'removelogging', 'uglify', 'cssmin', 'copy', 'clean:temp']);
    197 
     197       
     198        grunt.registerTask('noflash', ['concat', 'removelogging', 'uglify', 'cssmin', 'copy', 'clean:temp']);
    198199};
     200 No newline at end of file
  • src/js/me-shim.js

    diff --git a/src/js/me-shim.js b/src/js/me-shim.js
    index 648ef02..2d6a60f 100644
    a b mejs.MediaPluginBridge = { 
    3131                                        pluginMediaElement.pluginApi = pluginMediaElement.pluginElement.Content.MediaElementJS;
    3232                                        break;
    3333                        }
    34        
     34
    3535                        if (pluginMediaElement.pluginApi != null && pluginMediaElement.success) {
    3636                                pluginMediaElement.success(pluginMediaElement, htmlMediaElement);
    3737                        }
    mejs.MediaPluginBridge = { 
    5151                if(!pluginMediaElement){
    5252            return;
    5353        }
    54        
     54
    5555                // fake event object to mimic real HTML media event.
    5656                e = {
    5757                        type: eventName,
    mejs.MediaElementDefaults = { 
    107107        // streamer for RTMP streaming
    108108        flashStreamer: '',
    109109        // set to 'always' for CDN version
    110         flashScriptAccess: 'sameDomain',       
     110        flashScriptAccess: 'sameDomain',
    111111        // turns on the smoothing filter in Flash
    112112        enablePluginSmoothing: false,
    113113        // enabled pseudo-streaming (seek) on .mp4 files
    mejs.MediaElementDefaults = { 
    125125        // overrides <video height>
    126126        pluginHeight: -1,
    127127        // additional plugin variables in 'key=value' form
    128         pluginVars: [], 
     128        pluginVars: [],
    129129        // rate in milliseconds for Flash and Silverlight to fire the timeupdate event
    130130        // larger number is less accurate, but less strain on plugin->JavaScript bridge
    131131        timerRate: 250,
    mejs.HtmlMediaElementShim = { 
    166166                }
    167167
    168168                // clean up attributes
    169                 src =           (typeof src == 'undefined'      || src === null || src == '') ? null : src;             
     169                src =           (typeof src == 'undefined'      || src === null || src == '') ? null : src;
    170170                poster =        (typeof poster == 'undefined'   || poster === null) ? '' : poster;
    171171                preload =       (typeof preload == 'undefined'  || preload === null || preload === 'false') ? 'none' : preload;
    172172                autoplay =      !(typeof autoplay == 'undefined' || autoplay === null || autoplay === 'false');
    mejs.HtmlMediaElementShim = { 
    184184                                        htmlMediaElement.play();
    185185                                }, false);
    186186                        }
    187                
     187
    188188                        // add methods to native HTMLMediaElement
    189189                        return this.updateNative(playback, options, autoplay, preload);
    190190                } else if (playback.method !== '') {
    191191                        // create plugin to mimic HTMLMediaElement
    192                        
     192
    193193                        return this.createPlugin( playback,  options, poster, autoplay, preload, controls);
    194194                } else {
    195195                        // boo, no HTML5, no Flash, no Silverlight.
    196196                        this.createErrorMessage( playback, options, poster );
    197                        
     197
    198198                        return this;
    199199                }
    200200        },
    201        
     201
    202202        determinePlayback: function(htmlMediaElement, options, supportsMediaTag, isMediaTag, src) {
    203203                var
    204204                        mediaFiles = [],
    mejs.HtmlMediaElementShim = { 
    214214                        pluginInfo,
    215215                        dummy,
    216216                        media;
    217                        
     217
    218218                // STEP 1: Get URL and type from <video src> or <source src>
    219219
    220220                // supplied type overrides <video type> and <source type>
    221221                if (typeof options.type != 'undefined' && options.type !== '') {
    222                        
     222
    223223                        // accept either string or array of types
    224224                        if (typeof options.type == 'string') {
    225225                                mediaFiles.push({type:options.type, url:src});
    226226                        } else {
    227                                
     227
    228228                                for (i=0; i<options.type.length; i++) {
    229229                                        mediaFiles.push({type:options.type[i], url:src});
    230230                                }
    mejs.HtmlMediaElementShim = { 
    251251                                }
    252252                        }
    253253                }
    254                
     254
    255255                // in the case of dynamicly created players
    256256                // check for audio types
    257257                if (!isMediaTag && mediaFiles.length > 0 && mediaFiles[0].url !== null && this.getTypeFromFile(mediaFiles[0].url).indexOf('audio') > -1) {
    258258                        result.isVideo = false;
    259259                }
    260                
     260
    261261
    262262                // STEP 2: Test for playback method
    263                
     263
    264264                // special case for Android which sadly doesn't implement the canPlayType function (always returns '')
    265265                if (mejs.MediaFeatures.isBustedAndroid) {
    266266                        htmlMediaElement.canPlayType = function(type) {
    267267                                return (type.match(/video\/(mp4|m4v)/gi) !== null) ? 'maybe' : '';
    268268                        };
    269                 }               
    270                
    271                 // special case for Chromium to specify natively supported video codecs (i.e. WebM and Theora)
    272                 if (mejs.MediaFeatures.isChromium) {
    273                         htmlMediaElement.canPlayType = function(type) {
    274                                 return (type.match(/video\/(webm|ogv|ogg)/gi) !== null) ? 'maybe' : '';
    275                         };
    276269                }
    277270
     271                // special case for Chromium to specify natively supported video codecs (i.e. WebM and Theora)
     272                //if (mejs.MediaFeatures.isChromium) {
     273                //      htmlMediaElement.canPlayType = function(type) {
     274                //              return (type.match(/video\/(webm|ogv|ogg)/gi) !== null) ? 'maybe' : '';
     275                //      };
     276                //}
     277
    278278                // test for native playback first
    279279                if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'auto_plugin' || options.mode === 'native')  && !(mejs.MediaFeatures.isBustedNativeHTTPS && options.httpsBasicAuthSite === true)) {
    280                                                
     280
    281281                        if (!isMediaTag) {
    282282
    283                                 // create a real HTML5 Media Element 
    284                                 dummy = document.createElement( result.isVideo ? 'video' : 'audio');                   
     283                                // create a real HTML5 Media Element
     284                                dummy = document.createElement( result.isVideo ? 'video' : 'audio');
    285285                                htmlMediaElement.parentNode.insertBefore(dummy, htmlMediaElement);
    286286                                htmlMediaElement.style.display = 'none';
    287                                
     287
    288288                                // use this one from now on
    289289                                result.htmlMediaElement = htmlMediaElement = dummy;
    290290                        }
    291                                
     291
    292292                        for (i=0; i<mediaFiles.length; i++) {
    293293                                // normal check
    294294                                if (mediaFiles[i].type == "video/m3u8" || htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
    mejs.HtmlMediaElementShim = { 
    300300                                        result.url = mediaFiles[i].url;
    301301                                        break;
    302302                                }
    303                         }                       
    304                        
     303                        }
     304
    305305                        if (result.method === 'native') {
    306306                                if (result.url !== null) {
    307307                                        htmlMediaElement.src = result.url;
    308308                                }
    309                        
     309
    310310                                // if `auto_plugin` mode, then cache the native result but try plugins.
    311311                                if (options.mode !== 'auto_plugin') {
    312312                                        return result;
    mejs.HtmlMediaElementShim = { 
    323323                                for (j=0; j<options.plugins.length; j++) {
    324324
    325325                                        pluginName = options.plugins[j];
    326                        
     326
    327327                                        // test version of plugin (for future features)
    328                                         pluginVersions = mejs.plugins[pluginName];                             
    329                                        
     328                                        pluginVersions = mejs.plugins[pluginName];
     329
    330330                                        for (k=0; k<pluginVersions.length; k++) {
    331331                                                pluginInfo = pluginVersions[k];
    332                                        
     332
    333333                                                // test if user has the correct plugin version
    334                                                
     334
    335335                                                // for youtube/vimeo
    336                                                 if (pluginInfo.version == null || 
    337                                                        
     336                                                if (pluginInfo.version == null ||
     337
    338338                                                        mejs.PluginDetector.hasPluginVersion(pluginName, pluginInfo.version)) {
    339339
    340340                                                        // test for plugin playback types
    mejs.HtmlMediaElementShim = { 
    351351                                }
    352352                        }
    353353                }
    354                
     354
    355355                // at this point, being in 'auto_plugin' mode implies that we tried plugins but failed.
    356356                // if we have native support then return that.
    357357                if (options.mode === 'auto_plugin' && result.method === 'native') {
    mejs.HtmlMediaElementShim = { 
    368368
    369369        formatType: function(url, type) {
    370370                // if no type is supplied, fake it with the extension
    371                 if (url && !type) {             
     371                if (url && !type) {
    372372                        return this.getTypeFromFile(url);
    373373                } else {
    374374                        // only return the mime part of the type in case the attribute contains the codec
    375375                        // see http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#the-source-element
    376376                        // `video/mp4; codecs="avc1.42E01E, mp4a.40.2"` becomes `video/mp4`
    377                        
     377
    378378                        if (type && ~type.indexOf(';')) {
    379                                 return type.substr(0, type.indexOf(';')); 
     379                                return type.substr(0, type.indexOf(';'));
    380380                        } else {
    381381                                return type;
    382382                        }
    383383                }
    384384        },
    385        
     385
    386386        getTypeFromFile: function(url) {
    387387                url = url.split('?')[0];
    388388                var
    mejs.HtmlMediaElementShim = { 
    390390                        av = /(mp4|m4v|ogg|ogv|m3u8|webm|webmv|flv|wmv|mpeg|mov)/gi.test(ext) ? 'video/' : 'audio/';
    391391                return this.getTypeFromExtension(ext, av);
    392392        },
    393        
     393
    394394        getTypeFromExtension: function(ext, av) {
    395395                av = av || '';
    396                
     396
    397397                switch (ext) {
    398398                        case 'mp4':
    399399                        case 'm4v':
    mejs.HtmlMediaElementShim = { 
    405405                                return av + 'x-flv';
    406406                        case 'webm':
    407407                        case 'webma':
    408                         case 'webmv':   
     408                        case 'webmv':
    409409                                return av + 'webm';
    410410                        case 'ogg':
    411411                        case 'oga':
    412                         case 'ogv':     
     412                        case 'ogv':
    413413                                return av + 'ogg';
    414414                        case 'm3u8':
    415415                                return 'application/x-mpegurl';
    mejs.HtmlMediaElementShim = { 
    421421        },
    422422
    423423        createErrorMessage: function(playback, options, poster) {
    424                 var 
     424                var
    425425                        htmlMediaElement = playback.htmlMediaElement,
    426426                        errorContainer = document.createElement('div'),
    427427                        errorContent = options.customError;
    428                        
     428
    429429                errorContainer.className = 'me-cannotplay';
    430430
    431431                try {
    mejs.HtmlMediaElementShim = { 
    452452        },
    453453
    454454        createPlugin:function(playback, options, poster, autoplay, preload, controls) {
    455                 var 
     455                var
    456456                        htmlMediaElement = playback.htmlMediaElement,
    457457                        width = 1,
    458458                        height = 1,
    mejs.HtmlMediaElementShim = { 
    477477                // check for placement inside a <p> tag (sometimes WYSIWYG editors do this)
    478478                node = htmlMediaElement.parentNode;
    479479
    480                 while (node !== null && node.tagName != null && node.tagName.toLowerCase() !== 'body' && 
     480                while (node !== null && node.tagName != null && node.tagName.toLowerCase() !== 'body' &&
    481481                                node.parentNode != null && node.parentNode.tagName != null && node.parentNode.constructor != null && node.parentNode.constructor.name === "ShadowRoot") {
    482482                        if (node.parentNode.tagName.toLowerCase() === 'p') {
    483483                                node.parentNode.parentNode.insertBefore(node, node.parentNode);
    mejs.HtmlMediaElementShim = { 
    489489                if (playback.isVideo) {
    490490                        width = (options.pluginWidth > 0) ? options.pluginWidth : (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
    491491                        height = (options.pluginHeight > 0) ? options.pluginHeight : (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
    492                
     492
    493493                        // in case of '%' make sure it's encoded
    494494                        width = mejs.Utility.encodeUrl(width);
    495495                        height = mejs.Utility.encodeUrl(height);
    496                
     496
    497497                } else {
    498498                        if (options.enablePluginDebug) {
    499499                                width = 320;
    mejs.HtmlMediaElementShim = { 
    508508                // add container (must be added to DOM before inserting HTML for IE)
    509509                container.className = 'me-plugin';
    510510                container.id = pluginid + '_container';
    511                
     511
    512512                if (playback.isVideo) {
    513513                                htmlMediaElement.parentNode.insertBefore(container, htmlMediaElement);
    514514                } else {
    mejs.HtmlMediaElementShim = { 
    551551                }
    552552                if (options.pluginVars) {
    553553                        initVars = initVars.concat(options.pluginVars);
    554                 }               
     554                }
    555555
    556556                switch (playback.method) {
    557557                        case 'silverlight':
    mejs.HtmlMediaElementShim = { 
    581581'<param name="wmode" value="transparent" />' +
    582582'<param name="allowScriptAccess" value="' + options.flashScriptAccess + '" />' +
    583583'<param name="allowFullScreen" value="true" />' +
    584 '<param name="scale" value="default" />' + 
     584'<param name="scale" value="default" />' +
    585585'</object>';
    586586
    587587                                } else {
    mejs.HtmlMediaElementShim = { 
    600600'flashvars="' + initVars.join('&') + '" ' +
    601601'width="' + width + '" ' +
    602602'height="' + height + '" ' +
    603 'scale="default"' + 
     603'scale="default"' +
    604604'class="mejs-shim"></embed>';
    605605                                }
    606606                                break;
    607                        
     607
    608608                        case 'youtube':
    609                        
    610                                
     609
     610
    611611                                var videoId;
    612612                                // youtu.be url from share button
    613613                                if (playback.url.lastIndexOf("youtu.be") != -1) {
    mejs.HtmlMediaElementShim = { 
    626626                                                pluginId: pluginid,
    627627                                                videoId: videoId,
    628628                                                height: height,
    629                                                 width: width   
    630                                         };                             
    631                                
     629                                                width: width
     630                                        };
     631
    632632                                if (mejs.PluginDetector.hasPluginVersion('flash', [10,0,0]) ) {
    633633                                        mejs.YouTubeApi.createFlash(youtubeSettings, options);
    634634                                } else {
    635                                         mejs.YouTubeApi.enqueueIframe(youtubeSettings);         
     635                                        mejs.YouTubeApi.enqueueIframe(youtubeSettings);
    636636                                }
    637                                
     637
    638638                                break;
    639                        
     639
    640640                        // DEMO Code. Does NOT work.
    641641                        case 'vimeo':
    642642                                var player_id = pluginid + "_player";
    643643                                pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
    644                                
     644
    645645                                container.innerHTML ='<iframe src="//player.vimeo.com/video/' + pluginMediaElement.vimeoid + '?api=1&portrait=0&byline=0&title=0&player_id=' + player_id + '" width="' + width +'" height="' + height +'" frameborder="0" class="mejs-shim" id="' + player_id + '" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
    646646                                if (typeof($f) == 'function') { // froogaloop available
    647647                                        var player = $f(container.childNodes[0]);
    648                                        
     648
    649649                                        player.addEvent('ready', function() {
    650                                                
     650
    651651                                                player.playVideo = function() {
    652652                                                        player.api( 'play' );
    653                                                 } 
     653                                                }
    654654                                                player.stopVideo = function() {
    655655                                                        player.api( 'unload' );
    656                                                 } 
     656                                                }
    657657                                                player.pauseVideo = function() {
    658658                                                        player.api( 'pause' );
    659                                                 } 
     659                                                }
    660660                                                player.seekTo = function( seconds ) {
    661661                                                        player.api( 'seekTo', seconds );
    662662                                                }
    mejs.HtmlMediaElementShim = { 
    671671                                                                player.api( 'setVolume', player.lastVolume );
    672672                                                                delete player.lastVolume;
    673673                                                        }
    674                                                 }                                               
     674                                                }
    675675
    676676                                                function createEvent(player, pluginMediaElement, eventName, e) {
    677677                                                        var event = {
    mejs.HtmlMediaElementShim = { 
    712712                                else {
    713713                                        console.warn("You need to include froogaloop for vimeo to work");
    714714                                }
    715                                 break;                 
     715                                break;
    716716                }
    717717                // hide original element
    718718                htmlMediaElement.style.display = 'none';
    mejs.HtmlMediaElementShim = { 
    720720                htmlMediaElement.removeAttribute('autoplay');
    721721
    722722                // FYI: options.success will be fired by the MediaPluginBridge
    723                
     723
    724724                return pluginMediaElement;
    725725        },
    726726
    727727        updateNative: function(playback, options, autoplay, preload) {
    728                
     728
    729729                var htmlMediaElement = playback.htmlMediaElement,
    730730                        m;
    731                
    732                
     731
     732
    733733                // add methods to video object to bring it into parity with Flash Object
    734734                for (m in mejs.HtmlMediaElement) {
    735735                        htmlMediaElement[m] = mejs.HtmlMediaElement[m];
    mejs.HtmlMediaElementShim = { 
    738738                /*
    739739                Chrome now supports preload="none"
    740740                if (mejs.MediaFeatures.isChrome) {
    741                
     741
    742742                        // special case to enforce preload attribute (Chrome doesn't respect this)
    743743                        if (preload === 'none' && !autoplay) {
    744                        
     744
    745745                                // forces the browser to stop loading (note: fails in IE9)
    746746                                htmlMediaElement.src = '';
    747747                                htmlMediaElement.load();
    mejs.HtmlMediaElementShim = { 
    765765
    766766                // fire success code
    767767                options.success(htmlMediaElement, htmlMediaElement);
    768                
     768
    769769                return htmlMediaElement;
    770770        }
    771771};
    mejs.YouTubeApi = { 
    791791        },
    792792        iframeQueue: [],
    793793        enqueueIframe: function(yt) {
    794                
     794
    795795                if (this.isLoaded) {
    796796                        this.createIframe(yt);
    797797                } else {
    mejs.YouTubeApi = { 
    800800                }
    801801        },
    802802        createIframe: function(settings) {
    803                
     803
    804804                var
    805                 pluginMediaElement = settings.pluginMediaElement,       
     805                pluginMediaElement = settings.pluginMediaElement,
    806806                player = new YT.Player(settings.containerId, {
    807807                        height: settings.height,
    808808                        width: settings.width,
    mejs.YouTubeApi = { 
    810810                        playerVars: {controls:0},
    811811                        events: {
    812812                                'onReady': function() {
    813                                        
     813
    814814                                        // hook up iframe object to MEjs
    815815                                        settings.pluginMediaElement.pluginApi = player;
    816                                        
     816
    817817                                        // init mejs
    818818                                        mejs.MediaPluginBridge.initPlugin(settings.pluginId);
    819                                        
     819
    820820                                        // create timer
    821821                                        setInterval(function() {
    822822                                                mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
    823                                         }, 250);                                       
     823                                        }, 250);
    824824                                },
    825825                                'onStateChange': function(e) {
    826                                        
     826
    827827                                        mejs.YouTubeApi.handleStateChange(e.data, player, pluginMediaElement);
    828                                        
     828
    829829                                }
    830830                        }
    831831                });
    832832        },
    833        
     833
    834834        createEvent: function (player, pluginMediaElement, eventName) {
    835835                var event = {
    836836                        type: eventName,
    mejs.YouTubeApi = { 
    838838                };
    839839
    840840                if (player && player.getDuration) {
    841                        
    842                         // time 
     841
     842                        // time
    843843                        pluginMediaElement.currentTime = event.currentTime = player.getCurrentTime();
    844844                        pluginMediaElement.duration = event.duration = player.getDuration();
    845                        
     845
    846846                        // state
    847847                        event.paused = pluginMediaElement.paused;
    848                         event.ended = pluginMediaElement.ended;                 
    849                        
     848                        event.ended = pluginMediaElement.ended;
     849
    850850                        // sound
    851851                        event.muted = player.isMuted();
    852852                        event.volume = player.getVolume() / 100;
    853                        
     853
    854854                        // progress
    855855                        event.bytesTotal = player.getVideoBytesTotal();
    856856                        event.bufferedBytes = player.getVideoBytesLoaded();
    857                        
     857
    858858                        // fake the W3C buffered TimeRange
    859859                        var bufferedTime = event.bufferedBytes / event.bytesTotal * event.duration;
    860                        
     860
    861861                        event.target.buffered = event.buffered = {
    862862                                start: function(index) {
    863863                                        return 0;
    mejs.YouTubeApi = { 
    869869                        };
    870870
    871871                }
    872                
     872
    873873                // send event up the chain
    874874                pluginMediaElement.dispatchEvent(event);
    875         },     
    876        
     875        },
     876
    877877        iFrameReady: function() {
    878                
     878
    879879                this.isLoaded = true;
    880880                this.isIframeLoaded = true;
    881                
     881
    882882                while (this.iframeQueue.length > 0) {
    883883                        var settings = this.iframeQueue.pop();
    884884                        this.createIframe(settings);
    885                 }       
     885                }
    886886        },
    887        
     887
    888888        // FLASH!
    889889        flashPlayers: {},
    890890        createFlash: function(settings) {
    891                
     891
    892892                this.flashPlayers[settings.pluginId] = settings;
    893                
     893
    894894                /*
    895895                settings.container.innerHTML =
    896896                        '<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="//www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid=' + settings.pluginId  + '&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0" ' +
    mejs.YouTubeApi = { 
    902902
    903903                var specialIEContainer,
    904904                        youtubeUrl = '//www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid=' + settings.pluginId  + '&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0';
    905                        
     905
    906906                if (mejs.MediaFeatures.isIE) {
    907                        
     907
    908908                        specialIEContainer = document.createElement('div');
    909909                        settings.container.appendChild(specialIEContainer);
    910910                        specialIEContainer.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
    mejs.YouTubeApi = { 
    921921                                '<param name="allowScriptAccess" value="' + options.flashScriptAccess + '">' +
    922922                                '<param name="wmode" value="transparent">' +
    923923                        '</object>';
    924                 }               
    925                
     924                }
     925
    926926        },
    927        
     927
    928928        flashReady: function(id) {
    929929                var
    930930                        settings = this.flashPlayers[id],
    931931                        player = document.getElementById(id),
    932932                        pluginMediaElement = settings.pluginMediaElement;
    933                
    934                 // hook up and return to MediaELementPlayer.success     
    935                 pluginMediaElement.pluginApi = 
     933
     934                // hook up and return to MediaELementPlayer.success
     935                pluginMediaElement.pluginApi =
    936936                pluginMediaElement.pluginElement = player;
    937937                mejs.MediaPluginBridge.initPlugin(id);
    938                
     938
    939939                // load the youtube video
    940940                player.cueVideoById(settings.videoId);
    941                
     941
    942942                var callbackName = settings.containerId + '_callback';
    943                
     943
    944944                window[callbackName] = function(e) {
    945945                        mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
    946946                }
    947                
     947
    948948                player.addEventListener('onStateChange', callbackName);
    949                
     949
    950950                setInterval(function() {
    951951                        mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
    952952                }, 250);
    953                
     953
    954954                mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'canplay');
    955955        },
    956        
     956
    957957        handleStateChange: function(youTubeState, player, pluginMediaElement) {
    958958                switch (youTubeState) {
    959959                        case -1: // not started
    mejs.YouTubeApi = { 
    969969                                break;
    970970                        case 1:
    971971                                pluginMediaElement.paused = false;
    972                                 pluginMediaElement.ended = false;                               
     972                                pluginMediaElement.ended = false;
    973973                                mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'play');
    974974                                mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'playing');
    975975                                break;
    976976                        case 2:
    977977                                pluginMediaElement.paused = true;
    978                                 pluginMediaElement.ended = false;                               
     978                                pluginMediaElement.ended = false;
    979979                                mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'pause');
    980980                                break;
    981981                        case 3: // buffering
    mejs.YouTubeApi = { 
    983983                                break;
    984984                        case 5:
    985985                                // cued?
    986                                 break;                                         
    987                        
    988                 }                       
    989                
     986                                break;
     987
     988                }
     989
    990990        }
    991991}
    992992// IFRAME