+ 1

What's wrong with videos?

I embedded a video like shown in the lesson but it's not working 😔 https://sololearn.com/compiler-playground/W27WG1Kahosh/?ref=app

5th Dec 2023, 8:31 PM
Elina
Elina - avatar
9 ответов
+ 3
There are, but let me make it clear for you. The URL you are setting to your <video> src, must be the URL that moves you directly to the video when is opened. In fact the video is hosted and the URL (which is the location of that video only) is what we have to set as src value. In other words, the URL MUST lead you to the video file! In fact by clicking on the link, you must open the video file. Youtube doesn't let anyone to have the exact video file, because it wants to prevent videos from being downloaded. So the URL you have is just the link of a page that INCLUDES the video, not the video file itself. Here we must use <iframe> that lets us to embed other pages to our webpage. So we can view the video that way. I hope it was clear, but if there is still questions, you can ask.
5th Dec 2023, 8:54 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
+ 4
Elina You can train with a video link in this example, ofcourse if you like: https://sololearn.com/compiler-playground/WadImu130sKv/?ref=app
5th Dec 2023, 9:47 PM
JaScript
JaScript - avatar
+ 3
🇮🇱 Radin Masiha 🇮🇱 thanks again 😊 This <iframe> thing is new to me 😅 I'll repeat the video practice after I reach the lesson of <iframe> But aren't there any videos to embed only with <video> tag?🤔
5th Dec 2023, 8:40 PM
Elina
Elina - avatar
+ 3
🇮🇱 Radin Masiha 🇮🇱 Thank you so much 😊
5th Dec 2023, 10:09 PM
Elina
Elina - avatar
+ 3
The link you're using for the "src" attribute of the video should be a direct link to the video file, not to the YouTube page. Try to find a direct link to the video file, something ending in ".webm" or ".mp4". That should fix the issue. Also, make sure you're using the correct format in the "type" attribute.
6th Dec 2023, 12:29 AM
Marcelino Arias
Marcelino Arias - avatar
+ 2
Again here as the same as your image URL, this link is not the video's, but it's for youtube itself. For this purpose, you have to set the link to an <iframe> src. <iframe src="https://youtu.be/xianU0IrxEk?si=z_38XKV2RvZKKMX_"></iframe>
5th Dec 2023, 8:36 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
+ 2
JaScript Thanks a lot 😊🌸
5th Dec 2023, 10:10 PM
Elina
Elina - avatar
+ 2
Marcelino Arias Thanks 😊
6th Dec 2023, 9:39 PM
Elina
Elina - avatar
0
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <iframe width="560" height="315" src="https://www.youtube.com/embed/xianU0IrxEk" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> </body> </html>
7th Dec 2023, 1:01 PM
Salman Bappi
Salman Bappi - avatar