This is the final post of the series that has so far covered the very basics of showing a list of video titles, to paging of the list using jTube. In this post I will discuss how to embed a video using jTubeEmbed which comes with the jTube jQuery plugin, also how to show the video thumbnail provided by YouTube. To show these features off I will modify where we left off in the paging tutorial and show the video for the first entry of the page then show the thumbnail for the other videos on the page.
To show the video only on the first video we need to modify the each loop to tell us where we are in the loop. Simply add `index` as the first parameter received.
12
| $(videos).each(function(index) { |
(more…)
In my previous post I covered the basics of showing a users uploaded videos. In this tutorial we will go over how to implement paging. To really show off paging, I have changed the request to top rated videos.
First we need to break our video options into a variable so we can re-use them when calling the other pages. This allows us to easily change the page number and leave all the other options intact.
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| var options = {
feed: 'top_rated',
success: function(videos, numberPages) {
$(videos).each(function() {
videoHTML = '<li>';
videoHTML += '<a href="'+this.link+'" target="_blank">';
videoHTML += this.title;
videoHTML += '</a> - '+this.length;
videoHTML += '</li>';
$('#myVideos').append(videoHTML);
});
},
error: function(error) {
$('#myVideos').append('<li class="error">'+error+'</li>');
}
};
$.jTube(options); |
(more…)
This is the first post in a line of uses for jTube. In this post I will show the basics of getting a users upload list and using the info. Before we start make sure that you have included the latest jQuery and latest jTube.
For jTube to work you must tell it what feed to grab by passing the info to the correct option. The only one we need to worry about today is `user`. Using the users feed has an option that accompanies it. The option userType tells what info about the user to retrieve. By default jTube loads the users uploads. Lets take a look at that.
1
2
3
4
5
| <script>
$.jTube({
user: 'defvayne23'
});
</script> |
(more…)