MCPcopy Create free account
hub / github.com/Wscats/chrome-devtools-cli / drawFrames

Function drawFrames

src/__tests__/MediaStreamRecorder.js:1856–1898  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1854 var isOnStartedDrawingNonBlankFramesInvoked = false;
1855
1856 function drawFrames() {
1857 if (isPaused) {
1858 lastTime = new Date().getTime();
1859 setTimeout(drawFrames, 500);
1860 return;
1861 }
1862
1863 if (isStopDrawing) {
1864 return;
1865 }
1866
1867 if (requestDataInvoked) {
1868 return setTimeout(drawFrames, 100);
1869 }
1870
1871 var duration = new Date().getTime() - lastTime;
1872 if (!duration) {
1873 return drawFrames();
1874 }
1875
1876 // via webrtc-experiment#206, by Jack i.e. @Seymourr
1877 lastTime = new Date().getTime();
1878
1879 if (!self.isHTMLObject && video.paused) {
1880 video.play(); // Android
1881 }
1882
1883 context.drawImage(video, 0, 0, canvas.width, canvas.height);
1884
1885 if (!isStopDrawing) {
1886 whammy.frames.push({
1887 duration: duration,
1888 image: canvas.toDataURL('image/webp')
1889 });
1890 }
1891
1892 if (!isOnStartedDrawingNonBlankFramesInvoked && !isBlankFrame(whammy.frames[whammy.frames.length - 1])) {
1893 isOnStartedDrawingNonBlankFramesInvoked = true;
1894 root.onStartedDrawingNonBlankFrames();
1895 }
1896
1897 setTimeout(drawFrames, 10);
1898 }
1899
1900 var isStopDrawing = false;
1901

Callers 1

WhammyRecorderHelperFunction · 0.85

Calls 1

isBlankFrameFunction · 0.85

Tested by

no test coverage detected