When will Kotlin/JS have the RTCPeerConnection classes and functions available?
m
When will Kotlin/JS have the RTCPeerConnection classes and functions available?
b
Is that some native nodejs API?
m
No, it’s browser and it’s available without any dependencies
b
P.S. You can use them now with your own external declarations. Just because kotlin.js can't see them does not mean they're not there.
e.g.
Copy code
external class RTCPeerConnection()
m
pic attached
I’ve managed to instantiate items using the js(“code”) workaround, but I’d like to get an automated way of getting the thing typed
Tried Dukat but had no luck
b
Dukat does not see web APIs
You have to declare your own externals or use dynamic types
m
It can through your dependencies:
Copy code
implementation(npm("@types/webrtc", "0.0.30", generateExternals=true))
Although no way I could import anything of the generated under
build/externals
b
Why can't you import them? What's the error/issue?
m
I managed to import them but it’s transpiled as an interface complaining that there are no constructors
image.png
b
Are you sure it has a constructor on js? It might be something produced by factory functions only
m
image.png
I might be missing something but terminal autocompletes the “constructor” field as well
b
Then it's a bug with dukat. Declare your own external with constructor
👍 2
m
Thanks!
e
if webrtc has a IDL, try using the kotlinx.browser generator
although it still uses dukat at some point, so if the issue is there instead of in the
@types/webrtc
definitions, then that may not help
m
What’s IDL?
e
interface definition language, almost all web interfaces use it
according to https://www.w3.org/wiki/Web_IDL#Dependent_Specifications webrtc is also defined in idl
🙏 1