diff johndyer-mediaelement-13fa20a/src/js/mep-feature-loop.js @ 0:032bc65ebafc

added core components
author George Fazekas <gyorgy.fazekas@eecs.qmul.ac.uk>
date Wed, 06 Mar 2013 15:45:48 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/johndyer-mediaelement-13fa20a/src/js/mep-feature-loop.js	Wed Mar 06 15:45:48 2013 +0000
@@ -0,0 +1,23 @@
+(function($) {
+	// loop toggle
+	MediaElementPlayer.prototype.buildloop = function(player, controls, layers, media) {
+		var 
+			// create the loop button
+			loop = 
+			$('<div class="mejs-button mejs-loop-button ' + ((player.options.loop) ? 'mejs-loop-on' : 'mejs-loop-off') + '">' +
+				'<button></button>' +
+			'</div>')
+			// append it to the toolbar
+			.appendTo(controls)
+			// add a click toggle event
+			.click(function() {
+				player.options.loop = !player.options.loop;
+				if (player.options.loop) {
+					loop.removeClass('mejs-loop-off').addClass('mejs-loop-on');
+				} else {
+					loop.removeClass('mejs-loop-on').addClass('mejs-loop-off');
+				}
+			});
+	}
+	
+})(mejs.$);
\ No newline at end of file