brightcove / player-loader

An asynchronous script loader and embed generator for the Brightcove Player.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

refNodeInsert: "replace" not work

samson-sham opened this issue · comments

On index.html

brightcovePlayerLoader({
      accountId: '1',
      refNode: document.getElementById('root'),
      refNodeInsert: 'replace'
    });

using property refNodeInsert with replace

The corresponding DOM root is replaced
<video-js controls="controls" class="video-js"></video-js>
However, an empty DOM is created instead, script is also not loaded either.

Thanks for the report, I can confirm this is not working as expected.

@misteroneill
Just a suggestion, the replace may replace the children of that selective DOM instead of replacing itself.
Since .reset() wouldn't be easy to recover the DOM if that selective DOM is replaced.

@samson-sham That's an interesting idea we didn't consider. If you want to open a separate issue, we can label it as an enhancement. But that may not be worth doing as I'm not sure we want to keep a reference to that DOM node around. Plus, reset() will discard all players it finds - whether they're loaded with player-loader or not - so it could be risky depending on how one is using their Player(s). 😄

This specific issue is fixed in v1.3.0 - please let us know if it doesn't work for you!