I'm trying to use Element2 to create a WebRTC connection.
In the elemental2.dom.RTCPeerConnection class, there are a bunch of createOffer and createAnswer methods that all return Promise<RTCSessionDescription>.
If I try to use them, I get a ClassCastException. This is because GWT is trying to create the RTCSessionDescription from the JS object, and it can't.
I believe all these createOffer and createAnswer methods should be returning Promise<RTCSessionDescriptionInit> instead.
For reference, this is the Element2 RTCSessionDescription:
package elemental2.dom;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public class RTCSessionDescription {
public String sdp;
public String type;
public RTCSessionDescription() {}
public RTCSessionDescription(RTCSessionDescriptionInit descriptionInitDict) {}
}
And this is the Element2 RTCSessionDescriptionInit:
package elemental2.dom;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import jsinterop.base.Js;
import jsinterop.base.JsPropertyMap;
@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public interface RTCSessionDescriptionInit {
@JsOverlay
static RTCSessionDescriptionInit create() {
return Js.uncheckedCast(JsPropertyMap.of());
}
@JsProperty
String getSdp();
@JsProperty
String getType();
@JsProperty
void setSdp(String sdp);
@JsProperty
void setType(String type);
}
Is it somehow possible to fix up Elemental2 createOffer and createAnswer methods?