mirror of
https://github.com/videojs/video.js.git
synced 2025-01-25 11:13:52 +02:00
Don't dynamically turn off progress events
The major browsers that support HTML video now reliably support progress events, so don't worry about synthesizing them for HTML anymore.
This commit is contained in:
parent
f4ce62d4b1
commit
f037818656
@ -24,6 +24,9 @@ vjs.Html5 = vjs.MediaTechController.extend({
|
||||
// HTML video is able to automatically resize when going to fullscreen
|
||||
this.features['fullscreenResize'] = true;
|
||||
|
||||
// HTML video supports progress events
|
||||
this.features['progressEvents'] = true;
|
||||
|
||||
vjs.MediaTechController.call(this, player, options, ready);
|
||||
this.setupTriggers();
|
||||
|
||||
|
@ -172,19 +172,6 @@ vjs.MediaTechController.prototype.manualProgressOn = function(){
|
||||
|
||||
// Trigger progress watching when a source begins loading
|
||||
this.trackProgress();
|
||||
|
||||
// Watch for a native progress event call on the tech element
|
||||
// In HTML5, some older versions don't support the progress event
|
||||
// So we're assuming they don't, and turning off manual progress if they do.
|
||||
// As opposed to doing user agent detection
|
||||
this.one('progress', function(){
|
||||
|
||||
// Update known progress support for this playback technology
|
||||
this.features['progressEvents'] = true;
|
||||
|
||||
// Turn off manual progress tracking
|
||||
this.manualProgressOff();
|
||||
});
|
||||
};
|
||||
|
||||
vjs.MediaTechController.prototype.manualProgressOff = function(){
|
||||
|
@ -4,6 +4,7 @@ module('Media Tech', {
|
||||
'setup': function() {
|
||||
clock = sinon.useFakeTimers();
|
||||
features = videojs.util.mergeOptions({}, videojs.MediaTechController.prototype.features);
|
||||
videojs.MediaTechController.prototype.features['progressEvents'] = false;
|
||||
},
|
||||
'teardown': function() {
|
||||
clock.restore();
|
||||
@ -114,29 +115,3 @@ test('should synthesize progress events by default', function() {
|
||||
clock.tick(500);
|
||||
equal(progresses, 1, 'triggered one event');
|
||||
});
|
||||
|
||||
test('stops progress events if the tech produces them natively', function() {
|
||||
var end = 0, buffered = 0, progresses = 0, tech;
|
||||
tech = new videojs.MediaTechController({
|
||||
id: noop,
|
||||
on: noop,
|
||||
// progress will be detected any time it is queried
|
||||
bufferedPercent: function() {
|
||||
return buffered++;
|
||||
},
|
||||
trigger: function(event) {
|
||||
if (event === 'progress') {
|
||||
progresses++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// simulate a native progress event
|
||||
tech.trigger('progress');
|
||||
tech.on('progress', function() {
|
||||
progresses++;
|
||||
});
|
||||
|
||||
clock.tick(10 * 1000);
|
||||
equal(progresses, 0, 'did not simulate progress');
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user