Unity Editor version: 2022.3.1f1
Unity package version: 1.8.0
ML2 OS version: 1.3.0-dev2
MLSDK version: 1.3.0-dev2
We are currently blocked on com.unity.webrtc
not working at this MLSDK version, so I decided to try the MLWebRTC
API. The C# bindings are all still available, but it seems the native code DLL could not be found.
I have been experimenting with the MLWebRTC.PeerConnection.CreateRemote()
call because it is the first call into the WebRTC library in our scenario. The sample code in github.com/magicleap/MagicLeapUnityExamples:MLWebRTCExample@v1.8.0, when run on the headset, produces a non-null connection and result.IsOk
. The same call run in the simulator produces a NotImplementedException
, which I presume is expected behaviour.
When I attempt the same CreateRemote()
call in our app, there is a managed code NullReferenceException
that is proceeded by this message:
webrtc DLL not found
2023-07-28 14:58:24.397 28752 28774 Error Unity DllNotFoundException:
Unable to load DLL 'webrtc'. Tried the load the following dynamic libraries:
Unable to load dynamic library 'webrtc' because of 'Failed to open the
requested dynamic library (0x06000000) dlerror() = dlopen failed: library "webrtc" not found
Then the NullReferenceException
System.NullReferenceException: Object reference not set to an instance of an object.
at UnityEngine._AndroidJNIHelper.GetSignature (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine._AndroidJNIHelper.GetSignature[ReturnType] (System.Object args) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine._AndroidJNIHelper.GetMethodID[ReturnType] (System.IntPtr jclass, System.String methodName, System.Object args, System.Boolean isStatic) [0x00000] in <0000000000000000000000000
at UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.String methodName, System.Object args) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.MagicLeap.MLPermissions.CheckPermissionInternal (System.String permission) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.MagicLeap.MLPermissions.CheckPermission (System.String permission) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.MagicLeap.MLWebRTC+PeerConnection.CreateRemote (UnityEngine.XR.MagicLeap.MLWebRTC+IceServer iceServers, UnityEngine.XR.MagicLeap.MLResult& result) [0x00000] in <00000000000
at Assets.RemoteSpark.Scripts.WebRTC.ML.MLPeerConnection..ctor (KSpark.Telemetry.KSparkLogger logger) [0x00000] in <00000000000000000000000000000000>:0
at Assets.RemoteSpark.Scripts.WebRTC.ML.MLWebRTCProvider.CreatePeerConnection () [0x00000] in <00000000000000000000000000000000>:0
[... snip ...]
We have been comparing the failing code in our app to the successful sample code, but cannot find the cause. It seems like it must be a project setup detail, but I'm just guessing. Do you have any advice for what might cause this, or how to investigate further?