(NS_ERROR_FAILURE) Mozilla Browser

I added an event handler to handle the mousedown event in firefox, but when this event occurs, I get an NS_error failure message, the error message is displayed in firefox, but chrome handles the event properly.

Here is the code section

 document.getElementById("fancybox-close") .addEventListener("mousedown", function () { c.video.currentTime = "00:00"; document.getElementById("playr_video_curpos_" + c.video_id).innerHTML = c.parseTimeCode(c.video.currentTime); }, false); 

I connected the event listener to the close button on the video player, so when you press the close button, the video should be reset to 00:00 (Note: c = this ).

As mentioned earlier, this works on chrome, but on firefox I get this error message

 NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMHTMLVideoElement.currentTime] 

Any idea why I am getting this message?

+4
source share
1 answer

The currentTime attribute takes a number, not a string. In this case, Chrome should do type enforcement, but Firefox should not. For instance:

 c.video.currentTime = 0.0; // Seek to zero seconds 

References

+1
source

All Articles