Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed canvas deletion function due to destroy() #422

Open
hate7354 opened this issue Jan 22, 2024 · 1 comment
Open

Removed canvas deletion function due to destroy() #422

hate7354 opened this issue Jan 22, 2024 · 1 comment

Comments

@hate7354
Copy link

When executing player.destroy(), the canvas is destroyed. What should I do because I want to use all functions of destroy() without destroying the canvas?

@phoboslab
Copy link
Owner

The canvas element is only removed if it was created by JSMpeg in the first place. If you want to keep the canvas, create it outside of JSMpeg and pass it in as an option. E.g.

<canvas id="video-canvas"></canvas>
var element = document.getElementById('video-canvas');
var player = new JSMpeg.Player('file.ts', {canvas: element});

// this will not remove the canvas, since it was not created by jsmpeg
player.destroy();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants