How to decide between video and embed?

Hi, I am a beginner here but I believe if you rephrase your question(s), there will be a few people here who can help.
Thanks

Thanks mega4175851005, my question was messy.

So hi again ! :smile:

When do we have to choose between VIDEO or EMBED?
I try to put a video with EMBED and it works !
What is the main differences?

If someone can enlighten me, I’ll be pleased !

2 Likes

Hi,
The VIDEO element makes it clear that the developer is attempting to display a video to the user. It has an opening and closing tag.

The EMBED element is also used to incorporate media content into a web page. It can embed any media including videos, audio files, and gifs from external and local sources. It is a self-closing tag.
I hope this helps :slightly_smiling_face:

8 Likes

From what I have read up on it, it depends on the developer on which tag they want to use.

However, these days, as a general rule, <video> is used for videos, <audio> for audio content, and <embed> for anything else, like flash videos and gifs.

Kevin

30 Likes

Ok thanks @zs-kev, that makes sense to use for flash videos and gifs.

1 Like

I didn’t understand why we needed to add both a video tag and an embed tag. If the [video src=“link.mp4”][/video] already worked to show a video, what was the point of embedding and additional .gif link?

(I also had this question for the audio section, separating the [audio] tag from the [source] tag, but figured the reasoning would become clear in the next step. It didn’t! Got more confused. Lol.)

Just realized that this chat box renders HTML, so I replaced the carrots with brackets! I know there’s a way to show code, but forgot what tags are used.

If <embed> can use any form of media what is the point of using <image> <video> <audio> ?

3 Likes

Video, audio, and image tags are utilized to tell other coders or the program itself what the intended purpose is. For example, when using the video tag, it tells other people that your intention is to apply a video and only a video. Hope this helps!

5 Likes

I think it was largely for the sake of the example, to show us other pieces of code. The embed gif I guess is supposed to entertain the user while the video loads. Maybe it was used more when video took time to load due to decreased bandwidths.

1 Like

Not sure if this is helpful, but I’ve used embed tags to use videos from my YouTube channel for my reel on my website (instead of using local files with a video tag). I am not sure if you can use external URLs with video tags.

2 Likes

No, that doesn’t help. You are simply saying what the lecture says. He ask when to use each of them. The south-african man has answered correctly. Read properly the questions and then answer if you know the answers.

3 Likes

One thing i have noticed that i would like to point out is when we use the<audio> tag, the audio file renders on the page in a bar with round edges type of format. On the other hand if we use an <embed> tag to import an audio, the file renders with a black rectangle behind it.
This is in the case of Chrome, however in safari it showed an error.

hey everyone,Can we use the attributes that work with the video element within the embed element?

Hey, I realise this is an old post but thought I’d chime in…

As was previously introduced in the course, we ideally want to be using semantic markup, i.e. markup that gives the reader of our source code more meaningful information (be it a person or piece of software).

So when choosing between <video> or <embed>, bear this principle in mind. Yes, we could use an <embed> element for a video, which technically speaking would be just fine. But think of a screen reader or search engine trying to make sense of our code; using a <video> tag makes it 100% crystal clear that there is supposed to be a video there and not some other type of media. Likewise we should use <audio> and <img> tags as appropriate, and only use <embed> for anything else not covered by a specific tag.

There may be some other considerations to do with how each tag renders the media, but this is the main lesson here I think :slight_smile:

9 Likes

Hi
is no longer supported or suggested
https://www.w3schools.com/tags/tag_embed.asp

3 Likes

I agree, this is a great rule to follow! It just makes the most sense given the fact that this topic was mentioned during the Semantic HTML unit.

2 Likes

Hi!
I agree that the video tag should be used if it’s the video you insert, purely for semantic purposes.
I also found that the video tag may provide more additional useful possibilities, like inserting different video files with source tags:

Browsers don’t all support the same video formats; you can provide multiple sources inside nested [source] elements, and the browser will then use the first one it understands.

video-with-sources

According to MDM, the embed tag depends on an external application like a plugin to render the media being embedded. While it seems there is native support for images (.jpg, .gif, .png), a video file just gets downloaded when I setup a test page using the video file from the lesson. The video tag will actually play the video as we’ve seen.

My takeaway is that embed was probably something that was used more often when browser plugins like flash, shockwave, activex, quicktime, etc. were a thing. Since the modern browser doesn’t really need plugins anymore to support different media formats, I just probably wouldn’t use it given the semantic benefits of video, audio, and img.

3 Likes

If you want to add in a gif file use img tag :

<img src=“download.gif”

So the long and the short of it, in my very short time coding, is this.
(btw tags are enclosed by commas i.e. ,video, sry im new here and still tryna figure out the formatting stuffs lol)
,video, is used when you want to specifically convey to your future self, and other coders, an attempt to show the user a video.
However not all websites (youtube for ex) allow you to embed a video from their site.
Youtube uses the ,iframe, tag, which from my understanding is alot like putting a whole new tab within your tab, rather than embedding a video (I assume they do this so they can keep track of views and other such data).
,embed, is useful in certain circumstances, such as gifs, flash, etc.

the reason they say it’s being taught for legacy purposes, is that flash will no longer be supported come dec 2020, and it is rather expected more formats are on the chopping block in the future.

we as web devs,(and society at large for that matter) seem to be using less and less types of media that cannot be displayed by either ,video, ,audio, ,img, or other more specific tags.

Thusly, to make it easier to read the code, for seo purposes, and for accessibility reasons (as stated in the lesson) we are moving towards more specific tags in an attempt to improve performance, among other things.

This page’s related topics on the left hand side, have various specific types of media tags used in html. Might be worth a look! :smiley: