Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions samples/screen-sharing/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>screen-sharing</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
4 changes: 4 additions & 0 deletions samples/screen-sharing/.settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
25 changes: 25 additions & 0 deletions samples/screen-sharing/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.restcomm</groupId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>screen-sharing</artifactId>

<name>WebRTC screen sharing demo</name>
<packaging>pom</packaging>


<properties>
<!-- Screen sharing -->
<restcomm-host>localhost</restcomm-host>
<restcomm-port>5083</restcomm-port>
<screen-sharing-ext-domains>https://localhost/*</screen-sharing-ext-domains>
</properties>

<modules>
<module>screen-sharing-web</module>
<module>screen-sharing-extension</module>
</modules>

</project>
1 change: 1 addition & 0 deletions samples/screen-sharing/screen-sharing-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
17 changes: 17 additions & 0 deletions samples/screen-sharing/screen-sharing-extension/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>screen-sharing-extension</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
28 changes: 28 additions & 0 deletions samples/screen-sharing/screen-sharing-extension/crx.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDSLNG2mxwDT9bf
5JyufK9i4+HMdZ7uMhWsZFlkS0Xa5ustqFJpKUBrtQ4+68N6+HCJw1Es/30MhxgH
YBTZDrk43Vc/zaho+xz4GTPCxOBLOH9hVN7gqv32bLc59c/CkXQZzsQ7e9EWtMMi
HB7qkJsjkX2T2OsAzQ6SePsxDyddM3Gbd8gHomrNeXMkZFpxPtP2VYgH3B2w/YwN
gSruBxJrBPpccRwecWBKWB+y5+b5fBaa2ASLhbZ8n2C/tBcjByniOHxs+90T2P/4
ajT9C8QoRn9s2q8O0I6rmfygfIs3u1333V46fhXDVZwQYTioHmJOPRNOKj7mEGZ0
Y6q9C8EHAgMBAAECggEAHVjSw5uu8qtwRn0Gf7q7RqSpP8JgucPWkObGMKHuFB3Q
UuTA9RwkeaWjYpfLCN2t4R6btBvMmzY13bnFz3Ul2dHWP/t4e4gsyFvEhXq2EurF
ppKSOG7H3WPaxcYUB4gF3SCo9+FXFcORx66Dhp9AelvzW/SbA9aeJUetU3FZPsMS
PG2VIrlgW4mNj+R2II5TwXi/Lb4Z9JqzptKtJDzy3ZDAh6Eg6iUicdQGjw7oAbn9
o0rQyob+NOYY/H/uZgw0mqweHEXcO0gsmYCxAOuRwUl6BHpMBl3Cxv+Gp8l4ScHu
seGGWCH1vU2NGReacCLOqdegb2aOI5CL0eKnvflOiQKBgQD3l5PYQf38sQSxMy8i
mbthGKNIEFQ4ZYOAXo7x9T02iaKhO+a5b0murrJLj3CNt1FkwnpmkLsuPn9c3lVm
uuKH1q/mquEqIMpV6Vg4UM9idyOAR/7UB/Z46/lb/3QvFXt+eBkPZVXm/TT8r0NX
GKIyeOof2TJ7zD+3wHjcSVC4nQKBgQDZT/WvXWSPizZCKuRQSqVuAQPHb8KKN1gh
9wA2CW5gosI3UpHPx4UdM4Lnqa16h/b1Zae4hLbfhyjUnRzsKYSY5o7p1yRyvh34
UHCc0CPM89KkySXOwU/T/GF/VHYao0OxZsA+yNbkBGRPoeMsrk6JgNTGjl6VW7SO
hPYz5m1U8wKBgQDwpfiCYqoOeLP506kFtWyGFF9oBM8HPcvR8pZ3oIjNwHs8wa8h
H4T7bztG6/VXGQ3YpJo5pIT6jq5WQpe5UP4rT8UKq55MxzBCzpn7qrfXmbr8zX1m
8xJiN+HXxHRV60hsBSk+aJ1U9VkSHPuT5RKJgjL1n7NM1po77KzMV8pIlQKBgHJZ
DclyFjkmIq3cjfjl3nis1gU6fJ5oEtsEcrr8aXU2D4Y2z30K2rOL6GToNt2T79Ie
5ItGYkfqggSmi5KFIj2mjCrlx0sNWQ3RngAV0dDFt+B364oI1G2SjucGVYMcx8Dw
dVZULicbXIE+iSB4s+DMxqmYPpLPB4o60qZqqLsbAoGBAJdjY62Qmij4kvwNJXJs
qGeJK/uVJYNzgFO9cFwTpoTRtgsF1ycJjloLNZXykXBjP8BcRp6p2RkZcA+dkTco
1+WWWTdtnGAy4o5wIruJKo8dnF2M8caNZVVjnhWc1MQqTNKHXRekokUqCk2rH1sj
f79SoczGhVF5j6EKTP/uvwca
-----END PRIVATE KEY-----
62 changes: 62 additions & 0 deletions samples/screen-sharing/screen-sharing-extension/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.restcomm</groupId>
<artifactId>screen-sharing</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>screen-sharing-extension</artifactId>
<name>WebRTC screen sharing Chrome extension</name>
<packaging>crx</packaging>

