simplewebrtc / SimpleWebRTC

Simplest WebRTC ever
Other
4.65k stars 1.19k forks source link

EXCEPTION: TypeError: this.webrtc.joinRoom is not a function #447

Closed giangdhwhtbr closed 7 years ago

giangdhwhtbr commented 8 years ago

Hi, I tried to use the SimpleWebRTC to make the simple demo in angular2.

import {Component,OnInit} from '@angular/core';
  import * as SimpleWebRTC from '../shared/js/simple-wrtc.js';
  @Component({
    selector: 'demo',
    template: `
        <video height="300" id="localVideo"></video>
        <div id="remotesVideos"></div>
      `
  })
  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 {
      this.webrtc.on('readyToCall', function () {
        // you can name it anything
        this.webrtc.joinRoom('your awesome room name');
      });
    }
  }

When I run the app, the function joinRoom not work, can you help me?

mostafiz93 commented 7 years ago

Hi, could you find any solution for this? I'm working on ReactJS to do the same thing, but getting the same error.

fippo commented 7 years ago

basic debugging... Does this.webrtc have a joinRoom function? No. Try webrtc.joinRoom.