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
Related
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', {});
This is a fairly basic question I think. If a site uses the YouTube API to embed videos on it, will plays to that video also register as plays on the YouTube site itself, or are those plays only counted for people that actually play the video on YouTube.com?
I searched through google and Youtube docs, but didn't see anything relevant, but I could have missed seeing it.
They would count as normal plays via YouTube website if you use official IFrame player API for embedding.
Note: A playback only counts toward a video's official view count if
it is initiated via a native play button in the player.
However, note if autoplay is enabled, views will not increase.
See here: Embedded youtube video with "autoplay=1". Does it count towards views?.
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.
Try to create feed which show shared video from youtube, vimeo, hulu and vube.
For this, I create custom view which has thumbnail by default and after user tap thumbnail replaced by UIWebView with url to shared video.
After page loaded, I try to start play video using Media API and method play.
That works good for vimeo, but does not work for youtube, unfortunately i did not check with hulu and vube.
Maybe someone have have workable solution, or some suggestion how that can be done?
The only way to display a youtube video inside your application is by using the YouTube Helper Library, developed by Google, which provides a subclass of UIWebView that you can use.
Here you'll find every information you need.
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.