Home > OS >  Html video attachment
Html video attachment

Time:11-08

I am having trouble attaching a video in my html file. I used a youtube video for this one but whenever I open it on my browser it says the video is unavailable because youtube refused to connect. I also tried attaching a video from my computer that ended with .mov and that didnt work either. here is what i wrote in html for the youtube one.

<iframe width="560" height="315" src="https://youtu.be/u9fftcQGSa0"
  frameborder="0" allow="accelerometer; autoplay; encrypted-media; 
  gyroscope; picture-in-picture" allowfullscreen></iframe>

CodePudding user response:

For using YouTube videos in your website, go to the video > Share > embed. Take the HTML code snippet and paste it in your desired place.

CodePudding user response:

For local server video attachment in your website:

<video width="1080px" height="720px" controls="controls"/>
    <source src="write your video location/link here with extension" type="video/mp4">
</video>

Example:

<video width="1080px" height="720px" controls="controls"/>
    <source src="video.mp4" type="video/mp4">
</video>

For YouTube video attachment in your website:

Step 1:

  • Go to YouTube and select/open your video,
  • Go to share option,
  • Click Embed,
  • Copy Embed link

Step 2: Go to your html code and paste your YouTube embed code

Example:

<iframe width="560" height="315" 
    src="https://www.youtube.com/embed/uzumIYBSaWY" 
    title="YouTube video player" 
    frameborder="0" 
    allow="accelerometer; 
    autoplay; 
    clipboard-write; 
    encrypted-media; 
    gyroscope; 
    picture-in-picture" 
    allowfullscreen
>
</iframe>
  • Related