Chrome WebRTC Sharing Extension Needs Update

Chrome introduced the use of extensions for WebRTC Screen Sharing. In this case, each domain must have an extension for people to install the screen sharing extension using webrtc.

Here is my use case:

  • During an ongoing webrtc video call, if one person needs screen sharing and does not have an extension, then after installing the extension, a page refresh is required. This interrupts the call and both people must rejoin the call.

  • I want to control the UI with javascript so that no update is required. But if we don't update, the html page doesn't recognize the newly installed extension.

I've seen a lot of open source code regarding this, but none of them have a use case like mine. They assume that the extension will be installed during the session.

However, I've seen www.uberconference.com and they have a similar use case. I tried to install the screen sharing extension during a live call and it did not require a page refresh or interrupt the call. He made screen sharing right after installing the extension.

I couldn't figure out how they did it as uber is not open source. Many people say that the update is necessary after installing the extension. Any help in this case would be much appreciated.

This is how I install the chrome extension using the built-in install:

$scope.installExtension= function(){

  !!navigator.webkitGetUserMedia
  && !!window.chrome
  && !!chrome.webstore
  && !!chrome.webstore.install &&
  chrome.webstore.install('https://chrome.google.com/webstore/detail/<some-id>',
    successInstallCallback,
    failureInstallCallback
  );

};

function successInstallCallback() {
  //location.reload();
}
function failureInstallCallback(error) {
  alert(error);
}

      

+3


source to share


2 answers


This is what we recently changed into getScreenMedia

. Review the request to see how we did it:

I wrote about the changes on my blog , so look there for more details, but the important bits are:

Instead of creating a communication channel on chrome.runtime.connect

and direct messaging, we can use external messages. Instead of sending a message to the window, which receives the contents of the script and gets passed to the background script (and vice versa), we can use chrome.runtime.sendMessage(extensionId, options, callback)

the script in the background as well.This chrome.runtime.onMessageExternal

works where there is no other solution, because the original scripts are loaded immediately after installing the extension, then how content scripts are inserted on page load.

So basically the extension uses a different resolution:

"externally_connectable": {
  "matches": [
      "https://example.com/*"
  ]
}

      



And another API:

  • chrome.runtime.sendMessage

    in conjunction with chrome.runtime.onMessageExternal

instead

  • window.postMessage

    in combination with window.addEventListener('message')

    and chrome.runtime.connect

    .

At least two different sites https://apps.mypurecloud.com and https://beta.talky.io perform screen sharing with built-in extension installation without rebooting.

+5


source


Have a look at Chrome Extension inline installation ... https://developer.chrome.com/webstore/inline_installation

I had the same problems until I pasted in the html <head> tag ...



<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/[your-chrome-extension-id]" >

      

The extension manifest must also include the domain that this master tag is included in.

-1


source







All Articles