webRTC IOS 11.4 and 12.1 facebook Instant Games

Hey guys… I have been building a game using WebRTC using only the data channel…

I have a great working version, I’m really excited to show you all and get it launched!

My issue is this…

I cannot get createOffer to work in the following specific environment…
IOS 12.1 in a cocos creator built Facebook Instant game.

you can see from this js fiddle that the code works in IOS 12.1 https://jsfiddle.net/s7cLtdva/
If i put the code into a cocos creator Facebook instant game build, then it doesnt work. There is a silent failure. the code doesn’t execute is what it looks like, but i’m sure its just failing silently.

Here is the offending code snippet taken out of my game and put into a simple hello world project.

cc.Class({
extends: cc.Component,

properties: {
    label: {
        default: null,
        type: cc.Label
    },
    // defaults, set visually when attaching this script to the Canvas
    text: 'Hello, World!'
},

// use this for initialization
onLoad: function () {
	
	
var configuration = { 
"iceServers": [
	{ urls: "stun:stun.l.google.com:19302"}
] 
};
	
	var myConnection = new RTCPeerConnection(configuration);
	var self = this;
	
	self.label.string = "im started";		
	
	try {
	
	 myConnection.createOffer(function (offer) { 
	 
		self.label.string = "The offer works";
	
	},function (error) { 
			 self.label.string = "function error";
	
	});
	
	}catch(e){
		 self.label.string = "caght error ";
	}
	
	
	
    
 },

// called every frame
update: function (dt) {

},
});

So to recap;

It works fine on IOS 11.4 using cocos creator facebook instant game build in both safari and facebook messenger. This code also works in IOS 12.1 in safari but when i build it for Facebook instant games then it doesn’t work only on IOS 12.1 as i say it works in 11.4.

So what im saying is, i know the code works… It just doesn’t work specifically after building for facebook Instant Games only in IOS 12.1… it works in safari on ios 12.1 but not messenger. It works on messenger and safari in IOS 11.4

What could be effecting this in cocos creator? Does anyone have any ideas how i can try to debug what is actually going on here. I know that the createOffer function is the problem. It 100% isn’t firing.

This is killing me please please help!!!

Simply add https://webrtc.github.io/adapter/adapter-latest.js to the build and it works perfectly. Strangely the connection on IOS 12 is not as good as the connection on IOS 11.4 but i don’t care as it works good enough to play the game!!!