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

Function WhammyRecorderHelper

src/__tests__/MediaStreamRecorder.js:1762–2057  ·  view source on GitHub ↗
(mediaStream, root)

Source from the content-addressed store, hash-verified

1760// WhammyRecorderHelper.js
1761
1762function WhammyRecorderHelper(mediaStream, root) {
1763 this.record = function(timeSlice) {
1764 if (!this.width) {
1765 this.width = 320;
1766 }
1767 if (!this.height) {
1768 this.height = 240;
1769 }
1770
1771 if (this.video && this.video instanceof HTMLVideoElement) {
1772 if (!this.width) {
1773 this.width = video.videoWidth || video.clientWidth || 320;
1774 }
1775 if (!this.height) {
1776 this.height = video.videoHeight || video.clientHeight || 240;
1777 }
1778 }
1779
1780 if (!this.video) {
1781 this.video = {
1782 width: this.width,
1783 height: this.height
1784 };
1785 }
1786
1787 if (!this.canvas || !this.canvas.width || !this.canvas.height) {
1788 this.canvas = {
1789 width: this.width,
1790 height: this.height
1791 };
1792 }
1793
1794 canvas.width = this.canvas.width;
1795 canvas.height = this.canvas.height;
1796
1797 // setting defaults
1798 if (this.video && this.video instanceof HTMLVideoElement) {
1799 this.isHTMLObject = true;
1800 video = this.video.cloneNode();
1801 } else {
1802 video = document.createElement('video');
1803 video.src = URL.createObjectURL(mediaStream);
1804
1805 video.width = this.video.width;
1806 video.height = this.video.height;
1807 }
1808
1809 video.muted = true;
1810 video.play();
1811
1812 lastTime = new Date().getTime();
1813 whammy = new Whammy.Video(root.speed, root.quality);
1814
1815 console.log('canvas resolutions', canvas.width, '*', canvas.height);
1816 console.log('video width/height', video.width || canvas.width, '*', video.height || canvas.height);
1817
1818 drawFrames();
1819 };

Callers

nothing calls this directly

Calls 4

drawFramesFunction · 0.85
dropBlackFramesFunction · 0.85
bytesToSizeFunction · 0.85
debugMethod · 0.80

Tested by

no test coverage detected