adapter: Cannot send stream object URL to another page via PostMessage

Browsers and versions affected Firefox 54.0.1 Win10-x64 (maybe affect all browsers)

Description The shim of URL.createObjectURL in webRTC adapter will return a string instead of a real object URL, which doesn’t work in other pages

Steps to reproduce

\\ In the first page
window.stream = ....;
\\
\\ After something is done...
\\
window.large_window = window.open("/large.html", window.location.origin);
window.postMessage(URL.createObjectURL(window.stream), window.location.origin);

\\ In the 'large' page
window.addEventListener("message", streamHandler, false);

function streamHandler(event) {
    if (event.origin !== window.location.origin) {
        return false;
    }
    docReady(() => {
        let remote = document.getElementById('remote');
        remote.src = event.data;
    });
    window.removeEventListener("message", streamHandler);
}

Expected results The video stream will be available and played in the ‘remote’ video element in page ‘large’

Actual results The ‘remote’ video element is blank, and the src attribute is set to ‘polyblob:1’, which is a string

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

I’ve tried passing streams directly between same-origin windows and I confirm it worked just fine. It is certainly more elegant than using URL.createObjectURL. Let’s close this for now.