I am not using Iframe's api but simply embedding iframe as follows.
<iframe id="ytplayer" type="text/html" width="640" height="360"
src={`https://www.youtube.com/embed/?listType=playlist&list=PLAYLISTID`}
frameBorder="0" allowFullScreen></iframe>
Is there a way to call the function player.getPlaylistIndex():Number without implementing iframe's api?
Related
I'm in way over my head on this one.
The goal is to be able to hit spacebar for play/pause, and f for fullscreen when the page loads.
I'm loading the YouTube embed like this:
<script src="https://www.youtube.com/iframe_api"></script>
<iframe
id="player"
frameborder="0"
allowfullscreen="1"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
width="1280"
height="720"
src="https://www.youtube.com/embed/<?php echo $video_id; ?>?autoplay=1&modestbranding=1&iv_load_policy=3&enablejsapi=1">
</iframe>
The question is, can I focus the iframe controls using postMessage? Or any other method?
If so which element in the iframe do I need to focus to be able to get it done? I think it's html5-video-container > video.
Don't think I even need the YouTube jsapi, but it's there for now.
I've been over this SO question about a dozen times and many others, as well.
You can't do it because you cannot insert the javascript required for postMessage to work into youtube's iframe.
Yes, I see that you created the iframe yourself on your page, but that's not how it works.
I stored a few youtube URLs in Firebase, and I want to insert them in the html like so:
<iframe width="560" height="315" src="{{main.vid}}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
However, when running the code it only displays a blank. I am using the correct URL when clicking share and then embed on Youtube.
When I replace the Firebase data URL with the normal one like so:
<iframe width="560" height="315" src="https://www.youtube.com/embed/6CulBuMCLg0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
it works fine. Any help?
It looks like you are using Angular or something similar.
Angular sanitizes URLs before string interpolation for security reasons.
You need to bypass the sanitizer. A possible solution is a custom pipe.
i want to run javascript code over an iframe tag of html5.
this is my code for iframe
<iframe width="560" height="315" src="https://www.youtube.com/embed/i6Rdkv-DLwk" frameborder="0" allowfullscreen></iframe>
I'm trying to embed Ted talks videos with a time variable.
On their website, if you add an anchor id like #t-618000 after the url, it works.
Eg. https://www.ted.com/talks/hans_rosling_at_state#t-618000
When I try an embed with the time variable, it does not work :
<iframe src="https://embed.ted.com/talks/christopher_soghoian_your_smartphone_is_a_civil_rights_issue#t-23580" width="640" height="360" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
How can I find the javascript piece of code using this variable to change the player time?
Thank you
You can set the playback range by including
#t=[starttime][,endtime]
as a fragment at end of URL pointing to media resource.
Can I get image from google maps iframe? Thanks.
For example I have next iframe:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.ua/maps?q=%D0%BD%D0%B8%D0%BA%D0%BE%D0%BB%D0%B0%D0%B5%D0%B2+%D1%83%D0%BA%D1%80%D0%B0%D0%B8%D0%BD%D0%B0&ie=UTF8&hq=&hnear=%D0%9D%D0%B8%D0%BA%D0%BE%D0%BB%D0%B0%D0%B5%D0%B2,+%D0%9D%D0%B8%D0%BA%D0%BE%D0%BB%D0%B0%D0%B5%D0%B2%D1%81%D0%BA%D0%B0%D1%8F+%D0%BE%D0%B1%D0%BB%D0%B0%D1%81%D1%82%D1%8C&gl=ua&t=h&z=10&ll=46.975033,31.994583&output=embed"></iframe>
And I need tage an image of this map. It`s really?
You cannot have access to the content of an iframe of different domain. See jQuery/JavaScript: accessing contents of an iframe.