In the HTML5 / JS web interface, it is possible to view the webcam and / or client’s desktop. The frame rate is different - for the camera 20 frames per second (50 ms delay), for the desktop 500 ms - 2 frames per second. If you broadcast the camera separately, everything is OK - we have 20 frames, but it is worth including simultaneous broadcasting, so the frame rate of the camera becomes equal to the desktop frame rate, even if the onload functions are different. Here is the code for clarity:
function RefreshFrame(){ var Delay = (this.name==='Camera')?50:500; var Hold = GetTickCount(); // function GetTickCount(){return new Date().getTime();} while(Hold + Delay > GetTickCount()){continue;} this.src = TargetURN+'?'+this.name+'='+Data+"&time="+Hold; } function SetDevice(Object, Switch){ if (Switch){ Object.onload = RefreshFrame; Object.onerror = RefreshFrame; Object.src = TargetURN+'?'+Object.name+'='+Data+'&time='+GetTickCount(); Object.style.display = 'block'; } else{ Object.onload = null; Object.onerror = null; Object.style.display = 'none'; Object.src = ''; } } // Вызов SetDevice(Camera, true); SetDevice(Screen, true); Are there any moments that I did not take into account, or is it just browser brakes?
PS: the frame size from the camera is ~ 6 kb, the desktop - ~ 250 kb. It seems that onload for elements should work asynchronously ...
while(Hold + Delay > GetTickCount()){continue;}, uh ... is it just js? - Grundy