A simple wrapper for WebRTC in AngularJS applications.
in active development
bower install --save ac.angular-webrtc
Or :
-
clone the repo
git clone https://github.com/antoinechalifour/angular-webrtc
-
Include
angular-webrtc
in your html page.
<script src="<your vendor dir>/dist/angular-webrtc.js" type="text/javascript"></script>
- Inject the
ac.angular-webrtc
module in your application.
angular.module('your.module', [
'ac.angular-webrtc'
]);
More examples and docs : http://antoinechalifour.github.io/angular-webrtc/#/
As this module is a wrapper for webrtc, it provides a few services so that you don't need to care whether you use Chrome or Firefox (other browsers are not supported).
RtcUserMedia is a wrapper for getUserMedia API.
You can get user media (microphone and camera) using RtcUserMedia.getUserMedia(constraints, onSuccess, onError).
This wrapper already wraps onSuccess and onError in a $rootScope.$apply()
so that you don't need to care about that.
For instance, this piece of code gets the video stream :
RtcUserMedia.getUserMedia(
{video: true, audio: false},
function(stream){
$scope.stream = stream;
},
function(err){
console.log('error');
});
This function converts a blob into a url that you can pass to a video ng-src. It also converts it into a trusted source using Angular's $sce
service.
RtcPeer is a wrapper for PeerConnection, SessionDescription and IceCandidate Apis.
more docs coming