From fb1aab652076ee0459225062c5c7ca51337302c9 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sun, 11 May 2014 01:28:15 +0000 Subject: [PATCH] Support `loop` for `[audio]` and `[video]` shortcodes that specify files that are played using MediaElement's Flash plugin bridge. Fixes #27368. Built from https://develop.svn.wordpress.org/trunk@28363 git-svn-id: http://core.svn.wordpress.org/trunk@28191 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/mediaelement/wp-mediaelement.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/wp-includes/js/mediaelement/wp-mediaelement.js b/wp-includes/js/mediaelement/wp-mediaelement.js index 72ea6bde31..ca47399045 100644 --- a/wp-includes/js/mediaelement/wp-mediaelement.js +++ b/wp-includes/js/mediaelement/wp-mediaelement.js @@ -16,9 +16,17 @@ } settings.success = function (mejs) { - var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; - if ( 'flash' === mejs.pluginType && autoplay ) { - mejs.addEventListener( 'canplay', function () { + var autoplay, loop; + + if ( 'flash' === mejs.pluginType ) { + autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; + loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop; + + autoplay && mejs.addEventListener( 'canplay', function () { + mejs.play(); + }, false ); + + loop && mejs.addEventListener( 'ended', function () { mejs.play(); }, false ); }