Change language for YouTube embed - youtube

Does anyone know if it's possible to change the language of the Youtube embed player. For example, to change things like "Full Screen", "Change Quality" etc into German?
Thank you.

How are you embedding it? If it's simply with the embed url, you can do something like adding the parameters "hl=de" and "persist_hl=1" to the url. Like so:
<iframe id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube.com/embed/M7lc1UVf-VE?hl=de&persist_hl=1" frameborder="0" allowfullscreen>
I've only found out about "persist_hl" by adding "hl=de" to a basic youtube page and checking what the url to display youtube in german was. I haven't found any info about it and what it does.
Edit:
I doubt my answer is valid. The "persist_hl" parameter will change the user's cookies for youtube's site and force the new language.
Edit 2:
Looks like you shouldn't force the language anyways as it should depend on the user's preference: https://stackoverflow.com/a/12696747/1372543
The answer's from Jeff Posnick, who works for Google. I feel it applies to your question.

Related

Embed recently uploaded youtube video

I want to automatically embed my recently uploaded video from my YouTube channel in the sidebar of my website.
I got a good answer but it include user id they asked for
youtube.com/user/SomeName but in my case, it's like youtube.com/CHANNEL/name. I tried replacing "SomeName" with my channel id, but it didn't work for me
Thanks everyone for your answer. I found a pretty easy way to do this
All you need is id for your upload playlist and to find that visit google API explorer
Services > YouTube Data API v3 > youtube.channels.list
fill in the part section with "contentDetails"
and id section with youtube channel id (the one starts with UC)
scroll down and click on execute
you will find
"uploads": "UUIprTMT-TDysEDx03YMcS5Q",
in ** "relatedPlaylists"** section
copy that tag and now use this code to embed
<div style="position:relative;height:0;padding-bottom:56.25%"><iframe src="https://www.youtube.com/embed/videoseries?list=YOUR_UPLOAD_TAG" width="640" height="360" frameborder="0" style="position:absolute;width:100%;height:100%;left:0" allowfullscreen></iframe></div>
Test on fiddle
And you are done :)
You can embed youtube channels or playlists, as said here:
https://stackoverflow.com/a/30089630/7733026
Here is how to embed a channel
<iframe width="600" height="340" src="http://www.youtube.com/embed?max-results=1&controls=0&showinfo=0&rel=0&listType=user_uploads&list=YOUR_CHANNEL_NAME_HERE" frameborder="0" allowfullscreen></iframe>
To get your channel name click "My Channel" and its the line of text
after "/user/".
You can also embed playlists with this:
<iframe width="600" height="340" src="https://www.youtube.com/embed/+lastest?list=PLAYLIST_ID" frameborder="0" allowfullscreen></iframe>
Firstly, many options have been removed from the API from V2 to V3.
A few things still remain, but are not going to help unless you know that it will be used.
One is the user name. Legacy Usernames are still around for channels that are old enough, but newer ones will not have them.
This is normally the Title of the page, but the title can now be changed.
This is where the ID's come into it. Everyone has a unique ID, but can have the same Tile as another page. (even if confusing some times)
Example of an old channel is Google
https://www.youtube.com/user/Google
The "user" name is a Legacy name.
But all channels old and new will have a "Channel" as well
https://www.youtube.com/channel/UCK8sQmJBp8GCxrOtXWBpyEA
Note that it will give you an ID rather than a name.
So to get you what you are looking for, will need to be thought through.
Will the channel have a legacy user name? Do you need to show a name? or do you only want to find the last uploaded video regardless of name?
Best practice today will be to use the ID. Then with the API, get the relevant information that you need.
Step one is to call
https://www.googleapis.com/youtube/v3/channels?part=contentDetails,id,snippet&id=[THE_CHANNEL_ID]&key=[apiKey]
The contentDetails section will contain an uploads portion.
This will be the user uploads to the channel and will start with UU
Though a short cut will be to take the channel ID starting with UC and change it to UU. But I would recommend the API approach for security and peace of mind.
Then with the uploads playlist ID (the one starting with UU), you can call
https://www.googleapis.com/youtube/v3/playlistItems?part=id,snippet,contentDetails&maxResults=1&playlistId=[PLAYLIST_ID]&key=[api-key]
Normally the first in the array will be the last one in. The newest one. So setting results to 1 will give only the first in the array.
If you want to do further checks to make sure, then set results to 50 and use the contentDetails to dig the uploaded time of the video and select the newest that way.

Disabling Youtube autoplay when providing a URL link

I need to provide people with a URL link to some of my Youtube videos, but I don't want Youtube to then automatically display some random video that it thinks should be "up next". There's nothing more embarrassing than trying to show people your work and then up pops a ridiculous video that they think must be yours as well.
I've tried tacking on "&autoplay=false" and "&autoplay=0" to the end of the URL, but that doesn't work.
Anyone know what needs to be done?
You can send people an embed link that shows the video only. I think in your case this would be fine, but for anyone that requires comments, it would be an issue. Also adding ?rel=0 will stop the end card from showing related videos from another users channel.
https://www.youtube.com/embed/OefocRFlDss?rel=0
A list of embed params can be found here: https://developers.google.com/youtube/player_parameters
I guess that's not possible, but maybe you could embed that video via API to some server you own, and disable the suggestions.
Check this documentation for disabling, controls and siggestions.
https://developers.google.com/youtube/player_parameters#autoplay
Or this: http://illuminea.com/remove-related-videos-from-end-of-embedded-youtube-video/
Luck!
This feature does not seem to be customizable from the url; it's more of a user setting. You can find here some details about how to turn it off for yourself but you cannot control the way it will behave for others.
Also, I'm not sure if this question qualifies as a programming one. :)

Youtube embedded player - show no recommendations (videos) at the end?

I have an am bedded youtube video in my site, but at the end of it, Youtube displays a set of recommendations (other videos) which I'd like to remove since they have nothing to do with my video.
Is that possible? Can't seem to find anything gin the Youtube embedded API :(
Just add ?rel=0 at the end of your video, &rel=0 no longer works
Example:
<iframe src="https://www.youtube.com/embed/hy9Cbp_yV5Y?rel=0"
width="100%" height="100%" frameborder="0"></iframe>
The trick is to attach to the player URL (http://www.youtube.com/v/Yc_J_kXaFSw) the rel=0 parameter.
The player URL will became http://www.youtube.com/v/Yc_J_kXaFSw&rel=0
The source of this information:
http://www.varesano.net/blog/fabio/disable%20related%20videos%20embedded%20youtube%20player
Just add &rel=0 at the end of your video url, this should remove the recommendations.

Youtube API html5 video

I will be writing an application that uses the youtube API for videos. I want to integrate it with canvas. Is there anyway to make sure I get HTML5 compatible videos through the API calls?
In case you mean using <video />: the only way to embed YouTube-videos is <object /> or <iframe />. So, embedding via <video /> is not possible at this point and will most likely never be.
In case you mean validity: Both available options are valid in HTML5.
With the IFrame API, YouTube may use HTML video instead of Flash, but this can't be set manually. See this.

Can someone explain the difference between these two Youtube URLs?

Im building a site which opens Youtube videos onsite using Shadowbox.
I have found out that linking to a video this way ...
http://www.youtube.com/watch?v=wDZFf0pm0SE
..doesn't work (Shadowbox opens, video doesnt play). But linking this way...
http://www.youtube.com/v/wDZFf0pm0SE
.. does.
Can someone explain to me what is going on here?
The /v/ link is a direct link to the video, which is used for embedding it. You use it like this:
<embed src="http://www.youtube.com/v/wDZFf0pm0SE&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="800" height="600"></embed>
However, due to licensing restrictions some videos will fail to play in the /v/ format.
The &autoplay=1 part just tells it to start the video on page-load. (Remove it to not do that).
The normal link is used to watch the video from Youtube itself.
Hope this helps.

Resources