mirror of
https://github.com/videojs/video.js.git
synced 2025-01-13 10:32:26 +02:00
@saxena-gaurav fixed a bug from disposing after changing techs. closes #2125
This commit is contained in:
parent
c5f5ea419e
commit
36956e20df
@ -2,7 +2,7 @@ CHANGELOG
|
|||||||
=========
|
=========
|
||||||
|
|
||||||
## HEAD (Unreleased)
|
## HEAD (Unreleased)
|
||||||
_(none)_
|
* @saxena-gaurav fixed a bug from disposing after changing techs ([view](https://github.com/videojs/video.js/pull/2125))
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
@ -19,12 +19,6 @@ vjs.Flash = vjs.MediaTechController.extend({
|
|||||||
|
|
||||||
var source = options['source'],
|
var source = options['source'],
|
||||||
|
|
||||||
// Which element to embed in
|
|
||||||
parentEl = options['parentEl'],
|
|
||||||
|
|
||||||
// Create a temporary element to be replaced by swf object
|
|
||||||
placeHolder = this.el_ = vjs.createEl('div', { id: player.id() + '_temp_flash' }),
|
|
||||||
|
|
||||||
// Generate ID for swf object
|
// Generate ID for swf object
|
||||||
objId = player.id()+'_flash_api',
|
objId = player.id()+'_flash_api',
|
||||||
|
|
||||||
@ -71,7 +65,7 @@ vjs.Flash = vjs.MediaTechController.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add placeholder to player div
|
// Add placeholder to player div
|
||||||
vjs.insertFirst(placeHolder, parentEl);
|
vjs.insertFirst(this.el_, options['parentEl']);
|
||||||
|
|
||||||
// Having issues with Flash reloading on certain page actions (hide/resize/fullscreen) in certain browsers
|
// Having issues with Flash reloading on certain page actions (hide/resize/fullscreen) in certain browsers
|
||||||
// This allows resetting the playhead when we catch the reload
|
// This allows resetting the playhead when we catch the reload
|
||||||
@ -98,7 +92,7 @@ vjs.Flash = vjs.MediaTechController.extend({
|
|||||||
// use stageclick events triggered from inside the SWF instead
|
// use stageclick events triggered from inside the SWF instead
|
||||||
player.on('stageclick', player.reportUserActivity);
|
player.on('stageclick', player.reportUserActivity);
|
||||||
|
|
||||||
this.el_ = vjs.Flash.embed(options['swf'], placeHolder, flashVars, params, attributes);
|
this.el_ = vjs.Flash.embed(options['swf'], this.el_, flashVars, params, attributes);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -365,6 +359,7 @@ vjs.Flash.embed = function(swf, placeHolder, flashVars, params, attributes){
|
|||||||
;
|
;
|
||||||
|
|
||||||
placeHolder.parentNode.replaceChild(obj, placeHolder);
|
placeHolder.parentNode.replaceChild(obj, placeHolder);
|
||||||
|
obj[vjs.expando] = placeHolder[vjs.expando];
|
||||||
|
|
||||||
// IE6 seems to have an issue where it won't initialize the swf object after injecting it.
|
// IE6 seems to have an issue where it won't initialize the swf object after injecting it.
|
||||||
// This is a dumb fix
|
// This is a dumb fix
|
||||||
|
@ -693,3 +693,34 @@ test('should add an audio class if an audio el is used', function() {
|
|||||||
|
|
||||||
ok(player.el().className.indexOf(audioClass) !== -1, 'added '+ audioClass +' css class');
|
ok(player.el().className.indexOf(audioClass) !== -1, 'added '+ audioClass +' css class');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('dispose should not throw exceptions when changing the tech', function() {
|
||||||
|
var fixture, video, player, id;
|
||||||
|
fixture = document.getElementById('qunit-fixture');
|
||||||
|
|
||||||
|
video = document.createElement('video');
|
||||||
|
video.className = 'vjs-default-skin video-js';
|
||||||
|
fixture.appendChild(video);
|
||||||
|
|
||||||
|
player = videojs(video);
|
||||||
|
|
||||||
|
player.loadTech('Flash');
|
||||||
|
player.controls(true);
|
||||||
|
|
||||||
|
player.loadTech('Html5');
|
||||||
|
player.src({
|
||||||
|
src: 'http://media.sundaysky.com/oat/videos/SGE2015_mp4/clip.mp4',
|
||||||
|
type: 'video/mp4'
|
||||||
|
});
|
||||||
|
|
||||||
|
player.trigger('loadstart');
|
||||||
|
player.trigger('loadedmetadata');
|
||||||
|
player.trigger('timeupdate');
|
||||||
|
|
||||||
|
try {
|
||||||
|
player.dispose();
|
||||||
|
} catch (e) {
|
||||||
|
return equal(e, undefined, 'threw an exception');
|
||||||
|
}
|
||||||
|
ok(true, 'no exception was thrown');
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user