I and my team decide to build our capstone project using NodeJS, Angular 2 and WebRTC. Now we have a problem that we can't use WebRTC Libraries in the Angular 2 App. I tried the simple demo from simpleWebRTC:--import { Component } from '@angular/core';
import { ROUTER_DIRECTIVES, Routes, Router} from '@angular/router';
import { RouteConfig, RouterLink} from '@angular/router-deprecated';
import { AuthService } from '../../../dashboard/services/auth-services';
@Component({
selector: 'header',
templateUrl: 'client/dev/kshare/templates/shared/header.html',
styleUrls: ['client/dev/kshare/styles/header.css'],
directives: [ROUTER_DIRECTIVES]
})
export class HeaderComponent {
loginToken:boolean = false;
userToken:string;
roleToken:string;
constructor(private _auth: AuthService, public router: Router){
this.userToken = localStorage.getItem('username');
this.roleToken = localStorage.getItem('role');
}
ngOnInit(): void {
if(this.userToken){
this.loginToken = true;
}
}
logout(): void {
this._auth.logout();
this._auth.logoutClient();
window.location.reload();
}
}
Can anyone help us? We are so appreciate :)
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
import {Component,OnInit} from '@angular/core';
import * as SimpleWebRTC from '../demo/simplewebrtc.js';
@Component({
selector: 'demo',
template: `
<video height="300" id="localVideo"></video>
<div id="remotesVideos"></div>
`,
styleUrls: ['client/dev/demo/easyrtc.css'],
})
export class DemoComponent {
webrtc = new SimpleWebRTC({
// the id/element dom element that will hold "our" video
localVideoEl: 'localVideo',
// the id/element dom element that will hold remote videos
remoteVideosEl: 'remotesVideos',
// immediately ask for camera access
autoRequestMedia: true
});
ngOnInit():void {
// we have to wait until it's ready
this.webrtc.on('readyToCall', function () {
// you can name it anything
this.webrtc.joinRoom('your awesome room name');
});
}
}