godotengine / webrtc-native

The official GDNative WebRTC implementation for non-html exports.
MIT License
198 stars 27 forks source link

Error when exporting for Web: No suitable library found for GDExtension #136

Closed southpaw-decoy closed 5 months ago

southpaw-decoy commented 5 months ago

Godot version

4.2.1 stable official [b09f793f5]

Plugin version

1.0.5

System information

Windows 10 22H2

Issue description

When trying to run a project including the WebRTC extension, there is an error in the godot console and the project does not work properly.

Error: No suitable library found for GDExtension: res://webrtc/webrtc.gdextension. Possible feature flags for your platform: web, s3tc, wasm32, template, debug, template_debug

This works in the editor when clicking run project instead of run in browser. It also works when exported to windows .exe

Steps to reproduce

Install the export templates from the editor export screen. click run in browser. You will see the error in the editor console and project does not run as expected when using WebRTC features. Tried in Firefox and Chrome.

Minimal reproduction project

Issue happens in the Signaling demo. https://github.com/godotengine/godot-demo-projects/tree/4.0/networking/webrtc_signaling

Faless commented 5 months ago

You can safely ignore the error on export.

The web platform does not need the plugin because the implementation is part of Godot itself (part of its JS support code).

For this reason, the plugin does not include a library for it, and the export process complain about it. There is currently no way to tell Godot that's expected, and that is shouldn't print the error.

southpaw-decoy commented 5 months ago

Update 2

If anyone finds this later, I think my problem may have been https anywhere preventing the communication. I was able to disable it in chrome to get my project to work properly.

UPDATE; Using the demo project, I was able to connect to my custom WebRTC server over the internet. It appears the issue was hosting the WebRTC server in the browser which may not be possible. Feel free to close this issue if that is the case. I would like to know if it is possible to host the WebRTC server in a web exported game.

I must have doing something wrong on my game when it wouldn't work at home and then I tried the Signaling Demo before posting this issue.

old comment :

on a different computer, I downloaded Godot 4.2.1, then downloaded the demo projects and imported the WebRTC Signaling Demo. When adding trying from the editor Run in browser, the game does not work. I get these errors in the browser (Chrome). I then click listen, then start.

The game displays this :

[Signaling] Server disconnected: 1006 -

I get these errors in the browser development tools console (Chrome):

Godot Engine v4.2.1.stable.official.b09f793f5 - https://godotengine.org tmp_js_export.js:5713 WebGL: this extension has very low support on mobile devices; do not rely on it for rendering effects: WEBGL_polygon_mode (anonymous) @ tmp_js_export.js:5713 tmp_js_export.js:14035 OpenGL API OpenGL ES 3.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium)) - Compatibility - Using Device: WebKit - WebKit WebGL tmp_js_export.js:14050 USER WARNING: Invalid mix rate of 0, consider reassigning setting 'audio/driver/mix_rate'. onPrintError @ tmp_js_export.js:14050 tmp_js_export.js:14050 Defaulting mix rate to value 44100. onPrintError @ tmp_js_export.js:14050 tmp_js_export.js:14050 at: _get_configured_mix_rate (servers/audio_server.cpp:126) onPrintError @ tmp_js_export.js:14050 tmp_js_export.js:8814 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu init @ tmp_js_export.js:8814 tmp_js_export.js:14035
tmp_js_export.js:14050 Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread onPrintError @ tmp_js_export.js:14050 tmp_js_export.js:6503 warning: unsupported syscall: __syscall_setsockopt

_emscripten_console_error @ tmp_js_export.js:6503 tmp_js_export.js:14050 USER WARNING: Unable to change IPv4 address mapping over IPv6 option onPrintError @ tmp_js_export.js:14050 tmp_js_export.js:14050 at: set_ipv6_only_enabled (drivers/unix/net_socket_posix.cpp:698) onPrintError @ tmp_js_export.js:14050 tmp_js_export.js:6503 warning: unsupported syscall: __syscall_setsockopt

_emscripten_console_error @ tmp_js_export.js:6503 tmp_js_export.js:14050 USER WARNING: Unable to set socket REUSEADDR option! onPrintError @ tmp_js_export.js:14050 tmp_js_export.js:14050 at: set_reuse_address_enabled (drivers/unix/net_socket_posix.cpp:720) onPrintError @ tmp_js_export.js:14050 tmp_js_export.js:11187 WebSocket connection to 'ws://localhost:9080/' failed: _godot_js_websocket_create @ tmp_js_export.js:11187 tmp_js_export.js:14035 Disconnected: 1006: tmp_js_export.js:14035 [Signaling] Server disconnected: 1006 - 17tmp_js_export.js:14050 Output buffer has not enough frames! Skipping output frame.

Faless commented 5 months ago

Indeed, creating a WebSocket server is not supported on the Web because browsers do not allow it.

You can only create WebSocket clients in browsers.

We had a check to hide the "Listen" button when running on the Web, but the check was not updated to reflect the new platform name (Web vs HTML5).

I've opened a PR in the demo project to fix the check and correctly hide the listen button: https://github.com/godotengine/godot-demo-projects/pull/1015