All Projects → coreyauger → Play Webrtc

coreyauger / Play Webrtc

Licence: mit
play-webrtc

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Play Webrtc

Chrome Extensions
WebRTC chrome extensions for screen sharing, screen recording, file sharing, youtube+audio sharing, etc.
Stars: ✭ 799 (+6046.15%)
Mutual labels:  webrtc
Play Silhouette
Silhouette is an authentication library for Play Framework applications that supports several authentication methods, including OAuth1, OAuth2, OpenID, CAS, 2FA, TOTP, Credentials, Basic Authentication or custom authentication schemes.
Stars: ✭ 826 (+6253.85%)
Mutual labels:  play-framework
Turnscan.js
Scanning LAN hosts from Chrome using ICE servers
Stars: ✭ 27 (+107.69%)
Mutual labels:  webrtc
Networked Aframe
A web framework for building multi-user virtual reality experiences.
Stars: ✭ 803 (+6076.92%)
Mutual labels:  webrtc
Media Server
WebRTC Media Server
Stars: ✭ 821 (+6215.38%)
Mutual labels:  webrtc
Circuit Sdk
JavaScript and Node.js SDK for Circuit
Stars: ✭ 18 (+38.46%)
Mutual labels:  webrtc
Webrtc Sdk
WebRTC Simple Calling API + Mobile SDK - A simplified approach to RTCPeerConnection for mobile and web video calling apps.
Stars: ✭ 794 (+6007.69%)
Mutual labels:  webrtc
Homer
HOMER - 100% Open-Source SIP / VoIP Packet Capture & Monitoring
Stars: ✭ 855 (+6476.92%)
Mutual labels:  webrtc
P2p Media Loader
An open-source engine for P2P streaming of live and on demand video directly in a web browser HTML page
Stars: ✭ 822 (+6223.08%)
Mutual labels:  webrtc
Book Examples
Stars: ✭ 25 (+92.31%)
Mutual labels:  play-framework
Exokit
Native VR/AR/XR engine for JavaScript 🦖
Stars: ✭ 809 (+6123.08%)
Mutual labels:  webrtc
Baresip
Baresip is a modular SIP User-Agent with audio and video support
Stars: ✭ 817 (+6184.62%)
Mutual labels:  webrtc
Webrtc Text Chat Tutorial
WebRTC Chat Tutorial for Scaledrone Realtime Messaging Service
Stars: ✭ 24 (+84.62%)
Mutual labels:  webrtc
Bigbluebutton
Complete open source web conferencing system.
Stars: ✭ 7,160 (+54976.92%)
Mutual labels:  webrtc
Peer Calls
Group peer to peer video calls for everyone written in Go and TypeScript
Stars: ✭ 837 (+6338.46%)
Mutual labels:  webrtc
Uproxy P2p
Internet without borders
Stars: ✭ 798 (+6038.46%)
Mutual labels:  webrtc
Turn
Pion TURN, an API for building TURN clients and servers
Stars: ✭ 831 (+6292.31%)
Mutual labels:  webrtc
Sbt Ignore Play Generated
Configure linters and coverage tools to ignore Play's generated source files.
Stars: ✭ 10 (-23.08%)
Mutual labels:  play-framework
Webrtc
Pure Go implementation of the WebRTC API
Stars: ✭ 8,399 (+64507.69%)
Mutual labels:  webrtc
Webrtc
A pure Rust implementation of WebRTC API
Stars: ✭ 922 (+6992.31%)
Mutual labels:  webrtc

play-webrtc

WebRTC is awesome! But if you are here you already know that. Just to review webRTC offers voice video and data transmission directly between peers that support the protocol. This include modern browsers (chrome, FF, opera) as well as open source code that include builds for android, ios, linux, mac, and windows.

To get a good understanding of how webRTC works you should take a look at the following article which covers everything in great detail: http://www.html5rocks.com/en/tutorials/webrtc/infrastructure/

What is play-webrtc

Simply put play-webrtc is an out of the box relay server that uses reactive websockets with a comet fallback. It includes code to setup and relay data necessary for setting up a webRTC connection between 2 or more peers.

Components include:

Play front end to render the web application. Coffeescript code to connect to the reactive websocket and negotiate sending data between peers. Iteratee websocket connection. Akka actor system for message passing and backend logic.

These component serve as a demonstration and starting point for integrating webRTC and possibly other api requests into your own application.

Additional things you will need:

In a production environment you will want to configure and run your own TURN server. For information on the setup and configuration of TURN please refer to the following documentation. https://code.google.com/p/rfc5766-turn-server/wiki/turnserver

