How to decide between video and embed?

Video can also be a self-closing tag.

1 Like

I have tried to add controls to embed, and I see controls doesnt appear just a video,( embed controls src= “https://content.codecademy.com/courses/SemanticHTML/dog-on-beach.gif”/> when I put the link into the video tag
<video src= “https://content.codecademy.com/courses/SemanticHTML/dog-on-beach.gif”/ controls> "/video> the video doesnt work, I can see only controls panel and now I woder why (code contain mistakes I had to omiss < here because when I put it on the forum it doesnt appear)

This is like, a year old but just for anyone else browsing this in the future.
It’s for clarity sake. It makes it instantly recognizable, without you having to, read embed, scan the line, and find out the source to then find out if you’re looking at a video, picture, or gif, ect.

1 Like

You can use embed for displaying video as well. But as the lesson mentioned that it is a deprecated element and should not be used anymore. However, since the websites might already have this code. it is important to know about it.

According to my understanding, it is not that embed can’t be used but it is more of an old-school way of placing media on a page. The more recent ways are in using the video tag, audio tag, etc.

2 Likes

Hi. As I understand embed is a deprecated tag and other alternatives, such as video, audio, and img, should be used instead.

1 Like

Your initial question was answered thoroughly, but I wanted to add that as EMBED is deprecated, you want to get out of the habit of using it, since browsers will no longer support it universally and eventually not at all.

Also, for anyone curious about it, OBJECT can be used as an effective alternative to EMBED. More information about the Object element can be found on MDN.

1 Like

I would like to ask if I understand this correctly.

If we use

Hi there. I tried to change the size of video and gif but failed however it worked on img. What I did wrong if I used height=“100” width=“100” in video tag? Thanks

Do you see any unit for the 100?

I was doing some experiment and 100 is just a random

the number isn’t a problem it’s that there is no unit attached to it. It’s like saying a road trip is 50. 50 minutes, 50 miles, etc.

Thanks for the note, yeah I practiced below options but no result.

Does anyone tried to do it so

embed src=“https://content.codecademy.com/courses/SemanticHTML/dog-on-beach.gif” width=“300px” height=“300px”/>

embed src=“https://content.codecademy.com/courses/SemanticHTML/dog-on-beach.gif” width=“30cm” height=“30cm”/>

embed src=“h…if” width=“30%” height=“30%”/>

Sorry, I miss read the documentation before. It can not have a unit attached and it is in pixels. And the embed tag is deprecated and you should use the img/picture and video tags instead. (For gifs you use the image tag)

gif

RAW:

embed src="https://content.codecademy.com/courses/SemanticHTML/dog-on-beach.gif" width="300px" height="300px"/>`

Thanks for your time!!! i went through DOC as you said and also changed from embed element to img and it worked.
but video element was still not showing any sign of size adjustment. It worked only after using inline style which I read somewhere.

I don’t know why but I feel now relieved since my curiosity fulfilled before that I felt bothered all the time when codding came to my mind. Is this how will I feel all the time during working process in the future?

Yes…LOL! I think you will find as you learn and use CSS in your page styling, all the nagging issues with HTML sizing and layout now will be pretty much gone.

Readability, in one word.
For example, you want to edit a image but you use embed for every video, image, etc., you must search thru every line which contain an embed. But if you use a image attribute, will save time.

Hi,

I have a question that relates to this. What about small companies or individuals that do not have a lot of space to store or host their videos and use a video hosting company such as YouTube, Vimeo etc.?

The video hosting services that I named and others often allow you to embed videos into your web pages using iframes. For example:


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

Instead of using the above code, would it be possible to use the <video></video> semantic tags, like this:


<video class="failsvideo" src="https://www.youtube.com/embed/-2LV7ANiIag" 
    controls title="Driving Fail Viewers Edition #36 | The Phone Zombie">
  Your browser does not support video playback. Please update.
</video>

Then use CSS to apply the styling to the video element with the class of failsvideo, such as giving it a border, sizing it and so on?

I am applying the knowledge I gained from the lesson logically, which makes sense, but I am unsure if that is possible or the right way. Is that correct? Is that how we would embed videos from video hosting services using semantic HTML5?

Thanks,

Jay