I am working on a webrtc comminucation app, as part of this app I need to make changes (resize, change background, blue background ,...) to the webcam image before sending it to the subscribers ...
This is my solution for now :
1 - set stream to a in memory video element
2 - when play starts start a loop with settimeout to repeat No.3
3 - render video on canvas
4 - capture canvas stream
So far so good.
But when the tab is inactive/hidden/invisible the settimeout is throttled to 1 loop per second :( ...
Only other solution I have found is to use MediaStreamTrackProcessor
, It works but lacks the browser support that I need (Firefox, Safari,...)
I tried using webworkers but can't sent a stream to worker and can't capture a stream inside a worker neither :(
So Any way to send MediaStream or its frames(continuously) to webworker ? Or Is there anyway (cross browser) to get frames from MediaStream continuously(so I won't need settimeout) ?