PeerConnection升级为0

时间:2019-01-14 14:21:28

标签: opentok tokbox

我的问题出在tokbox上,当新发布者进入会议室时,我收到一条错误消息。这是控制台中当前发布者正在显示的消息:

PeerConnection升级为0

他正确地看到了没有看到他的新出版商


Bonjour

周一到周五,新书发行商Rentre dans la room。语音留言dans la console qu'affiche le发行人déjàprésent:

PeerConnection升级为0

发行新书的法院修正案

initSession (session) {
    return new Promise((resolve, reject) => {
      this.sessionId = session.sessionId
      this.token = session.token
      this.session = OT.initSession(process.env.TOKBOX_API_KEY, this.sessionId)

      this.session.connect(this.token, (err) => {
        if (err) {
          return reject(err)
        }

        return resolve()
      })
    })
}

this.$tokbox.initSession(this.$store.state.session)
      .then(() => this.$store.commit('session/inRoom', true))
      .catch((err) => this.$store.commit('log/addError', err.message))

this.$tokbox.session.on({
      streamCreated: (event) => {
        if (typeof this.streamsByUser[event.stream.name] === 'undefined') {
          this.streamsByUser[event.stream.name] = {
            key: event.stream.name + '-' + Date.now(),
            thumbnail: this.$enums.tokbox.CAMERA,
            camera: null,
            screen: null
          }
        }
        this.streamsByUser[event.stream.name][event.stream.videoType] = event.stream
        this.ObjectToArray()
      },
      streamDestroyed: (event) => {
        this.streamsByUser[event.stream.name][event.stream.videoType] = null
        this.ObjectToArray()
      }
    })

ObjectToArray () {
  this.streams = []
  for (const key in this.streamsByUser) {
    if (this.streamsByUser.hasOwnProperty(key)) {
      if (!this.streamsByUser[key].camera && !this.streamsByUser[key].screen) break

      if (this.streamsByUser[key].camera && !this.streamsByUser[key].screen) {
        this.streamsByUser[key].thumbnail = this.$enums.tokbox.SCREEN
      } else if (!this.streamsByUser[key].camera && this.streamsByUser[key].screen) {
        this.streamsByUser[key].thumbnail = this.$enums.tokbox.CAMERA
      } else {
        this.streamsByUser[key].thumbnail = this.streamsByUser[key].camera.creationTime > this.streamsByUser[key].screen.creationTime
          ? this.$enums.tokbox.CAMERA
          : this.$enums.tokbox.SCREEN
      }

      this.streams.push(this.streamsByUser[key])
    }
  }
}

initPublisher (type, opts) {
  this.publisher[type] = OT.initPublisher(type, opts, (err) => {
    if (err) {
      return this.$store.commit('log/addError', err)
    }

    return this.$emit('publisherCompleted')
  })

  this.publisher[type].on('destroyed', () => {
    if (this.interval && type === this.$enums.tokbox.SHARE) {
      clearInterval(this.interval)
      this.interval = null
    }
    this.publisher[type] = null
  })

  if (this.$tokbox.session) {
    if (this.$tokbox.session.isConnected()) {
      this.publishHandler(type)
    }

    this.$tokbox.session.on('sessionConnected', () => this.publishHandler(type))
  }
},
publishHandler (type) {
  this.$tokbox.session.publish(this.publisher[type], (err) => {
    if (err) {
      return this.$store.commit('log/addError', err)
    }

    return this.$emit('publisherConnected', this.publisher)
  })
}

0 个答案:

没有答案