MCPcopy Index your code
hub / github.com/mailru/FileAPI / _detectVideoSignal

Function _detectVideoSignal

lib/FileAPI.Camera.js:244–255  ·  view source on GitHub ↗

* @private * @param {HTMLVideoElement} video * @return {Boolean}

(video)

Source from the content-addressed store, hash-verified

242 * @return {Boolean}
243 */
244 function _detectVideoSignal(video){
245 var canvas = document.createElement('canvas'), ctx, res = false;
246 try {
247 ctx = canvas.getContext('2d');
248 ctx.drawImage(video, 0, 0, 1, 1);
249 res = ctx.getImageData(0, 0, 1, 1).data[4] != 255;
250 }
251 catch( err ){
252 api.log('[FileAPI.Camera] detectVideoSignal:', err);
253 }
254 return res;
255 }
256
257
258 // @export

Callers 1

FileAPI.Camera.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected