Blame view

sources/apps/files_videoviewer/mediaelement/src/js/mep-feature-stop.js 1020 Bytes
03e52840d   Kload   Init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  (function($) {
  
  	$.extend(mejs.MepDefaults, {
  		stopText: 'Stop'
  	});
  
  	// STOP BUTTON
  	$.extend(MediaElementPlayer.prototype, {
  		buildstop: function(player, controls, layers, media) {
  			var t = this,
  				stop = 
  				$('<div class="mejs-button mejs-stop-button mejs-stop">' +
  					'<button type="button" aria-controls="' + t.id + '" title="' + t.options.stopText + '" aria-label="' + t.options.stopText + '"></button>' +
  				'</div>')
  				.appendTo(controls)
  				.click(function() {
  					if (!media.paused) {
  						media.pause();
  					}
  					if (media.currentTime > 0) {
  						media.setCurrentTime(0);
                          media.pause();
  						controls.find('.mejs-time-current').width('0px');
  						controls.find('.mejs-time-handle').css('left', '0px');
  						controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0) );
  						controls.find('.mejs-currenttime').html( mejs.Utility.secondsToTimeCode(0) );					
  						layers.find('.mejs-poster').show();
  					}
  				});
  		}
  	});
  	
  })(mejs.$);