This repository has been archived by the owner on May 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aikw
committed
Mar 31, 2016
0 parents
commit 88ac4ec
Showing
15 changed files
with
1,063 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
build/ | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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('')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') + '@[email protected]/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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
|
||
const CONFIG = { | ||
clientId: '', | ||
clientSecret: '', | ||
}; | ||
|
||
module.exports.CONFIG = CONFIG; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Video streaming sample</title> | ||
<link rel='stylesheet' href='./samples/styles/style.css'> | ||
</head> | ||
|
||
<body> | ||
<div id="loginpage" class="wrapper"> | ||
<div class="loginform"> | ||
<h2>Video streaming sample</h2> | ||
<p>ID: | ||
<br/> | ||
<input id="id" type="text" value="" /> | ||
</p> | ||
<p>PASS: | ||
<br/> | ||
<input id="pass" type="password" value="" /> | ||
</p> | ||
<p>Choose your webcam:</p> | ||
<div id="cameras"></div> | ||
<div id="loader" class="load-6"> | ||
<div class="letter-holder"> | ||
<div class="l-1 letter">S</div> | ||
<div class="l-2 letter">e</div> | ||
<div class="l-3 letter">a</div> | ||
<div class="l-4 letter">r</div> | ||
<div class="l-5 letter">c</div> | ||
<div class="l-6 letter">h</div> | ||
<div class="l-7 letter">i</div> | ||
<div class="l-8 letter">n</div> | ||
<div class="l-9 letter">g</div> | ||
<div class="l-10 letter">.</div> | ||
</div> | ||
</div> | ||
<div id="camerr" style="display:none">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.</div> | ||
<div id="nocamera" style="display:none">No Cameras.</div> | ||
<p>Please click `allow` on the top of the screen so we can access your webcam for calls.</p> | ||
<button id="login" style="display:none">Login</button> | ||
<div id="loader2" style="display:none" class="load-6"> | ||
<div class="letter-holder"> | ||
<div class="l-1 letter">C</div> | ||
<div class="l-2 letter">o</div> | ||
<div class="l-3 letter">n</div> | ||
<div class="l-4 letter">n</div> | ||
<div class="l-5 letter">e</div> | ||
<div class="l-6 letter">c</div> | ||
<div class="l-7 letter">t</div> | ||
<div class="l-8 letter">i</div> | ||
<div class="l-9 letter">n</div> | ||
<div class="l-10 letter">g</div> | ||
</div> | ||
</div> | ||
<div id="loginerr" style="display:none">Login failed.</div> | ||
</div> | ||
</div> | ||
<div id="viewpage" style="display:none" class="wrapper"> | ||
<div class="wrapleft"> | ||
<div class="left"> | ||
<div class="thetamode"> | ||
<button id="theta">THETA View Mode</button> | ||
</div> | ||
<div id="peer-container"> | ||
<video id="peer-video" autoplay></video> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="right"> | ||
ID: | ||
<div id="myid"></div> | ||
<button id="logout">Logout</button> | ||
<p>Peer-ID: | ||
<br/> | ||
<input id="peer-id" type="text" value="" /> | ||
</p> | ||
<button id="connect">Connect</button> | ||
<div id="loader3" style="display:none" class="load-6"> | ||
<div class="letter-holder"> | ||
<div class="l-1 letter">C</div> | ||
<div class="l-2 letter">o</div> | ||
<div class="l-3 letter">n</div> | ||
<div class="l-4 letter">n</div> | ||
<div class="l-5 letter">e</div> | ||
<div class="l-6 letter">c</div> | ||
<div class="l-7 letter">t</div> | ||
<div class="l-8 letter">i</div> | ||
<div class="l-9 letter">n</div> | ||
<div class="l-10 letter">g</div> | ||
</div> | ||
</div> | ||
<div id="my-container"> | ||
<video id="my-video" width="200" height="200" autoplay></video> | ||
</div> | ||
|
||
</div> | ||
<div class="footer"></div> | ||
</div> | ||
<script src="http://cdn.peerjs.com/0.3/peer.min.js"></script> | ||
<script src='https://cdnjs.cloudflare.com/ajax/libs/three.js/r73/three.min.js'></script> | ||
<script src='https://cdnjs.cloudflare.com/ajax/libs/strophe.js/1.2.5/strophe.min.js'></script> | ||
<script src='../build/bundle.js'></script> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.