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

Cannot read property 'startsWith' of undefined (removeRecording()) #575

Closed
karlerss opened this issue Apr 30, 2021 · 4 comments · Fixed by #576
Closed

Cannot read property 'startsWith' of undefined (removeRecording()) #575

karlerss opened this issue Apr 30, 2021 · 4 comments · Fixed by #576
Labels

Comments

@karlerss
Copy link

karlerss commented Apr 30, 2021

Description

Caught this in production.

Steps to reproduce

  1. start recording

Results

Expected

Starts recording

Actual

Screen black.

Error output

TypeError: Cannot read property 'startsWith' of undefined
  at Record.removeRecording(webpack://VideojsRecord/./src/js/videojs.record.js?:1072:54)
  at Record.startVideoPreview(webpack://VideojsRecord/./src/js/videojs.record.js?:1184:12)
  at Record.start(webpack://VideojsRecord/./src/js/videojs.record.js?:673:18)
  at click(/js/video/public.js:2:1624734)
  at He(/js/video/public.js:2:1643915)
  at HTMLButtonElement.n(/js/video/public.js:2:1645660)
  at HTMLButtonElement.Qr.o._wrapper(/js/video/public.js:2:1680935)
  at HTMLButtonElement.r(/js/video/public.js:2:1517762)

Additional Information

versions

videojs

4.1.1

browsers

Chrome 90.0.4430

OSes

Windows 10

@karlerss karlerss changed the title Cannot read property 'startsWith' of undefined (removeRecording(), ) Cannot read property 'startsWith' of undefined (removeRecording()) Apr 30, 2021
@thijstriemstra
Copy link
Member

can you show some code that reproduces this issue?

@karlerss
Copy link
Author

karlerss commented Apr 30, 2021

options: {
                    controls: false,
                    autoplay: false,
                    fluid: true,
                    loop: false,
                    bigPlayButton: false,
                    plugins: {
                        record: {
                            audio: true,
                            debug: true,
                            maxLength: 10 * 60,
                            video: {
                                // video media constraints: set resolution of camera
                                width: 640,
                                height: 480
                            },
                        }
                    }
                }
                this.player = videojs(`recorder-${this._uid}`, this.options, () => {
                    if (this.player) {
                        this.player.record().getDevice();
                    }
                });

Error happens when calling:

this.player.record().start();

For context - the implementation works in production, and has worked fine for thousands of users. I caught this with Sentry (twice) and was messaged by a user.

My suggestion, add check if this.mediaElement.src is defined. If not, maybe set to this.mediaElement.src = ''.

@thijstriemstra
Copy link
Member

My suggestion, add check if this.mediaElement.src is defined.

Agreed. Opened #576

@karlerss
Copy link
Author

Thank you very much! This software has been really useful.

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

Successfully merging a pull request may close this issue.

2 participants