youtube player api是否适用于谷歌驱动器嵌入式视频? [英] Does the youtube player api apply on google drive embedded videos?

查看:182
本文介绍了youtube player api是否适用于谷歌驱动器嵌入式视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究一个项目,该项目使用从谷歌驱动器嵌入的视频,它具有与YouTube嵌入视频相同的格式:

 < iframe id =player4src =https://docs.google.com/a/insynchq.com/file/d/ {{videos.folders}} / preview?enablejsapi = 1& playerapiid = player4width =500pxheight =400pxframeborder =0allowfullscreen>< / iframe> 

我通过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);

但是我不知道YouTube播放器api是否可以使用它。我已经尝试了api之后的一些事情,但没有得到很多结果。我想暂停幻灯片更改中的视频,这就是为什么我想知道它是否适用于嵌入式视频驱动器的原因。我想获取播放器实例,但是document.getElementById仅仅导致获取不允许我暂停其中的视频的iframe,或者我可能还没有发现一种方式?



任何帮助将不胜感激。不,Google云端硬盘上的视频目前尚未托管在YouTube上,尽管播放器可能会共享类似的源代码祖先。也许你应该研究将YouTube上的视频列为不公开的视频 - 你应该能够嵌入视频并使用官方API。


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.

这篇关于youtube player api是否适用于谷歌驱动器嵌入式视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