Skip to content

Commit

Permalink
Merge remote-tracking branch 'michelled/FLUID-4797'
Browse files Browse the repository at this point in the history
* michelled/FLUID-4797:
  FLUID-4797: Quick fix to the console error that gets thrown when the scrubber is clicked on. We need to improve this fix by refactoring the code to ensure that the TimeRanges objects is not stored in the model.
  • Loading branch information
michelled committed Oct 24, 2012
2 parents 7c10a5d + 7e32677 commit 605628e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion js/VideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
},
currentTime: 0,
totalTime: 0,
buffered: 0,
buffered: undefined, // a TimeRanges object (http://www.whatwg.org/specs/web-apps/current-work/#time-ranges) set through browser events
displayCaptions: false,
displayTranscripts: false,
fullscreen: false,
Expand Down
8 changes: 5 additions & 3 deletions js/VideoPlayer_controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,12 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
var bufferCompleted = false;

fluid.videoPlayer.controllers.scrubber.updateBuffered = function (that) {
// "model.buffered" is a TimeRanges object (http://www.whatwg.org/specs/web-apps/current-work/#time-ranges)
var lastBufferedTime = that.model.buffered.end(that.model.buffered.length - 1);
// "model.buffered" is a TimeRanges object set by the browser timeupdate event
// (http://www.whatwg.org/specs/web-apps/current-work/#time-ranges)
var bufferedExists = that.model.buffered && (that.model.buffered.length > 0);
var lastBufferedTime = bufferedExists ? that.model.buffered.end(that.model.buffered.length - 1) : 0;
var totalTime = that.model.totalTime;

// Turn on buffer progress update if the re-buffering is triggered, for instance,
// by rewinding back
if (lastBufferedTime !== totalTime) {
Expand Down
8 changes: 4 additions & 4 deletions tests/js/IntervalEventsConductor-IntegrationTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
videoPlayerIntervalEventsConductorIntegrationTests.asyncTest("Integration test: intervalEventsConductor with html5MediaTimer (This test is expected to fail when running in non-html5 browsers)", function () {
var videoContainer = $(".flc-video");
var timeToSet = 1;
var previousInterval = null;
var expectedPreviousInterval = null;
var expectedCurrentInterval = "0";

var that = fluid.videoPlayer.intervalEventsConductor({
Expand All @@ -52,15 +52,15 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
},
intervalList: testIntervalList,
model: {
previousIntervalId: previousInterval
previousIntervalId: expectedPreviousInterval
},
listeners: {
onTimeChange: function (time) {
jqUnit.assertEquals("The event onTimeChange is fired with argument " + time, timeToSet, time);
},
onIntervalChange: function (currentInterval, previousInterval) {
jqUnit.assertEquals("The event onIntervalChange is fired with currentInterval " + expectedCurrentInterval, "0", currentInterval);
jqUnit.assertEquals("The event onIntervalChange is fired with previousInterval " + previousInterval, previousInterval, previousInterval);
jqUnit.assertEquals("The event onIntervalChange is fired with currentInterval " + expectedCurrentInterval, expectedCurrentInterval, currentInterval);
jqUnit.assertEquals("The event onIntervalChange is fired with previousInterval " + expectedPreviousInterval, expectedPreviousInterval, previousInterval);
start();
}
}
Expand Down

0 comments on commit 605628e

Please sign in to comment.