Answer the question
In order to leave comments, you need to log in
Are YouTube API terms violated when watching a video in a third-party player?
Actually Terms of Service , but I did not find anything like it.
The Uppod player is used for display and the title of the video and links to the video and image are obtained through the YouTube API.
The code:
<script type="text/javascript">
var page = 1;
var maxResults = 3;
function drawVideos(data) {
var feed = data.feed;
var entries = feed.entry || [];
var links = feed.link || [];
for(var i=0; i<entries.length; i++) {
var html = '';
html += '<h2 class="title">' + entries[i].title.$t + '</h2>';
html += '<div class="video" id="videoplayer' + (i + 1) + '"></div>';
html += '';
$("#videos").append(html);
var flashvars = {"comment":entries[i].title.$t,
"st":"video8-1586.txt",
"file":entries[i].media$group.media$content[0].url,
"poster":entries[i].media$group.media$thumbnail[0].url};
var params = {wmode:"transparent", allowFullScreen:"true", allowScriptAccess:"always",id:"videoplayer" + (i + 1)};
new swfobject.embedSWF("uppod.swf", "videoplayer" + (i + 1), "400", "300", "9.0.115.0", false, flashvars, params);
}
for(var i=0; i<links.length; i++) {
if (links[i].rel == "previous") {
var html = '<a class="prev" href="#" onclick="showVideos(page - 1);return false">← предыдущая</a>';
$("#prevnext").append(html);
}
if (links[i].rel == "next") {
var html = '<a class="next" href="#" onclick="showVideos(page + 1);return false">следующая →</a>';
$("#prevnext").append(html);
}
}
}
function showVideos(p) {
page = p;
$("#prevnext").empty();
$("#videos").empty();
$.getScript("http://gdata.youtube.com/feeds/users/<username>/uploads?alt=json-in-script&start-index=" + ((p - 1) * maxResults + 1) + "&max-results=" + maxResults + "&callback=drawVideos");
}
$(function() {
showVideos(page);
})
</script>
Answer the question
In order to leave comments, you need to log in
Your API Client will not, and You will not encourage or create functionality for Your users or other third parties to:
…
10. access any portion of any YouTube audiovisual content by any means other than use of a YouTube player or other video player expressly authorized by YouTube;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question