I'm trying to retrieve and print the duration of each video that is being returned via the Youtube API using JSON. The duration needs to be out putted like this:
9:34min and not in seconds
But I can't figure out what to do next. I am currently using the following code:
function showMyVideos2(data) {
var feed = data.feed;
var entries = feed.entry || [];
var html = ['<ul class="videos">'];
for (var i = 0; i < entries.length; i++) {
var entry = entries[i];
var title = entry.title.$t.substr(0, 20);
var thumbnailUrl = entries[i].media$group.media$thumbnail[0].url;
var playerUrl = entries[i].media$group.media$content[0].url;
html.push('<li>',
'<a href="', playerUrl, '" rel="vidbox 686 315"><img src="',
thumbnailUrl, '" width="130" height="97"/></a>', '<span class="titlec"><a href="', playerUrl, '" rel="vidbox 686 315">', title, '... </a></span></li>');
}
html.push('</ul><br style="clear: left;"/>');
document.getElementById('videos2').innerHTML = html.join('');
if (entries.length > 0) {
loadVideo(entries[0].media$group.media$content[0].url, false);
}
}