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

Stream not closed on component destroy #3

Open
saidul opened this issue Sep 9, 2019 · 0 comments
Open

Stream not closed on component destroy #3

saidul opened this issue Sep 9, 2019 · 0 comments

Comments

@saidul
Copy link

saidul commented Sep 9, 2019

Possible fix:

       beforeDestroy () {
            const camera = this.$refs.camera
            window.removeEventListener('resize', this.handleWindowResize)
            camera.removeEventListener('play', this.handleOnPlay)
            camera.removeEventListener('pause', this.handleOnPause)

            if (camera.srcObject) {
                let tracks = camera.srcObject.getTracks();
                tracks.forEach(track => {
                    track.stop();
                });
            }
        },
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

1 participant