PS - looking at the typings definitions for webrtc (not SimpleWebRTC), it looks like everything is global and not part of a module. Maybe SimpleWebRTC has the same issue, in which case, you would need to add the script to the head section of your HTML and then reference the global SimpleWebRTC class.
On Mon, Jun 13, 2016 at 1:26 PM, Lucas Lacroix <[email protected]> wrote: > Based purely on a guess, it looks like SimpleWebRTC.js is not using a > compatible package system. This would explain why the this.webrtc member is > different from what you'd expect of an instance of the SimpleWebRTC class. > > For example, if your tsconfig.json says "module: system" and SimpleWebRTC > exposes a CommonJS module. > > > > On Mon, Jun 13, 2016 at 11:09 AM, Do Giang <[email protected]> wrote: > >> Ah Yes, When I run the code, I got the error: >> >> >> <https://lh3.googleusercontent.com/-6me4VNq45Ss/V17Lva6dm_I/AAAAAAAABZk/55Vpws5Iiv4Xjgvhx_imX19_bhGqLB5WQCLcB/s1600/Screen%2BShot%2B2016-06-13%2Bat%2B10.05.09%2BPM.png> >> >> I use the debug mode from chrome: >> >> >> <https://lh3.googleusercontent.com/-FTDBbWQkzvk/V17MVaCLrkI/AAAAAAAABZ0/7y1iFV_bXQ8xyDdQx9lu2RuM-4SBAXR_ACLcB/s1600/Screen%2BShot%2B2016-06-13%2Bat%2B10.07.40%2BPM.png> >> I don't know why. Because when try the code using native javascript, It >> work. >> >> >> On Monday, June 13, 2016 at 9:52:46 PM UTC+7, Lucas Lacroix wrote: >>> >>> You still haven't said what the issue you're seeing is. >>> >>> On Mon, Jun 13, 2016 at 10:50 AM, Do Giang <[email protected]> wrote: >>> >>>> Oh I post wrong code and try to delete it. This one is my code: >>>> I try the demo from this site: https://simplewebrtc.com >>>> >>>> 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'); >>>> }); >>>> } >>>> } >>>> >>>> >>>> >>>> >>>> On Monday, June 13, 2016 at 9:46:58 PM UTC+7, Lucas Lacroix wrote: >>>>> >>>>> Could you give some details on the issue you're seeing? >>>>> >>>>> On Mon, Jun 13, 2016 at 10:44 AM, Do Giang <[email protected]> wrote: >>>>> >>>>>> 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 [email protected]. >>>>>> To post to this group, send email to [email protected]. >>>>>> Visit this group at https://groups.google.com/group/angular. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Lucas Lacroix >>>>> Computer Scientist >>>>> System Technology Division, MEDITECH <http://ehr.meditech.com> >>>>> 781-774-2293 >>>>> >>>> -- >>>> 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 [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at https://groups.google.com/group/angular. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> Lucas Lacroix >>> Computer Scientist >>> System Technology Division, MEDITECH <http://ehr.meditech.com> >>> 781-774-2293 >>> >> -- >> 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 [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Lucas Lacroix > Computer Scientist > System Technology Division, MEDITECH <http://ehr.meditech.com> > 781-774-2293 > -- Lucas Lacroix Computer Scientist System Technology Division, MEDITECH <http://ehr.meditech.com> 781-774-2293 -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
