hraban / opus

Go wrapper for libopus (golang)
MIT License
275 stars 59 forks source link

wasm env #53

Closed Modestying closed 8 months ago

Modestying commented 8 months ago

I need to do: pcm->opus with wasm,which seems not support now and hard in golang plans https://github.com/golang/go/issues/40543 (maybe i miread?)

[root@localhost wasm_demo]# CGO_ENABLED=1 GOOS=js GOARCH=wasm go build -o hello.wasm -tags nolibopusfile cmd/03-js-call-go/main.go 
# runtime/cgo
cgo: unknown ptrSize for $GOARCH "wasm"

can i get some suggestions,thx

hraban commented 8 months ago

You almost certainly want the original opus C library, not this thin Go <-> C wrapper. I don't know wasm but I did opus in asm.js once upon a time and this library (hraban/opus) was only useful on the server side, where I used Go. On the client I used asm.js, so I had to compile the original C library using emscripten. I'm assuming it will be similar for wasm.

hraban commented 8 months ago

Feel free to reopen with more info & context if you think I misunderstood the state of wasm