videokit-ai / videokit

Low-code, cross-platform media SDK for Unity Engine. Register at https://videokit.ai
https://videokit.ai
Apache License 2.0
107 stars 14 forks source link

NDSetSessionToken error #26

Closed tomaszwozniak123 closed 1 year ago

tomaszwozniak123 commented 1 year ago

Hi, I have 3 testers on the team; one is testing our application daily. Two other testers were testing last time our application about a week ago. In the meantime, we updated nat VifeoKit to 0.0.13. Those two testers get error as shown below. Both of the testers cleared the browser cache and only for one it was a solution. We are using NatML VideoKit and Natml Meet Segmentation for WebGL Unity.

TypeError: navigator.mediaDevices is undefined
7565410@http://myapplication.cloudfront.net/Build/Build013.framework.js:1304:21
_emscripten_asm_const_int@http://myapplication.cloudfront.net/Build/Build013.framework.js:13143:26
NDSetSessionToken@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[16881]:0x42be0a
NatDevice_SetSessionToken_mF84DD814AB106B6E48603805BA3973F6F00ADCF7@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[17321]:0x440075
MediaDeviceQuery_OnInitialize_m37E36832EFD39CC3C4951D728FBEA07BFEB1020F@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[17320]:0x440066
RuntimeInvoker_FalseVoid_t4861ACF8F4594C3437BB48B6E56783494B843915(void (*)(), MethodInfo const*, void*, void**, void*)@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[108837]:0x1bb8511
il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**)@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[109321]:0x1bc479e
dynCall_iiii@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[134557]:0x295ae14
unityFramework/createExportWrapper/<@http://myapplication.cloudfront.net/Build/Build013.framework.js:1142:20
invoke_iiii@http://myapplication.cloudfront.net/Build/Build013.framework.js:22798:10
il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[109295]:0x1bc3c5c
il2cpp_runtime_invoke@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[109365]:0x1bc62cb
scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[133654]:0x290fe58
ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[131629]:0x287a2fb
RuntimeInitializeOnLoadManager::ExecuteInitializeOnLoad(RuntimeInitializeLoadType)@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[134083]:0x29363d7
RuntimeInitializeAfterAssembliesLoaded()@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[134081]:0x29360fc
CallbackArray::Invoke()@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[134095]:0x29376f2
main@http://myapplication.cloudfront.net/Build/Build013.wasm:wasm-function[129141]:0x2728f15
unityFramework/createExportWrapper/<@http://myapplication.cloudfront.net/Build/Build013.framework.js:1142:20
callMain@http://myapplication.cloudfront.net/Build/Build013.framework.js:25692:26
doRun@http://myapplication.cloudfront.net/Build/Build013.framework.js:25735:29
run@http://myapplication.cloudfront.net/Build/Build013.framework.js:25747:3
runCaller@http://myapplication.cloudfront.net/Build/Build013.framework.js:25675:18
removeRunDependency@http://myapplication.cloudfront.net/Build/Build013.framework.js:1097:4
createUnityInstance/loadBuild/</<@http://myapplication.cloudfront.net/Build/Build013.loader.js:1104:16
olokobayusuf commented 1 year ago

This error isn't actually caused by the token; it's a side effect of the function that pre-loads available media devices. What browsers are your testers using? And are you running in a secure context (i.e. serving over https or localhost)? The logs seem to indicate that you're stumbling over the latter:

7565410@http://myapplication.cloudfront.net/Build/Build013.framework.js:1304:21

If you need test WebGL deployments, let me know if you'd be interested in using NatML. We offer free Unity WebGL hosting for our demos.

tomaszwozniak123 commented 1 year ago

Our testers are using browsers: Mozilla Firefox v: 112.0.1 Chrome Safari

We use cloudfront environment for tests only currently with supported HTTP versions HTTP/2, HTTP/1.1, HTTP/1.0. Do you think that could be the reason?

olokobayusuf commented 1 year ago

My comment wasn't about HTTP versions; it was about being in a secure context. In simple terms, your URL should begin with https:// instead of http://.

tomaszwozniak123 commented 1 year ago

I think in this log we have http://myapplication.cloudfront.net/ instead of https, because the application didn't start yet fully (or sth like that - I am really guessing only). Our domain is https://myapplication.cloudfront.net/

olokobayusuf commented 1 year ago

Just so we're on the same page, can you share a screenshot of the URL bar in your browser when running your WebGL application?

tomaszwozniak123 commented 1 year ago

Sure: image

olokobayusuf commented 1 year ago

@tomaszwozniak123 what device and OS versions are your users on? navigator.mediaDevices being undefined isn't a NatDevice bug; it indicates that the browser that your app is running in is not providing access to media devices. The most common reason for this is when your app is running in an insecure context.