Bug 1023179 - Fix video unloading/loading, refactor initialization #20501
Bug 1023179 - Fix video unloading/loading, refactor initialization #20501
Conversation
Continuous Integration started. Results |
Continuous Integration started. Results |
if (typeof callback === 'function') { | ||
videoElement.addEventListener('loadeddata', onVideoLoadOrError, false); | ||
videoElement.addEventListener('error', onVideoLoadOrError, false); | ||
function loadMedia(mediaElement, src) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is a private
function, please name it as _loadMedia
(it's just a convention)
Continuous Integration started. Results |
I did a ton more testing today. It seems calling mediaElement.load() after removing the src attribute is necessary to full unload the current video, and only after the emptied event is it reliably safe to assign a new src. I think I've addressed the other comments either above or in the new PR. |
} else { | ||
evt.target.onload = evt.target.onerror = null; | ||
} | ||
if (evt.type == 'error') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use better ===
Continuous Integration started. Results |
onUnloaded(); | ||
} | ||
} else { | ||
mediaElement.onload = onMediaLoadOrError; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mediaElement.onload = mediaElement.onerror = onMediaLoadOrError;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a question about this, why are we using event listeners for the video, but inline events for images? any specific reason?
Continuous Integration started. Results |
I updated the PR to use event listeners for the image case as well - it was inconsistent. If the try run comes up green I'll carry the r+ and land. |
Continuous Integration started. Results |
… r=fcampo * Fix sporadic unencoding error by unloading video before loading new src. * Refactor Tutorial init to eliminate race-conditions and better manage mixed sequence of asnyc and sync steps * Use mock XHR for all tutorial tests * Catch emptied/abort event when unloading video before assigning new src * Use canplay event to signal video media loadedSignal media loaded
Continuous Integration started. Results |
Bug 1023179 - Fix FTU video unloading/loading, refactor tutorial initialization. r=fcampo
Refactor of initialization sequence, logging to track down media loading issue