560fb647 by Tom Johnson

Merge pull request #84 from videojs/hotfix/live-duration

Trigger duration updates indirectly so that live is correctly detected b...
2 parents c93a4788 f213f641
......@@ -227,8 +227,13 @@ var
* Update the player duration
*/
updateDuration = function(playlist) {
// update the duration
player.duration(totalDuration(playlist));
var oldDuration = player.duration(),
newDuration = totalDuration(playlist);
// if the duration has changed, invalidate the cached value
if (oldDuration !== newDuration) {
player.trigger('durationchange');
}
};
/**
......
......@@ -915,6 +915,7 @@ test('duration is Infinity for live playlists', function() {
standardXHRResponse(requests[0]);
strictEqual(player.duration(), Infinity, 'duration is infinity');
ok((' ' + player.el().className + ' ').indexOf(' vjs-live ') >= 0, 'added vjs-live class');
});
test('updates the media index when a playlist reloads', function() {
......