camera icon indicating copy to clipboard operation
camera copied to clipboard

No camera feed

Open IshanDindorkar opened this issue 3 years ago • 1 comments

Hello Everyone,

I am trying to integrate camera module in MagicMirror. I am using Frontech web camera. Tried everything like changing display: false to display: true. But no success yet. I know this issue has been raised before, couple of times. But I couldn't see any more discussion on those issues. I am creating this new issue to reach out to people who could successfully fixed this problem. I would greatly appreciate your guidance. Thank you in advance!

IshanDindorkar avatar May 30 '21 12:05 IshanDindorkar

I think I found solution to this problem. I will share what worked for me. I hope it will work for you as well - In webcam.js, I commented these lines -

                    // var self = this;
		// this.mediaDevices.getUserMedia({
		// 	"video": true
		// 	// "audio": false,
		// 	// "video": this.params.constraints || {
		// 	// 	mandatory: {
		// 	// 		minWidth: this.params.dest_width,
		// 	// 		minHeight: this.params.dest_height
		// 	// 	}
		// 	// }
		// })
		// .then( function(stream) {
		// 	// got access, attach stream to video
		// 	video.onloadedmetadata = function(e) {
		// 		self.stream = stream;
		// 		self.loaded = true;
		// 		self.live = true;
		// 		self.dispatch('load');
		// 		self.dispatch('live');
		// 		self.flip();
		// 	};
		// 	video.src = window.URL.createObjectURL( stream ) || stream;
		// })
		// .catch( function(err) {
		// 	return self.dispatch('error', err);
		// });

Instead I replaced above lines with this code -

if (navigator.mediaDevices.getUserMedia) { navigator.mediaDevices.getUserMedia({ video: true }) .then(function (stream) { video.srcObject = stream; }) .catch(function (error) { console.log("Something went wrong!"); }); }

I hope this will work for you also.

All the best!

IshanDindorkar avatar May 30 '21 15:05 IshanDindorkar