YouTube Live Streaming embed code keeps changing - youtube

I do live streaming with YouTube and I can watch it on my site by coping the embed code into my site
Its looks like this below
<iframe width="640" height="360" src="https://www.youtube.com/embed/gz54fede3Y" frameborder="0" allowfullscreen></iframe>
But recently I discovered that every time I do a live stream, I have to start updating the embeded code on my site each time with the one that will be generated from my live channel.
This is because it keeps regenerating a different code. Its so frustrating to do this, is there a way to get a particular embed code that will not change so I don't have to worry about this, or is there a setting that I am not aware of.

There is a static URL to embed the video player for the "Stream now" stream. It is currently not exposed anywhere in the UI, but we will fix that soon (hopefully.)
It looks like this: https://www.youtube.com/embed/live_stream?channel=[channel ID]
You can also use a YouTube Gaming link, like so: https://gaming.youtube.com/embed/live_stream?channel=[channel ID]
You can determine your channel ID by going to https://www.youtube.com/account_advanced and copying the string after "YouTube Channel ID".
Once you've got this link, you can use it in the "src" attribute of your embed code.

Related

youtube live chat show only on desktop - on mobile see nothing

I used the following iframe to embed youtube live chat:
If you try to see the embeded chat you see regurarly on desktop version:
https://visionforex.info/market-news/
If you try to see it on mobile I only see a blank space.
My question is: is it possible to show youtube live chat on mobile ?
Are there any limit? I have seen on internet that youtube don't allow live chat on mobile if you don't have an ADSense account. We have a Google ADS account on the web site.
Any suggestion is very appreciated!
Many thanks in advance
Marzio
I tried to put the iframe directly into the page and not into widget but nothing changed.
I followed all suggestion find out on stack overflow without success.
It says YouTube Chat embed is not possible on Mobile, 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

YouTube Embed Shows Different Video in Various Browsers

I've got a YouTube video I'm embedding in an iFrame. Here's the embed URL:
http://www.youtube.com/embed/-3W3xvAcD2Y
In the current versions of Safari, Mobile Safari, and Firefox on my Mac I get a doubled video (3D version?) once the video actually starts playing, as shown below:
(Note: the preview image looks normal, you have to actually start playing the video before it doubles like this.)
In Chrome I get the correct version:
Both are using the HTML5 player FWIW, and these embed links have been working for me until recently. I see the same results when actually embedding the links in an iFrame; it's just easier to link to the embed URL here. In my testing, I don't see this for all YouTube videos; it might be limited to videos that have been uploaded recently, but I'm not 100% sure on that (here's another example that shows the problem).
Any idea what is going on? Could this be an embed code error on YouTube that popped up recently? Give that URL a try and let me know if how it works on other browsers.
I'm having the same problem.
Looks like YouTube is forcing 3D on embeds for random HTML5 videos. I noticed mozstereomode="1" is being applied on videos that are having this issue.

JavaFX project play youtube videos

