diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..23b8d3d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+node_modules/
+build/
+npm-debug.log
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..da33b3c
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,5 @@
+The MIT License (MIT)
+Copyright (c) 2016 Ricoh Company, Ltd.
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software 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.
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e81ed47
--- /dev/null
+++ b/README.md
@@ -0,0 +1,47 @@
+# Ricoh Video Streaming Sample
+
+Video streaming API sample app.
+
+## Requirements
+
+* Google Chrome 49 or newer.
+* Web Camera accessible from your browser.
+* Enable Web Camera access in your browser setting.
+
+You'll also need
+
+* Ricoh API Client Credentials (client_id & client_secret)
+* Ricoh ID (user_id & password)
+
+If you don't have them, please register them at [THETA Developers Website](http://contest.theta360.com/).
+
+## Setup
+
+```sh
+$ git clone https://github.com/ricohapi/video-streaming-js.git
+$ cd video-streaming-js
+$ cp samples/config_template.js samples/config.js
+```
+
+and put your credentials into the `config.js`.
+
+## Build
+
+```sh
+$ npm install
+$ gulp build
+```
+
+## Video Streaming
+
+Connect the Web Camera and execute `gulp run`, then the browser will be opened.
+Select the Web Camera, put your Ricoh ID & password, and submit the login button.
+Let the peer user login on his own device following the instruction above, then put the peer's User ID to the Peer-ID field and submit Connect button, then streaming connection will start between you and the peer.
+
+```sh
+$ gulp run
+```
+
+## THETA View
+
+If the peer user is using THETA, push THETA View button, then you'll see the draggable & zoomable 360° view.
diff --git a/gulpfile.js b/gulpfile.js
new file mode 100644
index 0000000..4a6c1f2
--- /dev/null
+++ b/gulpfile.js
@@ -0,0 +1,20 @@
+var gulp = require('gulp'),
+ webserver = require('gulp-webserver'),
+ webpack = require('webpack-stream'),
+ webpackConfig = require('./webpack.config.js');
+
+gulp.task('run', function () {
+ gulp.src('')
+ .pipe(webserver({
+ host: 'localhost',
+ port: 8034,
+ open: true,
+ fallback: 'samples/index.html'
+ }));
+});
+
+gulp.task('build', function() {
+ return gulp.src('')
+ .pipe(webpack(webpackConfig))
+ .pipe(gulp.dest(''));
+});
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..601fef7
--- /dev/null
+++ b/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "ricohapi-video-streaming-sample",
+ "version": "1.0.0",
+ "description": "RICOH API video streaming sample",
+ "main": "index.html",
+ "dependencies": {
+ "ricohapi-auth": "1.0.1"
+ },
+ "devDependencies": {
+ "gulp": "^3.9.1",
+ "webpack-stream": "^3.1.0",
+ "gulp-webserver": "^0.9.1",
+ "babel-loader": "^6.2.4",
+ "babel-core": "^6.7.0",
+ "babel-preset-es2015": "^6.6.0"
+ },
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/ricohapi/video-streaming-js.git"
+ },
+ "keywords": [],
+ "bugs": {
+ "url": "https://github.com/ricohapi/video-streaming-js/issues"
+ },
+ "homepage": "https://github.com/ricohapi/video-streaming-js"
+}
diff --git a/samples/.gitignore b/samples/.gitignore
new file mode 100644
index 0000000..1bf4259
--- /dev/null
+++ b/samples/.gitignore
@@ -0,0 +1 @@
+config.js
diff --git a/samples/UDCStrophe.js b/samples/UDCStrophe.js
new file mode 100644
index 0000000..db47bc3
--- /dev/null
+++ b/samples/UDCStrophe.js
@@ -0,0 +1,64 @@
+'use strict';
+/**
+ * Copyright (c) 2016 Ricoh Company, Ltd. All Rights Reserved.
+ * See LICENSE for more information
+ */
+
+const AuthClient = require('ricohapi-auth').AuthClient;
+
+function _log(str) {
+ console.log(str);
+}
+
+class UDCStrophe {
+ constructor(clientID, clientSecret) {
+ this._client = new AuthClient(clientID, clientSecret);
+ }
+
+ _onConnect(self, status) {
+ if (status == Strophe.Status.CONNECTING) {
+ _log('Strophe is connecting.');
+ } else if (status == Strophe.Status.CONNFAIL) {
+ _log('Strophe failed to connect.');
+ self.connectReject();
+ } else if (status == Strophe.Status.DISCONNECTING) {
+ _log('Strophe is disconnecting.');
+ } else if (status == Strophe.Status.DISCONNECTED) {
+ _log('Strophe is disconnected.');
+ } else if (status == Strophe.Status.CONNECTED) {
+ _log('Strophe is connected.');
+ self.connection.send($pres());
+ self.connectResolve();
+ } else if (status == Strophe.Status.AUTHENTICATING) {
+ _log('Strophe is authenticating.');
+ } else if (status == Strophe.Status.AUTHFAIL) {
+ _log('Strophe is authfail.');
+ self.connectReject();
+ }
+ }
+
+ connect(userID, userPass) {
+ this._client.setResourceOwnerCreds(userID.split('+')[0], userPass.split('+')[0]);
+ this.id = userID;
+
+ return new Promise((resolve, reject) => {
+ this._client.session(AuthClient.SCOPES.VStream)
+ .then(() => {
+ this.connection = new Strophe.Connection('https://sig.ricohapi.com/http-bind/');
+ Strophe.SASLSHA1.test = () => false;
+ this.connectResolve = resolve;
+ this.connectReject = reject;
+ this.connection.connect(userID.replace(/@/g, '\\40') + '@sig.ricohapi.com@sig.ricohapi.com/peer', this._client.accessToken, this._onConnect.bind(this, this));
+ })
+ .catch(e => reject(e));
+ });
+ }
+
+ disconnect() {
+ if (this.connection === undefined) return;
+ this.connection.disconnect('none');
+ this.connection = undefined;
+ }
+
+};
+exports.UDCStrophe = UDCStrophe;
diff --git a/samples/config_template.js b/samples/config_template.js
new file mode 100644
index 0000000..1b0f4b0
--- /dev/null
+++ b/samples/config_template.js
@@ -0,0 +1,8 @@
+'use strict';
+
+const CONFIG = {
+ clientId: '',
+ clientSecret: '',
+};
+
+module.exports.CONFIG = CONFIG;
diff --git a/samples/index.html b/samples/index.html
new file mode 100644
index 0000000..6610419
--- /dev/null
+++ b/samples/index.html
@@ -0,0 +1,106 @@
+
+
+
+
+
+ Video streaming sample
+
+
+
+
+
+
+
Video streaming sample
+
ID:
+
+
+
+
PASS:
+
+
+
+
Choose your webcam:
+
+
+
+
S
+
e
+
a
+
r
+
c
+
h
+
i
+
n
+
g
+
.
+
+
+
Failed to access the webcam. Make sure to run this demo on an http server and click allow when asked for permission by the browser.
+
No Cameras.
+
Please click `allow` on the top of the screen so we can access your webcam for calls.