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 ...@@ -227,8 +227,13 @@ var
227 * Update the player duration 227 * Update the player duration
228 */ 228 */
229 updateDuration = function(playlist) { 229 updateDuration = function(playlist) {
230 // update the duration 230 var oldDuration = player.duration(),
231 player.duration(totalDuration(playlist)); 231 newDuration = totalDuration(playlist);
232
233 // if the duration has changed, invalidate the cached value
234 if (oldDuration !== newDuration) {
235 player.trigger('durationchange');
236 }
232 }; 237 };
233 238
234 /** 239 /**
......
...@@ -915,6 +915,7 @@ test('duration is Infinity for live playlists', function() { ...@@ -915,6 +915,7 @@ test('duration is Infinity for live playlists', function() {
915 standardXHRResponse(requests[0]); 915 standardXHRResponse(requests[0]);
916 916
917 strictEqual(player.duration(), Infinity, 'duration is infinity'); 917 strictEqual(player.duration(), Infinity, 'duration is infinity');
918 ok((' ' + player.el().className + ' ').indexOf(' vjs-live ') >= 0, 'added vjs-live class');
918 }); 919 });
919 920
920 test('updates the media index when a playlist reloads', function() { 921 test('updates the media index when a playlist reloads', function() {
......