face-api.js
face-api.js copied to clipboard
Web Worker on Android / IOS WebView
Is there any way to make it work in Web Worker on Android / IOS WebView ? I able to implement it in browser using offscreencanvas and it worked perfectly. When I build the app using capacitor I'm getting undefined offscreencanvas function error. After further research, webview doesn't support offscreencanvas and capacitor doesn't allow changing of default webview.
Thanks
I'm trying to do the same using WebView Component, but I'm stuck at getting camera permission with WebView (I'm experimenting to use face-api.js within a WebView by setting WebView source prop as my webapp but I can't get permission to use camera). Have you managed to get camera permission from WebView? Thanks in advance.
#47 documents successful use of WebViews - however, here's how I do it:
- Capture camera in UI thread, show in a
<video>
element - Set a timeout every X ms to render the
<video>
into a<canvas>
that is hidden - Do
.getImageData
on canvas, post that via transfer lists to the web worker - WebWorker does all the face api detection
- WebWorker posts a message back to UI thread with the detected results
#47 documents an overlay canvas for rendering the views too - definitely works great. I get about 12-20fps detection, while the UI thread stays buttery smooth rendering live <video>
@rlaurente Do you solve your problem?