mobile CCTV,mobile surveillance,police body worn cameras

 forgetPW
 registerNow
search
view: 865|reply: 1
打印 prevThread nextThread

Chrome浏览器对讲的问题

[copyURL]

6

主题

408

帖子

1618

积分

vipMem

Rank: 6Rank: 6

积分
1618
jumpTo
owner
poston 2020-4-8 19:45 | authorOnly 回帖奖励 |倒序浏览 |阅读模式
对讲功能,我开开发文档上面的demo是可以实现的,但是我按照demo些的代码,不行,只听到头盔发出“嘀”的一声,但是页面就上面没有图像和声音,浏览器控制台没有报错,我用的谷歌浏览器,请问,对讲有哪些需要注意的地方?相关代码如下:
this.session = new jSW.SWSession({
      server: '127.0.0.1',
      port: 9701,
      onopen(sess: any) {
        sess.swLogin({ user: `${credentials.username}`, password: `${credentials.password}` });
      }
    });

// 登录回调
    this.session.swAddCallBack('login', (sender: any, event: any, json: any) => {
      if (json.code === jSW.RcCode.RC_CODE_S_OK) {
      } else {
        this.logger.info(`账户或密码错误`);
      }
    });

    // 获取设备列表回调
    this.session.swAddCallBack('pulist', (sender: any, event: any, json: any) => {
      if (json.code === jSW.RcCode.RC_CODE_S_OK) {
        this.puList = this.session._arr_pu;
        this.puList.forEach((item: any) => {
          const random = Math.random();
          item.random = random;
          this.showdomList.push({ isHave: false, _id_pu: item._id_pu, domId: `dom${random}`, random })
        });

        console.log('this.puList:', this.puList);
      }
    });
const m_media = (jSW.MEDIADIR.AUDIOSEND) + (jSW.MEDIADIR.AUDIORECV);

const result = chanel.swOpenEx({
        tag: this,
        div: _this.getDomId(),
        ismuti: true,  // 设置可以被打开多次,
        prototype: 'auto',
        bovertcp: true,
        media: m_media,
        callback(options: any, response: any, event: any) {

          const pthis = options.tag;
          const code = response.emms.code;

          if (code === 0) { // code === 0 成功
            item.isOpen = true;
            _this.addMediaToShowdomList(item, event.hdlg); // 唯一标识该路播放的句柄(关闭设备时需传入)

            // 获取url
            item.url = pthis.session.swGetPuChanel(`${item._id_pu}`, 0).swGetUrl();
            _this.removeFlag();
          } else if (code === 20106) {
            _this.emptySpaceDomId();
            _this.logger.info(`${item._name_pu} 未连接!`);
          }
        },
      });
reply

使用道具 report

6

主题

408

帖子

1618

积分

vipMem

Rank: 6Rank: 6

积分
1618
sofa
 Owner| poston 2020-4-8 19:49 | authorOnly
您好,需要等到获取设备列表成功之后,才能打开对讲。
等到pulist事件成功,再调用。
reply agree Against

使用道具 report

creditRule

QQ|wireless surveillance

GMT+8, 2024-5-17 08:36 , Processed in 0.057613 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

QuickReply backToTop BackToList