How to reload player with new videoId
9thstudio opened this issue · comments
I am loading player in angular app with couple of links to load another video on same page when clicked as below code. It works fine when on first video but when user click another link the second video never load.
loadVidPlayer(vidId){
brightcovePlayerLoader({
refNode: this.vidFrame.nativeElement,
accountId: 'xxxxx',
videoId: vidId,
playerId: 'xxxx',
embedId: 'default',
options: {
aspectRatio: '16:9'
},
onSuccess: (success) => {
success.ref.play();
brightcovePlayerLoader.reset();
},
onFailure: (error) => {
// Player creation failed!
}
});
}
Above function is called on different links with new videoId
Also I get below error on brightcovePlayerLoader.reset();
core.js:4197 ERROR TypeError: Cannot read property 'parentNode' of null
at ye (index.min.js:1)
at n.e [as trigger] (index.min.js:1)
at e (index.min.js:1)
at Object.callback (index.min.js:1)
at i (index.min.js:1)
at XMLHttpRequest.s [as __zone_symbol__ON_PROPERTYload] (index.min.js:1)
at XMLHttpRequest.wrapFn (zone.js:1270)
at ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:27425)
at ZoneDelegate.invokeTask (zone.js:420)