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 :: html bullet symbol 
Html :: display success message after form submit in php 
Html :: html ul types 
Html :: html input with icon right 
Html :: apply image in body without css 
Html :: add icon html 
Html :: ejs ternary 
Html :: onclick input text select 
Html :: html umlaute 
Html :: git pull one file 
Html :: jquery insert html into iframe 
Html :: html writing shortcuts 
Html :: html5 audio tag style 
Html :: how to add a button bootstrap 
Html :: html practice exercises 
Html :: unmount ubuntu 
Html :: html upload image accept only few types 
Html :: slick slider pause on video play 
Html :: change font size of input text html 
Html :: html iframe connection refused 
Html :: angular open pdf in new tab 
Html :: html unordered list 
Html :: captcha code 
Html :: img svg not loading 
Html :: highlight js 
Html :: select all text of input onclick 
Html :: Installation of ionicons 
Html :: input radio 
Html :: auto update time in html 
Html :: html left quote 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =