Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

Player button shape

User generated image
Q1: How can have player button on the right (shown in the above image)?
Q2: How can I change the code such that, the player box will be minimized after the video finishes after 5 second delay?
<script>
$(function() {
  $('video').on('play', function (e) {
    // IGNORE PLAY EVENT IF ALREADY RESIZED
    if ($(this).data('oldheight') > 0) return;
  
    // SAVE THE CURRENT HEIGHT
    $(this).data('oldheight', $(this).height());
  
    // GET THE NEW HEIGHT DEFAULT TO 400 IF NOT SET
    var newheight = $(this).data('height') || 400;
  
    // SET THE NEW HEIGHT
    $(this).css({height: newheight + 'px'});
  });
  
  $('video').on('ended', function (e) {
    // GET THE OLD HEIGHT DEFAULT TO 100 IF NOT SET
    var oldheight = $(this).data('oldheight') || 100;
	
    // SET THE DEFAULT HEIGHT
    $(this).css({height: oldheight+ 'px'});
  
    // RESTORE THE FULL HEIGHT VALUE
    $(this).data('oldheight', 0);
  });
});
</script>

Open in new window

<video height="28" controls data-height="300">
		  <source src="http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4" type="video/mp4">
				Your browser does not support HTML5 video.
</video>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike Eghtebas

ASKER

Thank you very much. Really appreciated.

Mike
You are most welcome.