How to Add HTML5 Video controls dynamically

JordanBarber

I have a video slider which does not include controls in the 'video' tags. I am using a custom play button to initiate videos. However, once the video has begun playing, I am fading out my custom play button and would like the standard html5 video controls to take over. Is there a way to append the controls to html5 video only if the video is playing. Any help is much appreciated.

Pushker Yadav

$(function(){
    $('#btn').on('click',
                 function(){
                     $('#vid')[0].play();
                     $(this).hide();});
  
    $('#vid').on('play', function (e) {
   
        $(this).attr('controls','true');
});
    
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<video width="400" id="vid" >
    <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4"/>
 
  Your browser does not support HTML5 video.
</video>
    
    <button id="btn">Play</button>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to disable iOS HTML5 video controls?

From Dev

How to make the video of html5 controls to be visible always?

From Dev

Styling HTML5 Video Controls

From Dev

HTML5 video custom controls

From Dev

HTML5 Video Controls do not work

From Dev

Styling HTML5 Video Controls

From Dev

HTML5 video custom controls

From Dev

Backbone: how can i add event for html5 video?

From Dev

how to add skin to a video element in html5

From Dev

HTML5 video tag controls="false" - controls show on pause

From Dev

How to prevent event bubbling when clicking on HTML5 video controls in Firefox

From Dev

Video streaming html5 player. how to automate sliding seek & volume controls

From Dev

Video streaming html5 player. how to automate sliding seek & volume controls

From Dev

How can I hide my custom html5 video controls when the user is inactive?

From Dev

How to dynamically add controls and preserve Viewstate?

From Dev

How to dynamically add server controls into repeater?

From Dev

Dynamically Load and Play HTML5 video

From Dev

Append data to a html5 video dynamically

From Dev

Add dynamically user controls

From Dev

Making HTML5 video draggable without losing the controls

From Dev

Custom HTML5 video player controls with AngularJS

From Dev

change html5 video controls layout when fullscreen

From Dev

HTML5 video & jQuery: show/hide controls on click

From Dev

Adding controls to HTML5 background video with CSS

From Dev

HTML5 video custom controls for any number of videos on the page

From Dev

customising the buttons availabe in the controls element of the html5 video player

From Dev

Controls not showing on HTML5 Video when using javascript

From Dev

HTML5 video custom controls for any number of videos on the page

From Dev

html5 video doesn't play on android without controls

Related Related

  1. 1

    How to disable iOS HTML5 video controls?

  2. 2

    How to make the video of html5 controls to be visible always?

  3. 3

    Styling HTML5 Video Controls

  4. 4

    HTML5 video custom controls

  5. 5

    HTML5 Video Controls do not work

  6. 6

    Styling HTML5 Video Controls

  7. 7

    HTML5 video custom controls

  8. 8

    Backbone: how can i add event for html5 video?

  9. 9

    how to add skin to a video element in html5

  10. 10

    HTML5 video tag controls="false" - controls show on pause

  11. 11

    How to prevent event bubbling when clicking on HTML5 video controls in Firefox

  12. 12

    Video streaming html5 player. how to automate sliding seek & volume controls

  13. 13

    Video streaming html5 player. how to automate sliding seek & volume controls

  14. 14

    How can I hide my custom html5 video controls when the user is inactive?

  15. 15

    How to dynamically add controls and preserve Viewstate?

  16. 16

    How to dynamically add server controls into repeater?

  17. 17

    Dynamically Load and Play HTML5 video

  18. 18

    Append data to a html5 video dynamically

  19. 19

    Add dynamically user controls

  20. 20

    Making HTML5 video draggable without losing the controls

  21. 21

    Custom HTML5 video player controls with AngularJS

  22. 22

    change html5 video controls layout when fullscreen

  23. 23

    HTML5 video & jQuery: show/hide controls on click

  24. 24

    Adding controls to HTML5 background video with CSS

  25. 25

    HTML5 video custom controls for any number of videos on the page

  26. 26

    customising the buttons availabe in the controls element of the html5 video player

  27. 27

    Controls not showing on HTML5 Video when using javascript

  28. 28

    HTML5 video custom controls for any number of videos on the page

  29. 29

    html5 video doesn't play on android without controls

HotTag

Archive