Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'icecandidate' event not firing in IE 11 #297

Open
vanelizarov opened this issue Dec 27, 2017 · 1 comment
Open

'icecandidate' event not firing in IE 11 #297

vanelizarov opened this issue Dec 27, 2017 · 1 comment

Comments

@vanelizarov
Copy link

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

@johache
Copy link
Contributor

johache commented Jan 3, 2018

Hi, you have a working example here : https://plugin.temasys.io/demo/src/content/peerconnection/pc1/
Your code looks fine to me. Can you try setting the event listener before calling createOffer ?
There is a chance the candidates are thrown before you have time to set the listener.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants