Skip to content

Commit

Permalink
WebRTC-Scalable-Broadcast and Firefox-Extensions added.
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Nov 12, 2014
1 parent 431f0e7 commit a382abf
Show file tree
Hide file tree
Showing 21 changed files with 6,681 additions and 42 deletions.
18 changes: 18 additions & 0 deletions Firefox-Extensions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# [Firefox Extensions](https://github.com/muaz-khan/Firefox-Extensions)

Enable screen capturing in Firefox (for https://www.webrtc-experiment.com demos only):

* [enable-screen-capturing.xpi](https://www.webrtc-experiment.com/store/firefox-extension/enable-screen-capturing.xpi)

## Credits

[Muaz Khan](https://github.com/muaz-khan):

1. Personal Webpage: http://www.muazkhan.com
2. Email: [email protected]
3. Twitter: https://twitter.com/muazkh and https://twitter.com/WebRTCWeb
4. Google+: https://plus.google.com/+WebRTC-Experiment

## License

[Firefox-Extensions](https://github.com/muaz-khan/Firefox-Extensions) are released under [MIT licence](https://www.webrtc-experiment.com/licence/) . Copyright (c) [Muaz Khan](https://plus.google.com/+MuazKhan).
33 changes: 33 additions & 0 deletions Firefox-Extensions/enable-screen-capturing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Enable Screen Capturing using [Firefox Extensions API](https://github.com/muaz-khan/Firefox-Extensions)

Enable screen capturing using Firefox (for https://www.webrtc-experiment.com demos only):

* [enable-screen-capturing.xpi](https://www.webrtc-experiment.com/store/firefox-extension/enable-screen-capturing.xpi)

To use in your own domains:

Modify `bootstrap.js` file, line 18:

```javascript
['yourDomain.com', 'www.yourDomain.com'].forEach(function(domain) {
if (values.indexOf(domain) === -1) {
values.push(domain);
addon_domains.push(domain);
}
});
```

And modify `install.rdf` for you extension information (name, URL, icon etc.)

## Credits

[Muaz Khan](https://github.com/muaz-khan):

1. Personal Webpage: http://www.muazkhan.com
2. Email: [email protected]
3. Twitter: https://twitter.com/muazkh and https://twitter.com/WebRTCWeb
4. Google+: https://plus.google.com/+WebRTC-Experiment

## License

[Firefox-Extensions](https://github.com/muaz-khan/Firefox-Extensions) are released under [MIT licence](https://www.webrtc-experiment.com/licence/) . Copyright (c) [Muaz Khan](https://plus.google.com/+MuazKhan).
46 changes: 46 additions & 0 deletions Firefox-Extensions/enable-screen-capturing/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
* taken from: HenrikJoreteg/getScreenMedia/firefox-extension-sample
* original source: https://hg.mozilla.org/users/blassey_mozilla.com/screenshare-whitelist/
*/
var addon_domains = []; // list of domains the addon added
var allowed_domains_pref = 'media.getusermedia.screensharing.allowed_domains';
var enable_screensharing_pref = 'media.getusermedia.screensharing.enabled';

function startup(data, reason) {
if (reason === APP_STARTUP) {
return;
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
var values = prefs.getCharPref(allowed_domains_pref).split(',');

['webrtc-experiment.com', 'www.webrtc-experiment.com'].forEach(function(domain) {
if (values.indexOf(domain) === -1) {
values.push(domain);
addon_domains.push(domain);
}
});

if(prefs.getBoolPref(enable_screensharing_pref) == false) {
prefs.setBoolPref(enable_screensharing_pref, 1);
}
prefs.setCharPref(allowed_domains_pref, values.join(','));
}

function shutdown(data, reason) {
if (reason === APP_SHUTDOWN) {
return;
}
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var values = prefs.getCharPref(allowed_domains_pref).split(',');
values = values.filter(function(value) {
return addon_domains.indexOf(value) === -1;
});
prefs.setCharPref(allowed_domains_pref, values.join(','));
}

function install(data, reason) {}

function uninstall(data, reason) {}
Binary file not shown.
Binary file added Firefox-Extensions/enable-screen-capturing/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Firefox-Extensions/enable-screen-capturing/install.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:type>2</em:type>
<em:name>Screen Capturing in Firefox</em:name>
<em:description>Firefox extension to enable screen capturing</em:description>
<em:version>1.0</em:version>
<em:bootstrap>true</em:bootstrap>
<em:creator>Muaz Khan</em:creator>
<em:homepageURL>https://www.webrtc-experiment.com/</em:homepageURL>
<em:iconURL>icon.png</em:iconURL>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>33.0</em:minVersion>
<em:maxVersion>36.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
2 changes: 1 addition & 1 deletion Pluginfree-Screen-Sharing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Use your browser to share content of screen in High-Quality (HD) format with one or more users!

**Firefox Nightly?** Make sure that you are using Firefox Nightly and you enabled: `media.getusermedia.screensharing.enabled` flag from `about:config` page. You also need to add your domain in `media.getusermedia.screensharing.allowed_domains` flag.
**Firefox?** [Install Firefox Extension](https://www.webrtc-experiment.com/store/firefox-extension/enable-screen-capturing.xpi) / [Source Code](https://github.com/muaz-khan/Firefox-Extensions/tree/master/enable-screen-capturing)

This WebRTC experiment uses a chrome extension:

Expand Down
14 changes: 4 additions & 10 deletions Pluginfree-Screen-Sharing/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -511,22 +511,16 @@ <h2 id="prerequisites">
</h2>
<ol>
<li>
Is that Firefox Nightly? Make sure that you are using Firefox Nightly and you enabled: media.getusermedia.screensharing.enabled flag from about:config page. You also need to add your domain in "media.getusermedia.screensharing.allowed_domains" flag.
</li>

<li>
Is that chrome?
Chrome?
<a href="https://chrome.google.com/webstore/detail/screen-capturing/ajhifddimkapgcifgcodmmfdlknahffk" target="_blank">Install chrome extension</a>.
<button onclick="!!navigator.webkitGetUserMedia && !!window.chrome && !!chrome.webstore && !!chrome.webstore.install && chrome.webstore.install('https://chrome.google.com/webstore/detail/ajhifddimkapgcifgcodmmfdlknahffk', function() {location.reload();})" id="install-button" style="padding: 0;background: none;height: 61px;vertical-align: middle;cursor:pointer;">
<img src="https://www.webrtc-experiment.com/images/btn-install-chrome-extension.png" alt="Add to Chrome">
</button>
/ <a href="https://github.com/muaz-khan/Chrome-Extensions/tree/master/desktopCapture">Source Code</a>
</li>

<li>
Otherwise make sure you are running the chrome with command line flag "<strong><a href="http://peter.sh/experiments/chromium-command-line-switches/#enable-usermedia-screen-capturing">--enable-usermedia-screen-capturing</a></strong>" e.g. on Windows "<strong>Chrome.exe --enable-usermedia-screen-capturing</strong>"
<div style="text-align:center;">
<img src="https://www.webrtc-experiment.com/images/--enable-usermedia-screen-capturing.png" style="max-width: 100%;">
</div>
Learn more about <a href="http://www.chromium.org/developers/how-tos/run-chromium-with-flags" target="_blank">how to enable command-line flags</a> on different operating systems.
Firefox? <a href="https://www.webrtc-experiment.com/store/firefox-extension/enable-screen-capturing.xpi">Install Firefox Extension</a> / <a href="https://github.com/muaz-khan/Firefox-Extensions/tree/master/enable-screen-capturing">Source Code</a>
</li>
</ol>
</section>
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,19 @@ You don't need to modify any single line to use it. No single installation or mo

## Other Repositories

1. [PluginRTC: IE/Safari Plugins compatible WebRTC-Experiments](https://github.com/muaz-khan/PluginRTC)
2. [RecordRTC.js](https://github.com/muaz-khan/RecordRTC)
3. [RTCMultiConnection.js](https://github.com/muaz-khan/RTCMultiConnection)
4. [Conversation.js](https://github.com/muaz-khan/Conversation.js)
5. [Collaborate Canvas Designer](https://github.com/muaz-khan/Canvas-Designer)
6. [XHR-Signaling](https://github.com/muaz-khan/XHR-Signaling)
1. [RecordRTC.js](https://github.com/muaz-khan/RecordRTC)
2. [RTCMultiConnection.js](https://github.com/muaz-khan/RTCMultiConnection)
3. [Conversation.js](https://github.com/muaz-khan/Conversation.js)
4. [Collaborate Canvas Designer](https://github.com/muaz-khan/Canvas-Designer)
5. [XHR-Signaling](https://github.com/muaz-khan/XHR-Signaling)
6. [PluginRTC: IE/Safari Plugins compatible WebRTC-Experiments](https://github.com/muaz-khan/PluginRTC)
7. [ASP.NET MVC based WebRTC 1:1 Demo](https://github.com/muaz-khan/WebRTC-ASPNET-MVC)
8. [WebSync Signaling](https://github.com/muaz-khan/WebSync-Signaling)
9. [SdpSerializer.js](https://github.com/muaz-khan/SdpSerializer)
10. [FileBufferReader.js](https://github.com/muaz-khan/FileBufferReader)
11. [Chrome-Extensions](https://github.com/muaz-khan/Chrome-Extensions)
12. [Firefox-Extensions](https://github.com/muaz-khan/Firefox-Extensions)
13. [WebRTC Scalable Broadcast](https://github.com/muaz-khan/WebRTC-Scalable-Broadcast)

## Important [Experiments](https://github.com/muaz-khan/WebRTC-Experiment)

Expand All @@ -69,6 +72,10 @@ You don't need to modify any single line to use it. No single installation or mo
2. [tabCapture API](https://github.com/muaz-khan/WebRTC-Experiment/tree/master/Chrome-Extensions/tabCapture) / [Install App Store Extension](https://chrome.google.com/webstore/detail/tab-capturing-sharing/pcnepejfgcmidedoimegcafiabjnodhk)
3. [Desktop Sharing](https://github.com/muaz-khan/WebRTC-Experiment/tree/master/desktop-sharing) / [Install App Store Extension](https://chrome.google.com/webstore/detail/webrtc-desktop-sharing/nkemblooioekjnpfekmjhpgkackcajhg)

## [Firefox Extensions](https://github.com/muaz-khan/WebRTC-Experiment/tree/master/Firefox-Extensions) for [WebRTC](https://www.webrtc-experiment.com/)!

1. [enable-screen-capturing](https://github.com/muaz-khan/Firefox-Extensions/tree/master/enable-screen-capturing)

## One-to-Many style of WebRTC [Experiments](https://github.com/muaz-khan/WebRTC-Experiment)

| Experiment Name | Previous Demos | New Demos |
Expand Down
10 changes: 7 additions & 3 deletions RTCMultiConnection/demos/screen-sharing.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,18 @@ <h1>
<h2>Pre-Requisites?</h2>
<ol>
<li>
Is that chrome? <a href="https://chrome.google.com/webstore/detail/screen-capturing/ajhifddimkapgcifgcodmmfdlknahffk" target="_blank">Install Chrome Screen Capturing Extension</a>
Chrome?
<a href="https://chrome.google.com/webstore/detail/screen-capturing/ajhifddimkapgcifgcodmmfdlknahffk" target="_blank">Install chrome extension</a>.
<button onclick="!!navigator.webkitGetUserMedia && !!window.chrome && !!chrome.webstore && !!chrome.webstore.install && chrome.webstore.install('https://chrome.google.com/webstore/detail/ajhifddimkapgcifgcodmmfdlknahffk', function() {location.reload();})" id="install-button" style="padding: 0;background: none;height: 61px;vertical-align: middle;cursor:pointer;">
<img src="https://www.webrtc-experiment.com/images/btn-install-chrome-extension.png" alt="Add to Chrome">
</button>
/ <a href="https://github.com/muaz-khan/Chrome-Extensions/tree/master/desktopCapture">Source Code</a>
</li>

<li>
Is that Firefox Nightly? Make sure that you are using Firefox Nightly and you enabled: <strong>"media.getusermedia.screensharing.enabled"</strong> flag from <strong>"about:config"</strong> page. You also need to add your domain in <strong>"media.getusermedia.screensharing.allowed_domains"</strong> flag.
Firefox? <a href="https://www.webrtc-experiment.com/store/firefox-extension/enable-screen-capturing.xpi">Install Firefox Extension</a> / <a href="https://github.com/muaz-khan/Firefox-Extensions/tree/master/enable-screen-capturing">Source Code</a>
</li>
</ol>

</section>

<section class="experiment">
Expand Down
96 changes: 96 additions & 0 deletions WebRTC-Scalable-Broadcast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# [WebRTC Scalable Broadcast](https://github.com/muaz-khan/WebRTC-Scalable-Broadcast)

Scalable WebRTC peer-to-peer broadcasting demo.

[![npm](https://img.shields.io/npm/v/webrtc-scalable-broadcast.svg)](https://npmjs.org/package/webrtc-scalable-broadcast) [![downloads](https://img.shields.io/npm/dm/webrtc-scalable-broadcast.svg)](https://npmjs.org/package/webrtc-scalable-broadcast)

This module simply initializes socket.io and configures it in a way that single broadcast can be relayed over unlimited users without any bandwidth/CPU usage issues. Everything happens peer-to-peer!

```
npm install webrtc-scalable-broadcast
node .\node_modules\webrtc-scalable-broadcast\server.js
```

And now open: `http://localhost:8888`.

## How it works?

This demo runs top over [RTCMultiConnection.js](http://www.RTCMultiConnection.org/). Though, you can use it in any other [WebRTC Experiment](https://www.webrtc-experiment.com/).

It following technique mentioned here:

* https://github.com/muaz-khan/WebRTC-Experiment/issues/2

![WebRTC Scalable Broadcast](https://sites.google.com/site/webrtcexperiments/WebRTC-attach-remote-stream.png)

Assuming peers 1-to-10:

### First Peer:

Peer1 is the only peer that invokes `getUserMedia`. Rest of the peers will simply [forward/relay remote stream](https://www.webrtc-experiment.com/RTCMultiConnection/remote-stream-forwarding.html).

```
peer1 captures user-media
peer1 starts the room
```

### Second Peer:

```
peer2 joins the room
peer2 gets remote stream from peer1
peer2 opens a "parallel" broadcasting peer named as "peer2-broadcaster"
```

### Third Peer:

```
peer3 joins the room
peer3 gets remote stream from peer2
peer3 opens a "parallel" broadcasting peer named as "peer3-broadcaster"
```

### Fourth Peer:

```
peer4 joins the room
peer4 gets remote stream from peer3
peer4 opens a "parallel" broadcasting peer named as "peer4-broadcaster"
```

### Fifth Peer:

```
peer5 joins the room
peer5 gets remote stream from peer4
peer5 opens a "parallel" broadcasting peer named as "peer5-broadcaster"
```

and 10th peer:

```
peer10 joins the room
peer10 gets remote stream from peer9
peer10 opens a "parallel" broadcasting peer named as "peer10-broadcaster"
```

## Conclusion

1. Peer9 gets remote stream from peer8
2. Peer15 gets remote stream from peer14
3. Peer50 gets remote stream from peer49

and so on.

## Limitation

This demo works only with screen and video-only streams. It doesn't works with audio.

Because currently [remote audio processing](https://www.webrtc-experiment.com/demos/remote-stream-recording.html) or forwarding isn't supported in chrome.

This demo works only in Chrome; no Firefox support yet. Because Firefox isn't supporting non-APM sources for peer-streaming.

## License

[Scalable WebRTC Broadcasting Demo](https://github.com/muaz-khan/WebRTC-Scalable-Broadcast) is released under [MIT licence](https://www.webrtc-experiment.com/licence/) . Copyright (c) [Muaz Khan](https://plus.google.com/+MuazKhan).
Loading

0 comments on commit a382abf

Please sign in to comment.