1
0
mirror of https://github.com/videojs/video.js.git synced 2025-03-17 21:18:27 +02:00

Dispatch Flash events asynchronously (#3700)

Flash blocks until the javascript side of ExternalInterface callbacks complete and swallows any exceptions generated during that process. To avoid performance issues and missed exceptions, trigger events from Flash asynchronously.
This commit is contained in:
David LaPalomento 2016-10-25 22:37:58 -04:00 committed by GitHub
parent 254683b5cd
commit f599ef4c51

View File

@ -485,8 +485,16 @@ Flash.checkReady = function(tech) {
// Trigger events from the swf on the player
Flash.onEvent = function(swfID, eventName) {
const tech = Dom.getEl(swfID).tech;
const args = Array.prototype.slice.call(arguments, 2);
tech.trigger(eventName, Array.prototype.slice.call(arguments, 2));
// dispatch Flash events asynchronously for two reasons:
// - Flash swallows any exceptions generated by javascript it
// invokes
// - Flash is suspended until the javascript returns which may cause
// playback performance issues
tech.setTimeout(function() {
tech.trigger(eventName, args);
}, 1);
};
// Log errors from the swf