I work on an automatically music player. To be short, i use the Last.fm api to get a lot of tracks names and tags. Using these tags and some intelligence computing algorithms, once you play a track, the player sets another track (with tags very appropriate to the tags of the track listened before).
I used the youtube API to search for the URL's of the movies, and I managed to make it work. Now I want to make the videos play on my music player. I have tried to place the youtube player on WebView. It works, but not as intended. I want to control that player. I want it to start playing automatically, and I want to get noticed when the video ended so I can start the next one.
Any clues of what should I do to play the videos from youtube based on the search that uses the Youtube API, and to have control over the youtube player that I place on my GUI(make it play and stop from command line)? Or is there any possible way do download the youtube movie and play it using the JavaFX API? I searched google and noticed I cannot download youtube movie into a format that can be played by JavaFX api.
Update Dec 4th, 2015
Some versions of JavaFX 8 are unable to play back youtube video content. Currently, for instance, Java 8u66 cannot playback youtube video content, but Java 8u72 early access release can.
Also note some of the videos referenced in the sample solution are no longer available or are protected from play in embedded video players. So ensure that you perform any tests using available and videos that have not been distribution restricted. Refer to the youtube documentation for information on distribution restriction if need be.
Any clues of what should I do to play the videos from youtube
As a hints to get you started, see code playing YouTube videos in JavaFX and the YouTube HTML5 api.
Here is the sample code I linked running and playing YouTube videos back within a JavaFX WebView with some (very minimal) control over the video playback via interaction with a JavaFX "New Song" button.
Or is there any possible way do download the youtube movie and play it using the JavaFX API? I searched google and noticed I cannot download youtube movie into a format that can be played by JavaFX api.
I think such a usage would violate YouTube's terms of service. I believe YouTube requires you to play the video back using the YouTube video player (let's them insert ads in the video player etc).
5.1 A
you agree not to distribute any part of or parts of the Website or the
Service, including but not limited to any Content, in any medium
without YouTube's prior written authorisation, unless YouTube makes
available the means for such distribution through functionality
offered by the Service (such as the YouTube Player);
5.1 C
you agree not to access Content through any technology
or means other than the video playback pages of the Website itself,
the YouTube Player, or such other means as YouTube may explicitly
designate for this purpose;
I advanced little, but I got stuck to other problems.
First of all, the code from jewelsea was great. Now I could embed the player into a secondary window of my player and it shows the movie based on the URL that i got using the youtube api. But it looks like JavaFX cannot show most of the movies. It shows me the youtube player and an error message saying that I need to install latest version of Adobe Flashplayer. From my research, I noticed that the webView can only show movies with quality set at 240p, not higher.
I have searched a lot on Google how to make my webView to play the 240p quality video. First of all, i tried to set the youtube query parameters (https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters#formatsp). I tried all the parameters from there: 1,5 and 6. But yet, I did not get the URL of movie with format that can be viewed on the webView of the JavaFX.
I also tried to embed the video quality in the URL of the movie like this:
http:/www.youtube.com/watch?v=og2YZlLhjKs&vq=small:240p ; but it does not work at all. I also wrote that URL in the browser and it looks like the youtube automatically sets the video to the highest quality, no matter what parameter I write in the URL.
The youtube api code that I used is the same like in this webpage: http://www.javacodegeeks.com/2010/05/getting-started-with-youtube-java-api.html
I just moved the main class code to a method that returns the URL of the first video that is in the list, and I changed the " query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT); "
to " query.setOrderBy(YouTubeQuery.OrderBy.RELEVANCE);". And this works fine, it shows the url to proper music videos that I search.
I am sorry for not showing the code of my project but it is big and it contains 2-3 api keys, and if you tell me how to change the video URL http:/www.youtube.com/watch?v=og2YZlLhjKs to work on the code from this website: https:/gist.github.com/jewelsea/1437374 , then I will know that to do to make it work on my project as well;
And the thing about YouTube playback API also enlightened me. I see that API has a lot of functions that could help me to play a lot easier with the video content (make it play, make it stop) but the problem is that I do not have knowledge about javascript programming and it is very sad that I do not have those methods in Java API as well. Maybe I will give it a try and insert javascript code into my webview. But, if I edit the webview using javascript... Is it going to play higher quality movies on the JavaFX webView?

Youtube video player

Is this possible to allow just a specific website to display a youtube video
with the iframe embeded code? or with the api
With the iframe code alone it is not possible. Your youtube-video displayed on the youtube website. As long as anyone can view this video by going to youtube like thishttp://www.youtube.com/watch?v=jJjg4JweJZU
for example, anyone can embedd it using an iframe.
What you could do is limit the acces to this video itself. As far as I remember you could specify whether anyone or just your friends can whatch your video.
The latter case may not keep people from embedding your video, but it will keep them from viewing it as long as they are not logged in to youtube and are your friends there.

YouTube API: API says it is embeddable and not blocked but when it is embedded it is blocked

I wonder if anyone ever encounters this problem. I am trying to embed "The Killers - Human" Music Video.
When I did an API feed request as follow:
http://gdata.youtube.com/feeds/api/videos?v=2&alt=jsonc&q=_Q9B9LOJIXsk
It shows that the video is embeddable and is not blocked. It even states that you can embed using the following URL:
http://www.youtube.com/v/Q9B9LOJIXsk?f=videos&app=youtube_gdata
However, when I tried this and played the video, I have received an error that the video contains content from UMG and is restricted to playback on certain sites. It is SUPPOSED to be able to playback.
I have double checked all the states etc. I wonder if I have missed anything to determine if a video is not embeddable or not on certain site.
Thank you for your help.
when you open the json you can actually see this
"status":{"value":"restricted","reason":"limitedSyndication"},
"restrictions":[{"type":"country","relationship":"deny","countries":"DE"}]

Resources