通过谷歌驱动器api恢复视频网址,以在html5播放器中流式传输视频 [英] Recover video url through google drive api in order to stream the video in an html5 player

查看:79
本文介绍了通过谷歌驱动器api恢复视频网址,以在html5播放器中流式传输视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



你知道,如果谷歌驱动API提供一个绝对的网址到视频按顺序使用html5播放器流式传输视频? 解决方案

答案将非常类似于这是嵌入图片的



因此,基本上要获得可嵌入视频的URL,您必须:


  • 在Drive应用程序当用户点击文件并将其与您的应用程序打开时,您可以通过URL参数获取文件的ID。

  • 使用Drive API和文件的ID查询文件元数据:返回的文件元数据是一个包含一堆信息的JSON对象。

  • 在文件元数据中有一个名为downloadURL的属性,它给出了实际文件的URL。
  • >


获取文件元数据的示例为这里



如果您的文件已被公开共享,则该URL将可直接访问。如果该文件未公开,您将不得不使用OAuth 2.0授权对该URL的请求。



问题:该URL只能暂时运行。所以它不适用于每个用例。


I see that google drive use a flash player in order to stream uploaded video.

Do you know if google drive api provide an absolute url to the video in order to use an html5 player to stream the video?

解决方案

The answer will be very similar to this one for embedding images.

So basically to get the URL of the embeddable video you will have to:

  • In a Drive application you get the ID of the file through a URL parameter when the user clicks on a file and opens it with your app.
  • Query the file metadata using the Drive API and the ID of the file: the file metadata returned is a JSON object containing a bunch of info.
  • In the File metadata there is an attribute called "downloadURL" which gives a URL to the actual file.

Samples to get a file metadata are here.

The URL will be directly accessible if your file has been shared publicly. If the file is not public you will have to use OAuth 2.0 to authorize requests to that URL.

Problem: That URL only works momentarily. So it's not usable for every use-case.

这篇关于通过谷歌驱动器api恢复视频网址,以在html5播放器中流式传输视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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