"TypeError: URL is not a constructor" when try to refresh page and this fixed it
fkadeal opened this issue Β· comments
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.
Thanks for the fix, will use this too, but looks like the PR for the code change hasn't been merged in 12 months
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!