Skip to content

'icecandidate' event not firing in IE 11 #297

@vanelizarov

Description

@vanelizarov

I'm submitting a...


[x] Bug report  

Current behavior

In Internet Explorer, when attaching event listener to icecandidate event or setting onicecandidate property directly, event is not firing. In Chrome it works perfectly.

Expected behavior

icecandidate event fires in IE 11

Code

import { webRTCReady, addEvent } from 'adapterjs'

function initWebRTC(): Promise<boolean> {
  return new Promise(resolve => {
    webRTCReady((isPluginReady: boolean) => resolve(isPluginReady))
  })
}

function getURL(): Promise<string> {
    return new Promise<string>(resolve => {
      const ConnectionCtor = (
        window.RTCPeerConnection ||
        (<any>window).mozRTCPeerConnection ||
        (<any>window).webkitRTCPeerConnection
      )

      const connection = new ConnectionCtor({
        iceServers: []
      })

      const noop = function () { }
      const ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/

      connection.createDataChannel('')
      connection.createOffer(
        connection.setLocalDescription.bind(connection),
        noop
      )

      function gotIceCandidate(ice) {
        if (!ice || !ice.candidate || !ice.candidate.candidate) {
          return
        }

        const ip = ipRegex.exec(ice.candidate.candidate)[1]
        resolve(`ws://${ip}:8888`)

        connection.onicecandidate = noop
      }

      // connection.onicecandidate = gotIceCandidate

      addEvent(connection, 'icecandidate', gotIceCandidate)
    })
}

await initWebRTC()
const url = await getURL()

// ...

Environment


AdapterJS version: 0.15.0

Browser:
- IE version 11
 
For Tooling issues:
- Node version: 8.4.0 
- Typescript version: 2.5.3
- Platform:  Windows 8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions