Is it possible to have an embed YouTube clip on your website that auto-plays when you load the page and when you press the clip it starts from the beginning
<iframe width="420" height="315"
src="https://www.youtube.com/embed/tgbNymZ7vqY?autoplay=1">
</iframe>
I looked around but I can't find the specific functionality I am looking for.
Auto play policy has been changed.
( https://developers.google.com/web/updates/2017/09/autoplay-policy-changes )
If you want to autoplay, add "mute". (Tested in Chrome)
<iframe width="420" height="315"
src="https://www.youtube.com/embed/tgbNymZ7vqY?autoplay=1&mute=1">
</iframe>
And you can control the youtube video with JavaScript.
https://developers.google.com/youtube/iframe_api_reference
It can be implemented variously. I made a sample. (use "seekTo" API)
https://jsfiddle.net/raykim2414/uv7b6ty4/15/
Related
I've been trying to emulate this: https://codepen.io/chriscoyier/pen/zawHg
This works when the video is muted, however when I try and remove the &mute=1 in the URL, the video will no longer play.
original:
<iframe id="video" src="//www.youtube.com/embed/FKWwdQu6_ok?enablejsapi=1&html5=1&mute=1" frameborder="0" allowfullscreen></iframe>
adapted:
<iframe id="video" src="//www.youtube.com/embed/FKWwdQu6_ok?enablejsapi=1&html5=1" frameborder="0" allowfullscreen></iframe>
I'm not sure why this is happening.
The expected outcome I'm trying to achieve is on page load, the video starts automatically (with sound), but can be controlled with the custom play/ pause buttons thank you!
Is it possible to disable the video playing on fullscreen?
When I press play on the player on the iOS, it is playing the video in fullscreen mode, whereas in android it is playing in the normal mode.
Sharing the code I'm using
<div>
<iframe
src="https://player.vimeo.com/video/120061340?playsline=true"
frameborder="0"
allowfullscreen="false"
allow="autoplay; encrypted-media"
webkit-playsinline="true"
playsline="true"
playsinline="true"
style="position:absolute;top:0;left:0;width:100%;height:100%;"
controlsList="nofullscreen"
title="Sample Video">
</iframe>
</div>
<script src="https://player.vimeo.com/api/player.js">
</script>
Please let me know if I'm missing something here
You're loading an iframe and trying to put video element attributes on it. Instead of loading the iframe, you'd need to call the video file directly in your own video element. Alternately, you can add a mutation observer that waits for the Vimeo video element to be inserted into the page and which then adds the webkit-playsinline attribute to it.
i am trying to create a webpage which other than some other content also includes a video.
because of the reason that i have to append the video url dynamically i am using the <iframe> tag isntead of <video> tag.
it is working fine in chrome and other browser, But when i am checking it on internet explorer(11) the video is getting played on media player. NOT inside the webpage.
i am not using the html <video>. code is something as below.
<iframe class="video-responsive-iframe"
ng-src="http://trinilearn.vo.llnwd.net/o3/RV/RV-10723/05-profile.mp4"
frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen>
</iframe>
i am expecting it to open the video in the webpage itself , but it is always opened in the media player.
Try using the video tag instead.
<video class="video-responsive-iframe" src="http://trinilearn.vo.llnwd.net/o3/RV/RV-10723/05-profile.mp4" webkitallowfullscreen mozallowfullscreen allowfullscreen></video>
I'm using the YouTube iframe api to embed a video.
When playing the video on an iPhone, the video automatically switches to full screen mode. I was wondering if it's possible to force the same behavior on an Android? (currently the video is played inline, which doesn't look so good).
There is no way to automatically play the video fullscreen. The closest you could get is to put the player in a fullscreen div and autoplay it using the url params:
<iframe width="100%" height="100%" src="//www.youtube.com/embed/fSy6uh-GjCc?controls=0&autoplay=1&showinfo=0" frameborder="0" allowfullscreen></iframe>
it is possible to create a button to play and pause the youtube video when using the youtube script, i mean this
<iframe title="YouTube video player" width="853" height="510" src="http://www.youtube.com/embed/LVcXdMB1_YA?rel=0&hd=1" frameborder="0" allowfullscreen></iframe>
i'm using this to load the video, but i would like to have for example a link, saying "Play Video", and when the user click the link, the video start to play, all i've tried ends up in nothing, i even think that it is no way to do this, but to be sure, i came here to SO.