Which changes are required to autostart youtube video in default embed code? - youtube

What changes are required in youtube default embed code to let videos auto start on the web pages on-load?
https://www.youtube.com/embed/ngM_8pqGjmA?autoplay=1
<div width="100%" align="center"><iframe width="560" height="315" src="https://www.youtube.com/embed/ngM_8pqGjmA?autoplay=1" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
Output is normal, embedded but not auto starting. Video is embedded here on Google sites based website https://www.ibpspoexam.com/

Today you'll need to use ?autoplay=1&mute=1 since most browsers have disabled auto starting videos with audio. start=2 is most likely not needed.

That video is set to start parameter at 0:02 as follows:
https://www.youtube.com/embed/ngM_8pqGjmA?autoplay=1;start=2
By adding the start paarmeter in your code, the video will autoplay.
Here is the code - with the start parameter added:
<div width="100%" align="center"><iframe width="560" height="315" src="https://www.youtube.com/embed/ngM_8pqGjmA?autoplay=1;start=2" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>

Related

Grav markup how to embed youtube video in frontmatter?

I was planning to do something like the following to embed a youtube video into a grav website using frontmatter (the page is currently using only only frontmatter with no entries in the markup file):
rows:
-
title: XYZ
description: 'Something'
description_position: left
image: image.JPG
name: video
-
title: IJK
description: 'Something'
description_position: right
html: '<iframe width="560" height="315" src="https://www.youtube.com/embed/somevideo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
This does not work. Grav does not say that this isn't valid frontmatter but it just doesn't create the iframe either. Is there a way to embed video from youtube using html inline in the frontmatter and without plugins?
They also have a dedicated youtube plugin (written by the grav developers) to better integrate into the markdown and frontmatter:
https://github.com/getgrav/grav-plugin-youtube
You can use the code below
<//iframe style="position:center;bottom:0px;left:0px;height:100%;width:100%" src="https://www.youtube.com/embed/-5wpm-gesOY" frameborder="0" allowfullscreen></iframe>
(// not use)
Good work

YouTube Autoplay Issue

I am trying to get an embedded YouTube video to autoplay. I have set the ?autoplay=1 in the parameter but this seems to be deprecated. I have not been able to find any documentation on it though.
How can I get autoplay to work on videos?
<iframe class="iframe-vid" width="560" height="315" src="https://www.youtube.com/embed/Bey4XXJAqS8?autoplay=1&enablejsapi=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
If you don't mind that the video autoplays muted, you can add the following parameter in the YouTube URL:
&rel=0&mute=1
Here is the iframe with autoplay enabled and muted1
<iframe class="iframe-vid" width="560" height="315" src="https://www.youtube.com/embed/Bey4XXJAqS8?autoplay=1&enablejsapi=1&rel=0&mute=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
Test made in Google Chrome Version 72.0.3626.119 (Build oficial) (32 bits)
1 I really don't know why the "mute" option must be set in the URL (and only in Google Chrome), because in Firefox and Edge the video autoplays without adding the mute parameter.
In order for the autoplay=1 to work, you must put the single quotation mark after the "1" and a space. Works perfect after.
ex. autoplay=1"

allowfullscreen is not working on frameset

I have an old service working on frameset-frame (I know it's deprecated but I have no choice) and users can add youtube iframe tags.
but from some point the fullscreen action is not working anymore(it used to work).
There's allowfullscreen attribute added already.
<iframe width="560" height="315" src="https://www.youtube.com/embed/Ea9pOiwzd0c" frameborder="0" allowfullscreen></iframe>
I tried allowfullscreen on frameset and frame tag also.
I have tried like
allowfullscreen
allowfullscreen="true"
allowfullscreen="allowfullscreen"
mozallowfullscreen="mozallowfullscreen"
msallowfullscreen="msallowfullscreen"
oallowfullscreen="oallowfullscreen"
webkitallowfullscreen="webkitallowfullscreen"
... everything I can find on web but nothing worked for me.
You can try
allowfullscreen=true

Automaticly embed recent YouTube video with Channel ID

This working:
<iframe width="300" height="200" src="http://www.youtube.com/embed?max-results=1&controls=0&showinfo=0&rel=0&listType=user_uploads&list=VanossGaming" frameborder="0" allowfullscreen></iframe>
But for CHANNEL ID don't work.
This one don't work:
<iframe width="300" height="200" src="http://www.youtube.com/embed?max-results=1&controls=0&showinfo=0&rel=0&listType=user_uploads&list=UCKqH_9mk1waLgBiL2vT5b9g" frameborder="0" allowfullscreen></iframe>
So how to use this Iframe for CHANNEL ID.
Thanks for all answers..

embed a YouTube video in an XPages repeat control

I'm looking to embed a YouTube video into an XPage, probably into a repeat control. I've looked around but can't find anything specific to XPages. I can create a link to open the YouTube video but that just moves them to YouTube but I don't want to leave my site.
Does someone have an example of how to do this.
Use the HTML <iframe>, <object> or <embed> tag to insert YouTube videos into your XPage repeat control.
Example:
<xp:repeat
id="repeat1"
rows="30"
var="video"
indexVar="number">
<xp:this.value><![CDATA[#{javascript:
[ "http://www.youtube.com/embed/XMoTb1iep48",
"http://www.youtube.com/embed/lvs3vpmEKHg",
"http://www.youtube.com/embed/63lYaeOJZOA",
"http://www.youtube.com/embed/6D6PzLSlEsQ"
]
}]]></xp:this.value>
<iframe
width="400"
height="250"
style="margin:2em"
src="#{video}"
frameborder="0"
allowfullscreen="allowfullscreen">
</iframe>
<xp:text
rendered="#{javascript:(number + 1) % 2 == 0}">
<br />
</xp:text>
</xp:repeat>
Make sure you use http://www.youtube.com/embed/YOUR_VIDEO_ID as URL.
A detailed description you can find here.
You need to follow instructions and put a short snippet anywhere in the XPage. Something like:
<iframe title="YouTube video player" class="youtube-player" type="text/html"
width="640" height="390" src="http://www.youtube.com/embed/-X2zNe3YFNM"
frameborder="0" allowFullScreen></iframe>
With too many rows in your repeat you can expect lots of iframe reloads on every refresh.

Resources