Help.. Regarding source for a video.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Help.. Regarding source for a video..

How to display YouTube videos or any in video element or in an iframe? I tried many but it says that unable to display because it has set X-frame to sameorigin.??😥😥

16th Aug 2017, 1:26 PM
Omniscient
Omniscient - avatar
21 Answers
16th Aug 2017, 1:38 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 14
*Updated as second iframe in my code* Acceptable format: https://www.youtube.com/embed/AddFileNameXYZ
16th Aug 2017, 1:48 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 14
No issues! 👍 Glad to be of help
16th Aug 2017, 2:06 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 14
You mean full screen.. Just add this attribute to your iframe, allowfullscreen <iframe src="https://www.youtube.com/embed/W0LHTWG-UmQ?controls=0&showinfo=0&rel=0&autoplay=1&loop=1&playlist=W0LHTWG-UmQ" frameborder="0" allowfullscreen></iframe>
16th Aug 2017, 2:35 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 14
Can you share your code?
16th Aug 2017, 3:01 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 13
I believe it doesn't recognize the shorter url.. Youtu.be. I have stated the acceptable format here and updated the actual one in the code
16th Aug 2017, 1:51 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 12
Did you try doing something like this- <iframe src="https://www.Youtube.com/embed/jtZRe4jCFTU"></iframe> It works for me!
16th Aug 2017, 1:30 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 12
Here you go, used a random image as background https://code.sololearn.com/WXrFz7chZroo/?ref=app
16th Aug 2017, 3:18 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
16th Aug 2017, 3:37 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 6
that error in question means the site has blocked displaying web pages in a iframe(YouTube will not let you visit it in an iframe) you need to specify the YouTube embed code you can get it easily go to desktop YouTube website below your video choose share select embed code copy the embed code now include in your HTML web page
16th Aug 2017, 3:02 PM
Lord Krishna
Lord Krishna - avatar
+ 2
One more doubt.. 😜😜 Can we make a video as a background??
16th Aug 2017, 2:13 PM
Omniscient
Omniscient - avatar
+ 2
Background as that of image..
16th Aug 2017, 2:58 PM
Omniscient
Omniscient - avatar
16th Aug 2017, 3:04 PM
Omniscient
Omniscient - avatar
+ 2
@apoorva...??
16th Aug 2017, 3:15 PM
Omniscient
Omniscient - avatar
+ 2
allowfullscreen.., backgroundborder='0' ?? I was asking a video as background.. ☺️
16th Aug 2017, 3:29 PM
Omniscient
Omniscient - avatar
+ 1
Yeah I did.. Didnt work for me..
16th Aug 2017, 1:36 PM
Omniscient
Omniscient - avatar
16th Aug 2017, 1:46 PM
Omniscient
Omniscient - avatar
+ 1
That code worked.. Where did you find that link..??
16th Aug 2017, 1:47 PM
Omniscient
Omniscient - avatar
+ 1
Both links seem to be different?.
16th Aug 2017, 1:50 PM
Omniscient
Omniscient - avatar
+ 1
Thanks a lot @apoorva... Finally did it.. 😅😅👍👍
16th Aug 2017, 2:04 PM
Omniscient
Omniscient - avatar