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

createObjectURL() on localStream no longer works on modern browsers (deprecated) #264

Open
DanAndersen opened this issue Jan 5, 2019 · 1 comment

Comments

@DanAndersen
Copy link

I encountered an issue when dealing with the webrtcrecorder JS sample, which uses the following code in symple.player.webrtc.js to set the video src URL:

navigator.getUserMedia(this.userMediaConstraints,
                    function (localStream) { // success

                        // Play the local video stream and create the SDP offer.
                        self.video.src = URL.createObjectURL(localStream);
                        self.pc.addStream(localStream);
                        self.pc.createOffer(
                            function(desc) { // success
                                Symple.log('symple:webrtc: offer', desc);
                                self._onLocalSDP(desc); 
                            },
                            function(err) { // error
                                Symple.log('symple:webrtc: offer failed', err);
                            });

                        // Store the active local stream
                        self.activeStream = localStream;
                    },
                    function(err) { // error
                        self.setError('getUserMedia() failed: ' + err);
                    });

I now get an error on self.video.src = URL.createObjectURL(localStream);:

Uncaught TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.

Apparently this functionality (of creating a URL from a MediaStream) is now deprecated and has been removed from current versions of Chrome and Firefox as of mid/late 2018. See https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL for details. Apparently the new recommended approach is to set the srcObject property to the localStream directly:

self.video.srcObject = localStream;
@CrazyIFriT
Copy link

Uncaught (in promise) TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.

Sigue saliendo

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