Invalid Parameters on playing youtube embedded on a website - asp.net

At first I'm getting this error "This video contains content from sme. It is restricted from playback on certain sites" Then after reading this post I added few lines to my youtube emded url I'm now receiving a new error which says "Invalid Paramaters". By the way what I'm trying to do here is embed a youtube video on my site.
This is the original embed url of the youtube I'm trying to embed on my website. Where I'm receiving the error message "This video contains content from SME. It is restricted from playback on certain sites. Watch on Youtube".
<iframe width="420" height="315" src="http://www.youtube.com/embed/CFqbhsvXE7M" frameborder="0" allowfullscreen></iframe>
This is the editted one after reading the post. And getting this error "Invalid Paramaters".
<iframe width="420" height="315" src="http://www.youtube.com/embed/CFqbhsvXE7M?playlist=." frameborder="0" allowfullscreen></iframe>
I've done some research and it says YouTube indeed has changed their API over the last couple of days and flash fallback from their HTML5 Video Player fails. and I didn't find a clear explanation how to fix it. Using the original embed url the youtube plays well in my localhost. After I deployed it in a server I'm now receiving those errors. Is this something to do with the domain of the server I'm using?
Question:
How could I possibly fix this? T_T
Other Information: I'm using asp.net MVC3

Instead of using embed use watch and add in a few attributes, works all the time:
<iframe width="420" height="315"
src="http://www.youtube.com/watch?v=CFqbhsvXE7M"
frameborder="0"
webkitAllowFullScreen
mozallowfullscreen
allowFullScreen></iframe>

Related

Lazy sizes does not show video

I am using lazy sizes for the lazy load of my youtube videos. On every page the lazy load does work, but not on these two, more precisely, the whole video just disappears/is not displayed. The two pages are in the same folder as all other pages, which do work. The link to lazysizes.js is there <script src="lazysizes.min.js" async></script>
Here is the iframe on one of the working pages with the video being displayed:
<iframe width="640" height="360" data-src="https://www.youtube.com/embed/xxx?rel=0" importance="low" loading="lazy" frameborder="0" class="lazyload" allow="encrypted-media" allowfullscreen></iframe>
and here the iframe that just won't work/does not display the video - it's identical:
<iframe width="640" height="360" data-src="https://www.youtube.com/embed/3FOZ2CTaaWk?rel=0" importance="low" loading="lazy" class="lazyload" frameborder="0" allow="encrypted-media" allowfullscreen></iframe>
I know this just doesn't make sense, but my hope is that one of you stumbled upon the same problem. I have tried copying and pasting (swapped them, so it is not really the iframe code) and changing it, reloading the js etc. but nothing helps. The iframe is identical with the other pages. I have no idea how to find out what's missing here.
I'm stupid, the console revealed it: the lazysizes.min.js was loaded into the directory of this particular URL. Since this URL (and its /.../ directory) is artificially created the lazysizes.min.js could not be found in that directory (though on the FTP server the js file is in the same directory as the source php file that loads it) it could not be loaded.
A simple line of extra code that includes the lazysizes.min.js above the iframe embedment with an absolute URL to the js file solved the problem!

Unable to get start time and end time of embedded videos from IFrame

We are doing a learning web application where we have to show list of videos to user , these videos can be uploaded as embedded URL so when user play the same embedded URL then we are unable to store the values of start , pause and end time of the video, We are using iFrame tag for show videos
Tried to capture the values from iFrame but haven't reach the goal.
searched a lot on net but couldn't get satisfy able content.
<iframe width="670" height="400" id="vid${v.video_id}" src="${v.embedded_url}"></iframe>
try this one.. , just replace "url" from following code to your src url
<iframe width="560" height="315" src="url ?start=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Youtube Live Chat in Iframe (without API)

How is it possible to put the Youtube Live Chat into an Iframe?
I have this URL, but for me it does not work:
<iframe allowfullscreen="" frameborder="0" height="270" src="https://www.youtube.com/live_chat?v={VIDEO_ID}&embed_domain={MY_DOMAIN}" width="480"></iframe>
If I open the URL normally in the Browser, I get the chat, but in the Iframe i get nothing.
Please help. Thx :)
You may need to have embedding enabled first, you can check the status of your account at this link after you're logged in the youtube account: https://www.youtube.com/features
Also the domain part (MY_DOMAIN) needs to be without the 'https://' or 'http://' and port numbers like ':3000'
It says it's possible, but only on Desktop browsers:
Note: embedding live chat isn't available on mobile web.
During a live stream, you can embed live chat on your own site by
using an iframe.
Get the video ID for the live stream. You can get the video ID from the watch page URL (youtube.com/watch?v=12345). In this case, the video ID is ‘12345’. If you chose "Stream now," right-click on the player and select Copy video URL to get the video URL.
Get the domain URL for the site you want to embed chat on. If you're embedding chat on www.example.com/youtube_chat, your embedding domain is "www.example.com."
Combine the embedded URL in the following way: https://www.youtube.com/live_chat?v=12345&embed_domain=www.example.com
This is the URL for your iframe. Note the embed_domain must match the URL of the page you’re embedding the chat on. If they are different, the embedded chat will not load.
https://support.google.com/youtube/answer/2524549?hl=en
I made an example with:
<iframe width="560" height="315" src="https://www.youtube.com/embed/5qap5aO4i9A" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="185" height="315" src="https://www.youtube.com/live_chat?v=5qap5aO4i9A&embed_domain=fiddle.jshell.net" frameborder="0"></iframe>
Which looks like this:
View the working demo here:
https://jsfiddle.net/kmturley/9Lmbdgn2/8/

Vimeo iFrame only loads occasionally

This vimeo video loads fine on its own with the iframe snippet below
<iframe src="http://player.vimeo.com/video/19513284?byline=0&portrait=0&color=ffffff" width="350" height="192" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
But once loaded as part of this page, it will only work some of the time. I disabled all applicable CSS rules to that iFrame element, but it still won't load.
This happens on Chrome, Firefox and Safari, cleared cache or not.
Any thoughts?
That's because your site is secure. Browsers have started blocking insecure elements loaded on secure pages. The easiest solution is to remove the "http:" from the src of the iframe:
<iframe src="//player.vimeo.com/video/19513284?byline=0&portrait=0&color=ffffff" width="350" height="192" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
That will load via the proper protocol where necessary. Note that we are still working on getting our video files loading over https, but the embed will still work in the meantime (you'll just see a warning in the address bar in some browsers).
Your iFrame source needs to be https://

How can I play a URL in an iframe?

I want to play a URL in an iframe. When I place any other URL in the following line, it works fine, but when I enter the YouTube URL I get a blank page. Can anyone tell me where I am going wrong, or suggest any other method by which I can play the YouTube URL in an iframe?
<iframe width="100%"
height="610px"
frameborder=0
marginwidth="0"
marginheight="0"
scrolling="yes"
name="frmTest"
src="http://www.youtube.com/watch?v=dG5irzonTXA">
</iframe>
Your code will open a normal YouTube page. If I'm correct you want to have an iframe with video in it.
Try this: https://developers.google.com/youtube/youtube_player_demo
There's lot's of documentation there too.

Resources