Skip to content

Commit

Permalink
Restructre the apprtc repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiayang Liu committed Feb 3, 2015
1 parent 9e9a05c commit 6644b0e
Show file tree
Hide file tree
Showing 210 changed files with 167 additions and 11,586 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ validation-status.json
bower_components
google_appengine*
webtest-master*
build
samples/web/content/apprtc/js/compiled
samples/web/content/apprtc/version_info.json
out
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
language: node_js
node_js:
- 0.10

install:
- npm install -g bower grunt grunt-cli
- npm install grunt-jscs grunt-contrib-jshint grunt-htmlhint grunt-contrib-csslint
- npm install grunt-jinja grunt-jscs grunt-shell grunt-jstestdriver-phantomjs grunt-closurecompiler

script:
- grunt
114 changes: 52 additions & 62 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,102 +3,84 @@
/* globals module */

module.exports = function(grunt) {

// configure project
grunt.initConfig({
// make node configurations available
pkg: grunt.file.readJSON('package.json'),

csslint: {
options: {
csslintrc: 'samples/web/.csslintrc'
csslintrc: 'build/.csslintrc'
},
strict: {
options: {
import: 2
},
src: ['samples/web/content/**/*.css',
'!samples/web/content/**/*_nolint.css',
'!samples/web/content/testrtc/bower_components/**/*.css'
src: ['src/**/*.css'
]
},
lax: {
options: {
import: false
},
src: ['samples/web/content/**/*.css',
'!samples/web/content/**/*_nolint.css',
'!samples/web/content/testrtc/bower_components/**/*.css'
src: ['src/**/*.css'
]
}
},

htmlhint: {
html1: {
src: [
'samples/web/content/apprtc/index.html',
'samples/web/content/datachannel/index.html',
'samples/web/content/getusermedia/**/index.html',
'samples/web/content/peerconnection/**/index.html'
src: ['src/html/index.html'
]
}
},

jscs: {
src: 'samples/web/content/**/*.js',
src: 'src/**/*.js',
options: {
preset: 'google', // as per Google style guide – could use '.jscsrc' instead
'excludeFiles': [
'samples/web/content/apprtc/js/compiled/*.js',
'samples/web/content/apprtc/js/vr.js',
'samples/web/content/apprtc/js/stereoscopic.js',
'samples/web/content/getusermedia/desktopcapture/extension/content-script.js',
'samples/web/content/testrtc/bower_components/**',
// TODO (chuckhays) : remove these exclusions after code passes.
'samples/web/content/getusermedia/**/*.js',
'samples/web/content/peerconnection/**/*.js',
'samples/web/content/datachannel/**/*.js'
]
'src/js/adapter.js'
],
requireCurlyBraces: ['if']
}
},

jshint: {
options: {
ignores: [
'samples/web/content/getusermedia/desktopcapture/**',
'samples/web/content/apprtc/js/compiled/*.js',
'samples/web/content/apprtc/js/stereoscopic.js',
'samples/web/content/apprtc/js/ga.js',
'samples/web/content/apprtc/js/vr.js',
'samples/web/content/testrtc/bower_components/**'
],
// use default .jshintrc files
jshintrc: true
jshintrc: 'build/.jshintrc'
},
// files to validate
// can choose more than one name + array of paths
// usage with this name: grunt jshint:files
files: ['samples/web/content/**/*.js']
files: ['src/**/*.js']
},

shell: {
runPythonTests: {
command: './run_python_tests.sh'
command: './build/run_python_tests.sh'
},
buildVersion: {
command: 'samples/web/content/apprtc/build_version_file.sh',
command: './build/build_version_file.sh',
options: {
stdout: true,
stderr: true
}
},
buildAppEnginePackage: {
command: './build/build_app_engine_package.sh',
options: {
stdout: true,
stderr: true
}
}
},

'grunt-chrome-build' : {
apprtc: {
options: {
buildDir: 'build/chrome-app',
zipFile: 'build/chrome-app/apprtc.zip',
buildDir: 'out/chrome-app',
zipFile: 'out/chrome-app/apprtc.zip',
// If values for chromeBinary and keyFile are not provided, the packaging
// step will be skipped.
// chromeBinary should be set to the Chrome executable on your system.
Expand All @@ -109,18 +91,26 @@ module.exports = function(grunt) {
files: [
{
expand: true,
cwd: 'samples/web/content/apprtc',
cwd: 'out/app_engine',
src: [
'**/*.js',
'!**/*test.js',
'**/*.css',
'images/apprtc*.png',
'manifest.json',
'!*.pem'
'**/images/apprtc*.png',
'!**/*.pem'
],
dest: 'build/chrome-app/'
dest: 'out/chrome-app/'
},
{
expand: true,
cwd: 'src',
src: [
'js/background.js',
'js/appwindow.js',
'!**/*.pem'
],
dest: 'out/chrome-app/'
}
]
],
}
},

Expand All @@ -130,25 +120,25 @@ module.exports = function(grunt) {
port: 9876,
},
files: [
'samples/web/content/apprtc/js_test_driver.conf',
'build/js_test_driver.conf',
]},

closurecompiler: {
debug: {
files: {
// Destination: [source files]
'samples/web/content/apprtc/js/compiled/apprtc.debug.js': [
'samples/web/content/apprtc/js/adapter.js',
'samples/web/content/apprtc/js/appcontroller.js',
'samples/web/content/apprtc/js/call.js',
'samples/web/content/apprtc/js/infobox.js',
'samples/web/content/apprtc/js/peerconnectionclient.js',
'samples/web/content/apprtc/js/roomselection.js',
'samples/web/content/apprtc/js/sdputils.js',
'samples/web/content/apprtc/js/signalingchannel.js',
'samples/web/content/apprtc/js/stats.js',
'samples/web/content/apprtc/js/storage.js',
'samples/web/content/apprtc/js/util.js',
'out/app_engine/js/apprtc.debug.js': [
'src/js/adapter.js',
'src/js/appcontroller.js',
'src/js/call.js',
'src/js/infobox.js',
'src/js/peerconnectionclient.js',
'src/js/roomselection.js',
'src/js/sdputils.js',
'src/js/signalingchannel.js',
'src/js/stats.js',
'src/js/storage.js',
'src/js/util.js',
]
},
options: {
Expand All @@ -168,14 +158,14 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-jstestdriver-phantomjs');
grunt.loadNpmTasks('grunt-closurecompiler');
grunt.loadTasks('grunt-chrome-build');
grunt.loadTasks('build/grunt-chrome-build');

// set default tasks to run when grunt is called without parameters
grunt.registerTask('default', ['csslint', 'htmlhint', 'jscs', 'jshint',
'shell:buildVersion', 'shell:runPythonTests',
'jstests']);
'shell:buildAppEnginePackage', 'jstests']);
grunt.registerTask('jstests', ['closurecompiler:debug', 'jstdPhantom']);
grunt.registerTask('build', ['closurecompiler:debug', 'shell:buildVersion', 'grunt-chrome-build']);
grunt.registerTask('build', ['closurecompiler:debug', 'shell:buildVersion', 'grunt-chrome-build', 'shell:buildAppEnginePackage']);
// also possible to call JavaScript directly in registerTask()
// or to call external tasks with grunt.loadTasks()
};
112 changes: 38 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,63 @@
[![Build Status](https://travis-ci.org/GoogleChrome/webrtc.svg)](https://travis-ci.org/GoogleChrome/webrtc)
# AppRTC Demo Code

# WebRTC code samples #
## Development

This is a repository for client-side WebRTC code samples and the [AppRTC](https://apprtc.appspot.com) video chat client.
Detailed information on devloping in the [GoogleChrome/webrtc](https://github.com/GoogleChrome/webrtc) github repo can be found in the [WebRTC GitHub repo developer's guide](https://docs.google.com/document/d/1tn1t6LW2ffzGuYTK3366w1fhTkkzsSvHsBnOHoDfRzY/edit?pli=1#heading=h.e3366rrgmkdk).

Some of the samples use new browser features. They may only work in Chrome Canary and/or Firefox Beta, and may require flags to be set.
The development AppRTC server can be accessed by visiting [http://localhost:8080](http://localhost:8080).

All of the samples use [adapter.js](https://github.com/GoogleChrome/webrtc/blob/master/samples/web/js/adapter.js), a shim to insulate apps from spec changes and prefix differences. In fact, the standards and protocols used for WebRTC implementations are highly stable, and there are only a few prefixed names. For full interop information, see [webrtc.org/web-apis/interop](http://www.webrtc.org/web-apis/interop).
Running AppRTC locally requires the [Google App Engine SDK for Python](https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python) and [Grunt](http://gruntjs.com/).

NB: all samples that use `getUserMedia()` must be run from a server. Calling `getUserMedia()` from a file:// URL will result in a PermissionDeniedError NavigatorUserMediaError.
Detailed instructions for running on Ubuntu Linux are provided below.

[webrtc.org/testing](http://www.webrtc.org/testing) lists command line flags useful for development and testing with Chrome.
### Running on Ubuntu Linux

For more information about WebRTC, we maintain a list of [WebRTC Resources](https://docs.google.com/document/d/1idl_NYQhllFEFqkGQOLv8KBK8M3EVzyvxnKkHl4SuM8/edit). If you've never worked with WebRTC, we recommend you start with the 2013 Google I/O [WebRTC presentation](http://www.youtube.com/watch?v=p2HzZkd2A40).
Install grunt by first installing [npm](https://www.npmjs.com/),

Patches and issues welcome! See [CONTRIBUTING](https://github.com/GoogleChrome/webrtc/blob/master/CONTRIBUTING.md) for instructions. All contributors must sign a contributor license agreement before code can be accepted. Please complete the agreement for an [individual](https://developers.google.com/open-source/cla/individual) or a [corporation](https://developers.google.com/open-source/cla/corporate) as appropriate. The [Developer's Guide](https://bit.ly/webrtcdevguide) for this repo has more information about code style, structure and validation.
```
sudo apt-get install npm
```

## The demos ##
On Ubuntu 14.04 the default packages installs `/usr/bin/nodejs` but the `/usr/bin/node` executable is required for grunt. You can add this by installing the `nodejs-legacy` package,

### getUserMedia ###
```
sudo apt-get install nodejs-legacy
```

[Basic getUserMedia demo](https://googlechrome.github.io/webrtc/samples/web/content/getusermedia/gum)
It is easiest to install a shared version of `grunt-cli` from `npm` using the `-g` flag. This will allow you access the `grunt` command from `/usr/local/bin`. More information can be found on [`gruntjs` Getting Started](http://gruntjs.com/getting-started).

[getUserMedia + canvas](https://googlechrome.github.io/webrtc/samples/web/content/getusermedia/canvas)
```
sudo npm -g install grunt-cli
```

[getUserMedia + canvas + CSS Filters](https://googlechrome.github.io/webrtc/samples/web/content/getusermedia/filter)
*Omitting the `-g` flag will install `grunt-cli` to the current directory under the `node_modules` directory.*

[getUserMedia with resolution constraints](https://googlechrome.github.io/webrtc/samples/web/content/getusermedia/resolution)
Finally, you will want to install grunt and required grunt dependencies. *This can be done from any directory under your checkout of the [GoogleChrome/webrtc](https://github.com/GoogleChrome/webrtc) repository.*

[getUserMedia with camera/mic selection](https://googlechrome.github.io/webrtc/samples/web/content/getusermedia/source)
```
npm install
```

[Audio-only getUserMedia output to local audio element](https://googlechrome.github.io/webrtc/samples/web/content/getusermedia/audio)
Before you start the AppRTC dev server and *everytime you update the javascript* you need to recompile the App Engine package by running,

[Audio-only getUserMedia displaying volume](https://googlechrome.github.io/webrtc/samples/web/content/getusermedia/volume)
```
grunt build
```

[Face tracking](https://googlechrome.github.io/webrtc/samples/web/content/getusermedia/face)
Start the AppRTC dev server from the `out/app_engine` directory by running the Google App Engine SDK dev server,

### RTCPeerConnection ###
```
<path to sdk>/dev_appserver.py ./out/app_engine
```

[Basic peer connection](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/pc1)
### Testing

[Audio-only peer connection](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/audio)
All tests by running `grunt`.

[Multiple peer connections at once](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/multiple)
To run only the Python tests you can call,

[Forward output of one peer connection into another](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/multiple-relay)

[Munge SDP parameters](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/munge-sdp)

[Use pranswer when setting up a peer connection](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/pr-answer)

[Adjust constraints, view stats](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/constraints)

[Display createOffer output](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/create-offer)

[Use RTCDTMFSender](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/dtmf)

[Display peer connection states](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/states)

[ICE candidate gathering from STUN/TURN servers](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/trickle-ice)

[Web Audio output as input to peer connection](https://googlechrome.github.io/webrtc/samples/web/content/peerconnection/webaudio-input)

### RTCDataChannel ###

[Data channels](https://googlechrome.github.io/webrtc/samples/web/content/datachannel)

### Video chat ###

[AppRTC video chat client](https://apprtc.appspot.com) powered by Google App Engine

[AppRTC URL parameters](https://apprtc.appspot.com/html/params.html)

## Test pages ##

[Audio and Video streams](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/audio-and-video)

[Iframe apprtc](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/iframe-apprtc)

[Iframe video](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/iframe-video)

[Multiple audio streams](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/multiple-audio)

[Multiple peerconnections](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/multiple-peerconnections)

[Multiple video devices](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/multiple-video-devices)

[Multiple video streams](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/multiple-video)

[Peer2peer](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/peer2peer)

[Peer2peer iframe](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/peer2peer-iframe)

[Single audio stream](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/single-audio)

[Single video stream](https://googlechrome.github.io/webrtc/samples/web/content/manual-test/single-video)
```
grunt shell:runPythonTests
```


Loading

0 comments on commit 6644b0e

Please sign in to comment.