AdapterJS icon indicating copy to clipboard operation
AdapterJS copied to clipboard

Make screensharing extension integration customizable

Open zdila opened this issue 8 years ago • 3 comments

In our application we use our custom Chrome extension to provide screensharing. Now we must patch adapterjs sources to not to use universal iframe with detectRTC.html. Would you accept a pull request which would make it configurable?

zdila avatar Oct 16 '16 14:10 zdila

That shouldn't be an issue. You may add links to the Chrome/FF extension in source/pluginInfo.js, and use them in source/adapter.screensharing.js. After that, you should be able to easily override the content of the dictionary by defining it before requiring AJS (eventually we might move to a config step, but not right now)

johache avatar Oct 17 '16 02:10 johache

Thanks for mentioning pluginInfo.

Still in our case we use no iframe and logic simillar to detectRTC.html is directly in our main JS.

Currently we use following regexps to patch AdapterJS code on Webpack build:

// see https://github.com/Temasys/AdapterJS/issues/230
        replace: /\{\s*var iframe\s*=\s*document\.createElement\(/,
        with: '{return;var iframe=document.createElement('

        replace: /(var )?postFrameMessage/,
        with: 'window.postFrameMessage'

        replace: /(var |,)onIFrameCallback\s*=/,
        with: ';window.onIFrameCallback='

        replace: /\bmessage\b/g,
        with: 'xxxx_message'

        replace: 'https://addons.mozilla.org/en-US/firefox/addon/skylink-webrtc-tools/',
        with: 'https://addons.mozilla.org/en-GB/firefox/addon/someapp-screen-sharing/'

// see https://github.com/Temasys/AdapterJS/issues/228
        replace: '"PermissionDeniedError", "SecurityError"|\'PermissionDeniedError\',\'SecurityError\'',
        with: '"NotAllowedError"'

// see https://github.com/Temasys/AdapterJS/issues/229
        replace: 'http:\/\/',
        with: `https://`

zdila avatar Oct 17 '16 07:10 zdila

Hello, I think this issue is still present! I'm trying to use my custom extension (which is similar to the official Skylink one) but I got errors in Chrome because even if I replace extensionInfo.chrome.iframeLink param with the address of my detectRTC.html version, the iframe is appended before the redefinition of the variable and so https://cdn.temasys.com.sg/skylink/extensions/detectRTC.html is still loaded as iframeLink, but that page contains the extensionId of the skylink extension, and nothing works.

i guess it would be useful to have a sort of init method where to possibly specify custom configurations, or a method to update such configurations.

Notice that I am using adapter.screenshare.min.js from NPM imported as ES6 module in my app code.

simonemazzoni avatar Jun 15 '18 08:06 simonemazzoni