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

Function MultiStreamRecorder

src/__tests__/MediaStreamRecorder.js:145–303  ·  view source on GitHub ↗
(arrayOfMediaStreams, options)

Source from the content-addressed store, hash-verified

143// MultiStreamRecorder.js
144
145function MultiStreamRecorder(arrayOfMediaStreams, options) {
146 arrayOfMediaStreams = arrayOfMediaStreams || [];
147
148 if (arrayOfMediaStreams instanceof MediaStream) {
149 arrayOfMediaStreams = [arrayOfMediaStreams];
150 }
151
152 var self = this;
153
154 var mixer;
155 var mediaRecorder;
156
157 options = options || {
158 mimeType: 'video/webm',
159 video: {
160 width: 360,
161 height: 240
162 }
163 };
164
165 if (!options.frameInterval) {
166 options.frameInterval = 10;
167 }
168
169 if (!options.video) {
170 options.video = {};
171 }
172
173 if (!options.video.width) {
174 options.video.width = 360;
175 }
176
177 if (!options.video.height) {
178 options.video.height = 240;
179 }
180
181 this.start = function(timeSlice) {
182 // github/muaz-khan/MultiStreamsMixer
183 mixer = new MultiStreamsMixer(arrayOfMediaStreams);
184
185 if (getVideoTracks().length) {
186 mixer.frameInterval = options.frameInterval || 10;
187 mixer.width = options.video.width || 360;
188 mixer.height = options.video.height || 240;
189 mixer.startDrawingFrames();
190 }
191
192 if (typeof self.previewStream === 'function') {
193 self.previewStream(mixer.getMixedStream());
194 }
195
196 // record using MediaRecorder API
197 mediaRecorder = new MediaStreamRecorder(mixer.getMixedStream());
198
199 for (var prop in self) {
200 if (typeof self[prop] !== 'function') {
201 mediaRecorder[prop] = self[prop];
202 }

Callers

nothing calls this directly

Calls 1

getVideoTracksFunction · 0.85

Tested by

no test coverage detected