Youtube iFrame Api for live videos? - youtube

I'm trying to implement live video from youtube channel with youtube iframe api. There is a videoId property in api and it works for live videos too but we have to add video id every stream start.
There is a solution in iframe live video https://www.youtube.com/embed/live_stream?channel=CHANNEL_ID. How can i use it in iframe api?

I came across this same issue. I figured out that you can directly add the iframe with the src instead of an empty div. Then give it an id and pass that to the new YT.Player instance.
ex:
html:
<iframe id="player" src="https://www.youtube.com/embed/live_stream?channel=CHANNEL_ID?enablejsapi=1"></iframe>
js:
var player = new YT.Player('player', {});

Related

Video Code: Mute and Autoplay

How do i mute a Youtube Video with in my iframe block without using JS? Is it a way which can be leveraged?
-I do not want to consume Youtube API. Is there any way that videos can be muted with just API parameters?
I think it is not possible if you are only using the YouTube API parameter.
If you check the supported parameter of the IFrame Player API, you will not see any parameter here that can mute the video.
So the only way to mute video is the player.mute():Void.
Here is the jsfiddle for the sample code.
For more information, check this related threads:
How do I automatically play a Youtube video (IFrame API) muted?
How to Embed a YouTube Video with Sound Muted
use &mute=1
example : <iframe src="https://www.youtube.com/embed/UNIQUE-VIDEO-ID?&autoplay=1 &mute=1&rel=0&controls=0"></iframe>

Does the youtube player api apply on google drive embedded videos?

I've been working on a project that uses videos embedded from google drive, it has the same format as a youtube embedded video:
<iframe id="player4" src="https://docs.google.com/a/insynchq.com/file/d/{{ videos.folders }}/preview?enablejsapi=1&playerapiid=player4" width="500px" height="400px" frameborder="0" allowfullscreen></iframe>
I imported this as said by the api:
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
but I don't know if the youtube player api works on it. I've tried sort of things following the api but didn't get much of a result. I want to pause the videos on slide change that's why I want to know if it works on drive embedded videos. I would want to get the player instance but document.getElementById just results in getting the iframes which does not enable me to pause the video in it, or is there a way that I may have not discovered yet?
Any help will be much appreciated. Thanks!
No, videos on Google Drive are not currently hosted on YouTube, though the player may share a similar source code ancestor. Perhaps you should investigate listing the video on YouTube as "unlisted" instead - you should be able to embed the video and use the official API.
You could use as src something like this:
https://youtube.googleapis.com/embed/?partnerid=30&docid=<video file id>
This will make your video playable but won't be listed or uploaded to Youtube

How to play VEVO Content using YouTube iframe API?

I need to play VEVO videos on an HTML5 player which is created using YouTube's API in iOS.
https://developers.google.com/youtube/iframe_api_reference
Currently I'm able to play normal videos with out a glitch.But when ever i try to play a VEVO video,It says "The content cant be played outside of YouTube".Is there any legal way of going about this?.
I have already tried to set the "origin" property of the player to my domain.This did not help.
This is an Example from the above link where the origin is set
<iframe id="player" type="text/html" width="640" height="390"
src="http://www.youtube.com/embed/M7lc1UVf-VE?enablejsapi=1&origin=http://example.com"
frameborder="0"></iframe>
If anyone knows of any other way to legally play VEVO content please let me know. :).Any legal loopholes will also do :D.
I have played some vevo videos just by placing the ID.
Sometimes vevo videos have certain restractions for embedding like for example, the country from the user is fetching the video.

Get the video tag of youtube embed videos

I'm trying to change the playback rate of an embed youtube video, is there any way to get the video tag?
I know that the video is held in an iframe, could a chrome extension be used to bypass the security?
Any help appreciated :)
YouTube API creates a public JavaScript object that allows you to control the YouTube video. By default the object is called player.
The only problem is if the developer assigned it to another object.
I guess what you need is not to bypass the iframe, you just need to detect the name of that object.
If you're using the HTML5 YouTube player:
document.getElementsByTagName("video")[0]

How to play youtube videos through vlc plugin?

I'm using vlc plugin into C# Windows form application. It works fine with all media type but it can't play youtube videos through the plugin also it can be played in the main player itself. I'm using the following code :
axVLCPlugin2.playlist.add("http://www.youtube.com/watch?v=BxPtmLmqdXU");
axVLCPlugin2.playlist.play();
How the could should be to be able to play youtube videos ?
You are specifying the URL of the youtube web page, not of the video itself. You need to get the URL of the video itself and specify that. There are many web pages that allow you to extract the URL of the video, given a youtube page URL, like:
Get link to actual video

Resources