Threepwood's Forum Posts

  • 2 posts
  • Per developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState the "disconnected" state can trigger intermittently and resolve on its own. However, c2mp-peer.js lumps that state together with a failure:

    else if (self.pc.iceConnectionState === "disconnected" || self.pc.iceConnectionState === "failed" || self.pc.iceConnectionState === "closed")

    So, state changes to "disconnected" can trigger pre-mature disconnects. "Failed" and "closed" cover the cases where we'd want to explicitly disconnect, so it should be safe to simply ignore the "disconnected" state change:

    else if (self.pc.iceConnectionState === "failed" || self.pc.iceConnectionState === "closed")

    Firefox seems to change the iceConnectionState to "disconnected" much more frequently than Chrome. Making the change above has resulted in a lot more stable connections with Firefox.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • On the latest Safari (Safari 12), multiplayer only works if you enable "Legacy API" (Develop->WebRTC->Enable Legacy WebRTC API).

    It seems that Apple has decided to get rid of the callback-based API within RTCPeerConnection and replaced it with a promise-based API instead.

    From webkit.org/blog/7763/a-closer-look-into-webrtc/:

    Through the WebRTC standardization process, the RTCPeerConnection API progressively improved in various ways. Initially callback-based, the API changed to being fully promise-based. API initially focused on MediaStream moved to MediaStreamTrack. Thanks to the upstream effort by the WebRTC in WebKit team, the RTCPeerConnection API was aligned with these two major changes.

    We have turned the legacy WebRTC APIs off by default on Safari Technology Preview 34, and plan to ship Safari 11 on macOS High Sierra and iOS 11 without these APIs. Keeping the legacy API around limits our ability to move forward faster on WebRTC. Any website looking to bring support to Safari may need to make other adjustments, so this is as good a time as ever to move away from these legacy APIs. Existing websites may still rely on these legacy APIs, which you can check by turning on “Enable Legacy WebRTC API” in the Develop > WebRTC menu.

  • 2 posts