Search
 
SCRIPT & CODE EXAMPLE
 

HTML

html video

<video width="320" height="240" controls>
  <source src="your_video's_name.mp4" type="video/mp4">
  Error Message
</video>

<!-- i copied w3schools code lol-->
Comment

html video

<div id='home-video' class="dl-neon-vid"><center>
    <video playsinline loop muted autoplay width="100%">
                <source src="video-link"  />
            </video></center>
    </div>

  <!-- script to pause ALL VIDEOS ON THE HOME PAGE when out of viewport -->

<script>
    let options = {
        root: null,
        rootMargin:'0px',
        threshold:1.0
    };
    let callback = (entries, observer)=>{
        entries.forEach(entry => {
            if(entry.target.id == 'home-video')
            {
                if(entry.isIntersecting){
                    entry.target.play();
                }
                else{
                    entry.target.pause();
                }
            }
        });
    }
let observer = new IntersectionObserver(callback, options);
observer.observe(document.querySelector('#home-video'));

</script>
Comment

video html

<video> 
  <source src="path_to_your_video_file.mp4" type="video/mp4"> 
</video> 
Comment

html video play

var vid = document.getElementById("myVideo");

function playVid() {
    vid.play();
}

function pauseVid() {
    vid.pause();
}
Comment

PREVIOUS NEXT
Code Example
Html :: youtube start end 
Html :: bootstrap hide row 
Html :: accordion bootstrap 5 collapse not working 
Html :: span html 
Html :: default value input 
Html :: tooltip react bootstrap 
Html :: html iframe connection refused 
Html :: html accordion generator 
Html :: sending email by html 
Html :: laravel route regular expression constraints 
Html :: tailwind css product card 
Html :: how to show code with html 
Html :: move cursor to end of line javascript 
Html :: a href tag 
Html :: html images 
Html :: progress bar bootstrap 5 
Html :: how to increase font size in html 
Html :: bootstrap nav nav tabs float right 
Html :: html definition list 
Html :: multiple checkbox in one line bootstrap 
Html :: make checkbox required 
Html :: datatable src 
Html :: form submission with post 
Html :: how to host html website 
Html :: boilerplate code in html 
Html :: toggle button 
Html :: html button with href 
Html :: 1x1 transparent image base 64 
Html :: click on tr redirect new page 
Html :: use boolean condition ngclass 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =