0

I know Youtube and Vimeo both have embed codes that allow you to embed their player into any webpage. However, I'm looking to build a web player with a consistent appearance. More importantly, I'm looking to build a player that could play videos from as many video hosting services out there. I'm starting with Youtube and Vimeo, but I want to gradually increase the support for video services. I figured that maybe if there was some interface that was consistent between video hosting services, that this maybe easier, like a protocol of some sort. Then it hit me that URLs are the general protocol for this sort of thing; no need to re-invent the protocol. So, if only Youtube and Vimeo provided a URL to a video file that I could play in my player, then I can easily find some cross-section between all these services.

This is why I'm here; I'm asking if anyone knows if these services provide a URL to the raw video file or files (for different formats, flv, H.264, WebM, etc) that I can use for a custom video player? Or is this something the hosting services prohibit due to advertising revenue things?

4

2 回答 2

3

由于您推测的许多原因(还有他们不希望您下载视频的问题),您不太可能找到可以让您直接访问文件本身的视频托管服务。但是,至少 Youtube 提供了将视频嵌入到无铬播放器的能力——这样,根本没有 Youtube 控件,因此您可以覆盖自己的 JavaScript 工具栏,将其连接到播放器 API 等。其他托管服务也这样做。

Vimeo,除非最近发生了一些变化,它也有一个播放器 API,但没有给你隐藏他们的控件的选项,所以它不是一个完美的无缝体验。

以下是从 YouTube 嵌入无铬播放器的方法:

var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

function onYouTubeIframeAPIReady() {
  var player;
  player = new YT.Player('player', {
    videoId: 'voNEBqRZmBc',
    playerVars: { 'autoplay': 1, 'controls': 0 },
  });
}

您还可以通过查看已经尝试成为各种视频共享网站(例如http://www.videojs.com )包装器的播放器的代码来找到一些信息

于 2013-08-20T05:24:59.833 回答
0

Vimeo 允许 PRO 成员访问他们通过 API 上传的任何视频的源文件。

如果这对您有用,您可以使用https://vimeo.com/help/contact上的表格请求访问新 API

于 2013-08-20T15:16:46.177 回答