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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TypeError: URL is not a constructor" when try to refresh page and this fixed it #841

Open
fkadeal opened this issue Jun 22, 2023 · 2 comments

Comments

@fkadeal
Copy link

fkadeal commented Jun 22, 2023

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch recordrtc@5.6.2 for the project I'm working on.

stack is {
"next": "^13.4.1",
node: "18.16"
}

Here is the diff that solved my problem:

diff --git a/node_modules/recordrtc/RecordRTC.js b/node_modules/recordrtc/RecordRTC.js
index c0c07c8..fe096ee 100644
--- a/node_modules/recordrtc/RecordRTC.js
+++ b/node_modules/recordrtc/RecordRTC.js
@@ -1730,7 +1730,12 @@ if (typeof AudioContext === 'undefined') {
 }
 
 /*jshint -W079 */
-var URL = window.URL;
+// var URL = window.URL;
+function URL(url, base) {
+  this.url = url;
+  this.base = base;
+  return window.URL;
+}
 
 if (typeof URL === 'undefined' && typeof webkitURL !== 'undefined') {
     /*global URL:true */
@@ -4992,7 +4997,12 @@ function MultiStreamsMixer(arrayOfMediaStreams, elementClass) {
     }
 
     /*jshint -W079 */
-    var URL = window.URL;
+    // var URL = window.URL;
+    function URL(url, base) {
+      this.url = url;
+      this.base = base;
+      return window.URL;
+    }
 
     if (typeof URL === 'undefined' && typeof webkitURL !== 'undefined') {
         /*global URL:true */

This issue body was partially generated by patch-package.

@KitsonBroadhurst
Copy link

Thanks for the fix, will use this too, but looks like the PR for the code change hasn't been merged in 12 months

@Jkhall81
Copy link

Jkhall81 commented Feb 4, 2024

WOOOOOOO HOOO. fkadeal, you are a saint!! I'm working on a coding challenge for an internship and hit a brick wall. have to record video from a webcam... and.... this solved my problem!

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

3 participants