added optional callback after subtitles have been loaded

This commit is contained in:
sanj 2010-07-18 02:02:20 +05:30
parent 44547e8dd7
commit 68fdb8a9b6

View File

@ -65,7 +65,7 @@
}
}
}
opts.subtitlesLoaded(subtitles);
var currentSubtitle = -1;
var ival = setInterval(function() {
@ -80,7 +80,7 @@
}
if(subtitle > 0) {
if(subtitle != currentSubtitle) {
opts.showSubtitle(subtitles[subtitle].t, subtitleElement);
opts.showSubtitle(subtitles[subtitle], subtitleElement);
// subtitleElement.html(subtitles[subtitle].t);
currentSubtitle=subtitle;
} else if(subtitles[subtitle].o < currentTime) {
@ -91,10 +91,12 @@
}, opts.interval);
}
function showSubtitle(txt, elem) {
elem.html(txt);
//default function to show subtitle
function showSubtitle(sub, elem) {
elem.html(sub.t);
}
//default function to hide subtitle
function hideSubtitle(elem) {
elem.html('');
}
@ -106,7 +108,8 @@
'id': that.attr('data-video'),
'url': that.attr('data-srt'),
'showSubtitle': showSubtitle,
'hideSubtitle': hideSubtitle
'hideSubtitle': hideSubtitle,
'subtitlesLoaded': $.noop
}, o);
this.each(function() {
var subtitleElement = $(this);