Search code examples
javascriptangularjsvideo-streamingvideo.js

VideoJS error Uncaught TypeError: Cannot read property 'nodeName' of null


I am playing Video's streaming by VideoJS in a popup or in some window. Videos are playing perfectly good. But while playing if i close the modal or window i got this error on console.

video-js.js:2568 Uncaught TypeError: Cannot read property 'nodeName' of null
    at validateTarget (video-js.js:2568)
    at normalizeListenArgs (video-js.js:2647)
    at Html5.one (video-js.js:2787)
    at Player.userActive (video-js.js:27096)
    at Player.<anonymous> (video-js.js:27206)
    at video-js.js:4640

Anyone who got the solution to remove this of this please help.

enter image description here


Solution

  • This error is related to dispose() function in videojs, because you are not specifying element/playerid when disposing videojs player:

    for ex : videoJSPlayer = element
    
     if (videojs.getPlayer("videoJSPlayer")) {
         videojs("videoJSPlayer").dispose();
       }