diff options
author | Scott Taylor <wonderboymusic@git.wordpress.org> | 2014-07-15 22:17:58 +0000 |
---|---|---|
committer | Scott Taylor <wonderboymusic@git.wordpress.org> | 2014-07-15 22:17:58 +0000 |
commit | cba1ae06af6f77ff729e9b014e9f717df39e3eac (patch) | |
tree | 81e4e4756fbde51d7e9bbaf8b5b4cf3c33c323bc /src/wp-includes/js/media-audiovideo.js | |
parent | 9e573243cfc51dda05c8118b7204cdac220a06d0 (diff) | |
download | wordpress-cba1ae06af6f77ff729e9b014e9f717df39e3eac.tar.gz wordpress-cba1ae06af6f77ff729e9b014e9f717df39e3eac.zip |
Simplify creation of audio, video, and playlist MCE views by placing them in iframe sandboxes.
Wins:
* Eliminates duplication of code between PHP and JS
* Views can load JS without messing with TinyMCE and scope
* MEjs doesn't break when it loads a file plugin-mode. This allows any file type the MEjs supports to play in MCE views.
* YouTube now works as the source for video.
* Users can still style the views, editor stylesheets are included in these sandboxes.
* Audio and Video URLs and `[embed]`s are no longer broken.
* Remove the crazy compat code necessary to determine what file types play in what browser.
* Remove unneeded Underscore templates.
* Remove the compat code for playlists.
See #28905.
git-svn-id: https://develop.svn.wordpress.org/trunk@29179 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'src/wp-includes/js/media-audiovideo.js')
-rw-r--r-- | src/wp-includes/js/media-audiovideo.js | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/src/wp-includes/js/media-audiovideo.js b/src/wp-includes/js/media-audiovideo.js index 0c6f31e5b3..4bf622f764 100644 --- a/src/wp-includes/js/media-audiovideo.js +++ b/src/wp-includes/js/media-audiovideo.js @@ -47,103 +47,6 @@ }, /** - * Utility to identify the user's browser - */ - ua: { - is : function( browser ) { - var passes = false, ua = window.navigator.userAgent; - - switch ( browser ) { - case 'oldie': - passes = ua.match(/MSIE [6-8]/gi) !== null; - break; - case 'ie': - passes = /MSIE /.test( ua ) || ( /Trident\//.test( ua ) && /rv:\d/.test( ua ) ); // IE11 - break; - case 'ff': - passes = ua.match(/firefox/gi) !== null; - break; - case 'opera': - passes = ua.match(/OPR/) !== null; - break; - case 'safari': - passes = ua.match(/safari/gi) !== null && ua.match(/chrome/gi) === null; - break; - case 'chrome': - passes = ua.match(/safari/gi) !== null && ua.match(/chrome/gi) !== null; - break; - } - - return passes; - } - }, - - /** - * Specify compatibility for native playback by browser - */ - compat :{ - 'opera' : { - audio: ['ogg', 'wav'], - video: ['ogg', 'webm'] - }, - 'chrome' : { - audio: ['ogg', 'mpeg'], - video: ['ogg', 'webm', 'mp4', 'm4v', 'mpeg'] - }, - 'ff' : { - audio: ['ogg', 'mpeg'], - video: ['ogg', 'webm'] - }, - 'safari' : { - audio: ['mpeg', 'wav'], - video: ['mp4', 'm4v', 'mpeg', 'x-ms-wmv', 'quicktime'] - }, - 'ie' : { - audio: ['mpeg'], - video: ['mp4', 'm4v', 'mpeg'] - } - }, - - /** - * Determine if the passed media contains a <source> that provides - * native playback in the user's browser - * - * @param {jQuery} media - * @returns {Boolean} - */ - isCompatible: function( media ) { - if ( ! media.find( 'source' ).length ) { - return false; - } - - var ua = this.ua, test = false, found = false, sources; - - if ( ua.is( 'oldIE' ) ) { - return false; - } - - sources = media.find( 'source' ); - - _.find( this.compat, function( supports, browser ) { - if ( ua.is( browser ) ) { - found = true; - _.each( sources, function( elem ) { - var audio = new RegExp( 'audio\/(' + supports.audio.join('|') + ')', 'gi' ), - video = new RegExp( 'video\/(' + supports.video.join('|') + ')', 'gi' ); - - if ( elem.type.match( video ) !== null || elem.type.match( audio ) !== null ) { - test = true; - } - } ); - } - - return test || found; - } ); - - return test; - }, - - /** * Override the MediaElement method for removing a player. * MediaElement tries to pull the audio/video tag out of * its container and re-add it to the DOM. |