如何在角度8中定义JitsiMeetExternalAPI

时间:2020-04-27 08:43:33

标签: javascript css angular jitsi jitsi-meet

我正在使用jisti应用程序在角度8中实现视频通话,我不了解JitsiMeetExternalAPI如何定义它。请为此提供帮助。(正在出现错误TS2304:找不到名称“ JitsiMeetExternalAPI”。)

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,并通过指向angular.json中的脚本来解决,如下所示...

"scripts": ["src/vendor/jitsi/external_api.js"]

我必须下载https://meet.jit.si/external_api.js脚本并将其复制到我的角度代码的“ src / vendor / jitsi”目录中。

答案 1 :(得分:0)

只需将此行添加到 app.component.ts。

declare var JitsiMeetExternalAPI: any;

就我而言,它运行良好。

最后,代码看起来像这样。

import { Component, AfterViewInit } from '@angular/core';
import '../vendor/jitsi/external_api.js';

declare var JitsiMeetExternalAPI: any;

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'sidenav';
  domain: string = "meet.jit.si";
  options: any;
  api: any;

  constructor() {
  }

  ngAfterViewInit(): void {

    this.options = {
      roomName: "JitsiMeetAPIExample",
      width: 700,
      height: 700,
      parentNode: document.querySelector('#meet')
    }

    this.api = new JitsiMeetExternalAPI(this.domain, this.options);
  }
}