phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.3k stars 1.43k forks source link

How to close JSMpeg palyer? #409

Closed hasanisaeed closed 1 year ago

hasanisaeed commented 1 year ago

It's seem player.destroy() is not a function.

my player:

this.player = new JSMpeg.Player(this.cameraSource, {
    preserveDrawingBuffer: true,
    canvas: canvas,
    autoplay: true,
    loop: true
   }
phoboslab commented 1 year ago

player.destroy() is a function, if you player instance is called player.

In your code you assigned the player instance to this.player, so you probably have to call this.player.destroy(). Depending on what exactly this is in your code, it may or may not be available when you want to destroy the player. Can't tell without more context.

Since this looks like a generic JS question, rather than a bug report, you're probably better of asking for help on https://stackoverflow.com/