This document describes the API provided by the JavaScript file
video-info.js
.
This documentation is for the old API which is no longer supported. If you're going to start a new web page, please reference the new Snip API. This page is provided for those who are still on the original API implementation.
Required Files
video-info.js
requires 1 external JavaScript source file in order to work correctly,
async.js
. It can be included as so:
<script src="http://ytsnip.sf.net/async.js" type="text/javascript"></script>
Also, most browsers will not allow this script to load the video data directly from Google. One technique is to use a local proxy to download the data. There is an example PHP file here, which is used on this site for downloading this information.
VideoInfo - Fields
Field Name | Field Type | Read Only? | Description |
VideoInfo.version | string | Yes | String specifying the version of the file currently loaded. |
VideoInfo.userErrorCallback | function | No | On error, this function is called. It defaults to the PlaylistHelper's userErrorCallback if not defined. |
VideoInfo.url | string | No | The URL from which to download the video data. It must allow for appending the Video ID at the end of the string. This can be more easily customized with the function VideoInfo.setLocalProxy(string). |
VideoInfo - Functions
VideoInfo.setLocalProxy(string pageName)
Parameter | Type | Description |
---|---|---|
pageName | string | Optional parameter to specify the local proxy page (and any optional URL parameters) |
Adjusts the VideoInfo.url value to be the
current URL plus the argument pageName
. If pageName
is null
or not given, then it defaults to
"../ytdataapi-proxy.php?v="
, which can be downloaded
here. Note that it must take the
YouTube video ID at the end of the string.