Skip to content

Commit

Permalink
fix(vttjs): wait till tech el in DOM before loading vttjs (#4177)
Browse files Browse the repository at this point in the history
The issue is that in Flash, Flash.embed wraps the object element in a div but that object element is what is referenced by this.el(), so, parentNode isn't null but we aren't actually in the DOM. Instead, just check to see whether the tech element is in the DOM or not via node.contains().
  • Loading branch information
gkatsev committed Mar 8, 2017
1 parent cb890a9 commit ddde644
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/tech/tech.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ class Tech extends Component {
// Initially, Tech.el_ is a child of a dummy-div wait until the Component system
// signals that the Tech is ready at which point Tech.el_ is part of the DOM
// before inserting the WebVTT script
if (this.el().parentNode !== null && this.el().parentNode !== undefined) {
if (document.body.contains(this.el())) {
const vtt = require('videojs-vtt.js');

// load via require if available and vtt.js script location was not passed in
Expand Down

0 comments on commit ddde644

Please sign in to comment.