<properties>
<filtered.dir>${project.build.directory}/generated-sources/filtered</filtered.dir>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>filter-sources</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<outputDirectory>${filtered.dir}</outputDirectory>
<resources>
<resource>
<directory>src/main/chrome</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.btmatthews.maven.plugins</groupId>
<artifactId>crx-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<pemFile>${basedir}/crx.pem</pemFile>
<crxSourceDirectory>${filtered.dir}</crxSourceDirectory>
</configuration>
<executions>
<execution>
<id>package-crx</id>
<goals>
<goal>crx</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>

<finalName>screen-sharing-extension</finalName>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Copyright © 2012-25 Muaz Khan<@muazkh>. @WebRTCWeb

Permission is hereby granted, free of charge, to any person obtaining a copy of these WebRTC Experiments and associated documentation files (the “Software”),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// this background script is used to invoke desktopCapture API
// to capture screen-MediaStream.

var screenOptions = ['screen', 'window'];

chrome.runtime.onConnect.addListener(function (port) {
port.onMessage.addListener(portOnMessageHanlder);

// this one is called for each message from "content-script.js"
function portOnMessageHanlder(message) {
if(message == 'get-sourceId') {
chrome.desktopCapture.chooseDesktopMedia(screenOptions, port.sender.tab, onAccessApproved);
}

if(message == 'audio-plus-tab') {
screenOptions = ['audio', 'tab'];
chrome.desktopCapture.chooseDesktopMedia(screenOptions, port.sender.tab, onAccessApproved);
}
}

// on getting sourceId
// "sourceId" will be empty if permission is denied.
function onAccessApproved(sourceId) {
// if "cancel" button is clicked
if(!sourceId || !sourceId.length) {
return port.postMessage('PermissionDeniedError');
}

// "ok" button is clicked; share "sourceId" with the
// content-script which will forward it to the webpage
port.postMessage({
sourceId: sourceId
});
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// this content-script plays role of medium to publish/subscribe messages from webpage to the background script

// this object is used to make sure our extension isn't conflicted with irrelevant messages!
var rtcmulticonnectionMessages = {
'are-you-there': true,
'get-sourceId': true,
'audio-plus-tab': true
};

// this port connects with background script
var port = chrome.runtime.connect();

// if background script sent a message
port.onMessage.addListener(function (message) {
// get message from background script and forward to the webpage
window.postMessage(message, '*');
});

// this event handler watches for messages sent from the webpage
// it receives those messages and forwards to background script
window.addEventListener('message', function (event) {
// if invalid source
if (event.source != window)
return;

// it is 3rd party message
if(!rtcmulticonnectionMessages[event.data]) return;

// if browser is asking whether extension is available
if(event.data == 'are-you-there') {
window.postMessage('rtcmulticonnection-extension-loaded', '*');
}

// if it is something that need to be shared with background script
if(event.data == 'get-sourceId' || event.data === 'audio-plus-tab') {
// forward message to background script
port.postMessage(event.data);
}
});

// inform browser that you're available!
window.postMessage('rtcmulticonnection-extension-loaded', '*');
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name" : "WebRTC Screen Capturing",
"author": "Techinfocom JSC, Telestax",
"version" : "1.0",
"manifest_version" : 2,
"minimum_chrome_version": "34",
"description" : "This WebRTC screen capturing extension can be used within any WebRTC library/application!",
"homepage_url": "https://github.com/muaz-khan/WebRTC-Experiment/tree/master/Chrome-Extensions/desktopCapture",
"background": {
"scripts": ["background-script.js"],
"persistent": false
},
"content_scripts": [ {
"js": [ "content-script.js" ],
"all_frames": true,
"run_at": "document_end",
"matches": ["${screen-sharing-ext-domains}"]
}],
"icons" : {
"48" : "icon.png"
},
"permissions": [
"desktopCapture"
],
"web_accessible_resources": [
"icon.png"
]
}
32 changes: 32 additions & 0 deletions samples/screen-sharing/screen-sharing-web/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions samples/screen-sharing/screen-sharing-web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
37 changes: 37 additions & 0 deletions samples/screen-sharing/screen-sharing-web/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>screen-sharing-web</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions samples/screen-sharing/screen-sharing-web/.settings/.jsdtscope
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="screen-sharing">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="screen-sharing"/>
<property name="java-output-path" value="/screen-sharing-web/target/classes"/>
</wb-module>
</project-modules>
Loading