Failed to execute createobjecturl on url: overload resolution failed.

Failed to execute createobjecturl on url: overload resolution failed.

普通网友

Failed to execute createobjecturl on url: overload resolution failed.
于 2022-03-08 09:43:03 发布
Failed to execute createobjecturl on url: overload resolution failed.
14438
Failed to execute createobjecturl on url: overload resolution failed.
收藏 5

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

vue使用二进制流下载文件,使用

 link.href = window.URL.createObjectURL(blob);

报错:
Failed to execute ‘createObjectURL’ on ‘URL’: Overload resolution failed.
百度了下,是因为Chrome更新后不支持这种用法,需要改为:

  let binaryData = [];
                    binaryData.push(blob);
                    link.href = window.URL.createObjectURL(new Blob(binaryData));

Federico Freiberger

unread,

Dec 10, 2018, 6:10:43 AM12/10/18

to EasyRTC

Hey, my app is failing due to this error that started to appear today. I'm using the last Chrome version. Its related to the deprecation of the method that Chrome is warning like a couple of months ago??

Failed to execute createobjecturl on url: overload resolution failed.

Thanks! Any help is appreciated since I'm deploying this web application this week!

Andriy Buchynskyy

unread,

Dec 10, 2018, 7:10:40 AM12/10/18

to EasyRTC

Hello, if I would you I would try to avoid createObjectURL.

And try something like that:

var  track  =  event.streams[0]

video

.srcObject  =  track;


Federico Freiberger

unread,

Dec 10, 2018, 8:48:13 AM12/10/18

to EasyRTC

Yeah, probably something like that would work, but this is the easyrtc.js client that I would need to update. Is there a solution for that already? Or should I go and modify it by myself and wait for a later solution?

Federico Freiberger

unread,

Dec 10, 2018, 9:07:46 AM12/10/18

to EasyRTC

Changed:

this.createObjectURL = function (mediaStream) {

var errMessage;

if (window.URL && window.URL.createObjectURL) {

return window.URL.createObjectURL(mediaStream);

}

else if (window.webkitURL && window.webkitURL.createObjectURL) {

return window.webkit.createObjectURL(mediaStream);

}

else {

errMessage = "Your browsers does not support URL.createObjectURL.";

logDebug("saw exception " + errMessage);

throw errMessage;

}

};

To 

this.createObjectURL = function (mediaStream) {

return mediaStream;

/*var errMessage;

if (window.URL && window.URL.createObjectURL) {

return window.URL.createObjectURL(mediaStream);

}

else if (window.webkitURL && window.webkitURL.createObjectURL) {

return window.webkit.createObjectURL(mediaStream);

}

else {

errMessage = "Your browsers does not support URL.createObjectURL.";

logDebug("saw exception " + errMessage);

throw errMessage;

}*/

};

And It works, throws

Uncaught (in promise) DOMException

But loads the media correctly, I think I can work with that until a fix wherever it comes.

Federico Freiberger

unread,

Dec 11, 2018, 11:16:20 AM12/11/18

to EasyRTC

Thanks to Devashish Chauhan who answered me on the mail, I'm posting this just for reference.

From his answer:

The correct way is to -

Change   

element.src = self.createObjectURL(stream);

element.srcObject = stream;

You will have to do this in the easyrtc.js file. wherever you see -  element.src = self.createObjectURL(stream); just replace it with element.srcObject = stream;

Dimitris Tzimikas

unread,

Jan 7, 2019, 4:57:42 AM1/7/19

to EasyRTC

But if for example device A has android system webview i.e. 59.0... and the device B has 71.0... there is still a problem, at least with my case. The video from device A does not stream to device B. 

What is URL createObjectURL?

createObjectURL() The URL. createObjectURL() static method creates a string containing a URL representing the object given in the parameter. The URL lifetime is tied to the document in the window on which it was created. The new object URL represents the specified File object or Blob object.

Is createObjectURL deprecated?

The URL. createObjectURL() method has been removed from the MediaStream interface. This method has been deprecated in 2013 and superseded by assigning streams to HTMLMediaElement.

What is revokeObjectURL?

revokeObjectURL() The URL. revokeObjectURL() static method releases an existing object URL which was previously created by calling URL. createObjectURL() . Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.