cycjimmy/jsmpeg-player

Unhandled Runtime Error Cannot set properties of undefined (setting 'index')

clockard opened this issue · 0 comments

Describe the bug
A clear and concise description of what the bug is.
When the end of an mpg file is reached the Unhandled Runtime Error is thrown
It is occurring at
https://github.com/cycjimmy/jsmpeg-player/blob/main/src/lib/decoder.js#L67
where it is trying to set the index on this.bits which is undefined

It looks like this can be fixed by simply doing an undefined check at that point before setting the index

To Reproduce
Steps to reproduce the behavior:
Using version 5.1.1
Play mpeg video using options

{
  autoplay: true,
  audio: false,
}

Expected behavior
A clear and concise description of what you expected to happen.
Video finishes playing without errors

Desktop (please complete the following information):

  • OS: [e.g. iOS] - MacOS Catalina
  • Browser [e.g. chrome, safari] - Chrome
  • Version [e.g. 22] - 102.0.5005.61