From 487da469283ac15542ec52e204e46f6b82c01edf Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sun, 11 May 2014 01:27:29 +0000 Subject: [PATCH] Support `loop` for `[audio]` and `[video]` shortcodes that specify files that are played using MediaElement's Flash plugin bridge. Fixes #27368. git-svn-id: https://develop.svn.wordpress.org/trunk@28363 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/mediaelement/wp-mediaelement.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/js/mediaelement/wp-mediaelement.js b/src/wp-includes/js/mediaelement/wp-mediaelement.js index 72ea6bde31..ca47399045 100644 --- a/src/wp-includes/js/mediaelement/wp-mediaelement.js +++ b/src/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 ); }