added optional callback after subtitles have been loaded
This commit is contained in:
parent
44547e8dd7
commit
68fdb8a9b6
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user