A Note on websockets:

In a production environment you will want your websocket to be a secure connection. The reasons for this go beyond just encrypting your data. Websocket data that is now encrypted will fall victim to routers and proxies that have “smart” http caching policies. This will ultimately render your websocket useless in these environments. The solution is to use wss:// and no ws://

Setup

  1. Download Typesafe Activator (or copy it over from a USB)
  2. Extract the zip and run the activator or activator.bat script from a non-interactive shell
  3. Your browser should open to the Activator UI: http://localhost:8888

Create an application

##Getting Started

Whether you use our angular JS code or want to integrate with your own, you will need to include 2 javascript files and their dependencies.

Using our example page Take a look at what gets included on: /views/index.scala.html /views/main.scala.html

####Integration with your own The first dependency is on RxJS. If you have not heard of reactive extensions for javascript… you are missing out. You need to head on over to this page https://github.com/Reactive-Extensions/RxJS and take a look at what they provide. Here are the 2 include that you require.

<script src="/javascripts/ext/rxjs/2.2.20/rx.lite.compat.min.js""></script>
<script src="/javascripts/ext/rxjs/2.2.20/rx.async.min.js""></script>

Once you have these dependencies added you can add the 2 required js files.

<script src='@routes.Assets.at("javascripts/webrtc.js")' type="text/javascript"></script>
<script src='@routes.Assets.at("javascripts/worker.rx.js")' type="text/javascript"></script>

Initializing

Next thing we need to do is initialize the Websocket Rx worker class. This can be seen in the controller.coffee file where we create a factory worker.

webrtcControllers.factory("worker",['$rootScope','$q', ($rootScope,$q) -> worker = new window.SocketWorker(window._uuid, 'username') worker.controllerOps ])

Notice that we pass in some form of a user id (_uuid) and a username to the SocketWorker. The line below that is angular specific and simple exposes some operations from the worker. In a non angular environment you can simple initialize the class like so:

worker = new window.SocketWorker(window._uuid, 'username')

Handling Events

Next you will want to setup the common webrtc event handlers. The 3 most important ones being the following:

onAddRemoteStream
onRemoveRemoteStream
onAddLocalStream

These let you know when someone has joined as well as when your local video feed is ready. The methods simply hand you a video object that you can insert into the DOM at whatever location you desire. In our angular code this looks like the following.

 worker.webrtc().onAddRemoteStream = (uuid, video, dataChannel) ->
    id = $scope.peers.length+1;
    $scope.peers.push({
      uuid:uuid,
      username: '',
      id: id
    })
    jidToPeerId[uuid] = id
    setTimeout(->
      $scope.$apply()
      $('#video'+id).append(video)
    ,0)


  worker.webrtc().onRemoveRemoteStream = (uuid) ->
    $scope.peers = $scope.peers.filter((p) ->
      p.uuid != uuid
    )
    setTimeout(->
      $scope.$apply()
    ,0)


  worker.webrtc().onAddLocalStream = (video) ->
    id = $scope.peers.length+1
    $scope.peers.push({
      uuid:worker.uuid(),
      username: '',
      id: id
    })
    jidToPeerId[worker.uuid()] = id
    setTimeout( ->
      $scope.$apply()
      $('#video'+id).append(video)
    ,0)

Note that in a non angular setting your would simply use

worker.webrtc.onAddRemoteStream = function(uuid, video){
	// .. do stuff with video .. for eg:
	$(body).append(video);
}

Starting the Session

We first subscribe to our websocket stream to receive events about the appropriate message that we are interested in. The “room” category and the “join” event.

roomSubject = worker.subject('room')
  roomSub = roomSubject.filter( (r) -> r.op == 'join' ).subscribe( (ret) ->
    console.log('ret.data.members',ret.data.members)
    worker.webrtc().init($scope.room, true)
  )

This simply will initialize a webrtc session with anyone that joins the room.

All that is left to do now is announce that we have joined the room.

worker.onNext({slot:'room',op:'join',data:{name: $scope.room}})

Open in an IDE

If you want to use an IDE (Eclipse or IntelliJ), click on Code, select Open, and then select your IDE. This will walk you through the steps to generate the project files and open the project. Alternatively you can edit files in the Activator UI.

Update Dependencies

AngularJS https://angularjs.org/ Bootstrap http://getbootstrap.com/components/ RxJS https://github.com/Reactive-Extensions/RxJS

Other information

Read the tutorial html /tutorial/index.html

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].