A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Read the statement by Michael Teeuw here.
Iframe Module for Webcam
-
Hey,
this is my first post after reading awhile.
i just look for a iframe module which refresh himself any 2 seconds. I just need it for my IPCam. The ipcam modul dont work for me. i must call an url to get my image (like: http://guest@192.168.188.65/tmpfs/auto.jpg).can anyone help me?
thank you very much ;)
-
Ok , i have build my own now - i am not really a javescript programmer - pls dont laugh!!!
i have the following code, how can i initiate the the startonload() function ist run. if i write this in dom, there will be run, but not shiow the wrapper…
/* global Module */ /* Magic Mirror * Module: MMM-iFrame * * By Michael Teeuw http://michaelteeuw.nl * MIT Licensed. */ Module.register("MMM-iFrame",{ // Default module config. defaults: { animationSpeed: 1000, }, preload: function() { this.img.src='http://guest@192.168.188.65/tmpfs/auto.jpg?'+new Date; }, changesrc: function() { img1.src=img.src; this.preload(); setTimeout(changesrc,3500); }, update: function() { var imgObj = document.getElementById('img1'); imgObj.src = this.img.src; this.img.src = "http://guest@192.168.188.65/tmpfs/auto.jpg?" + (new Date()).getTime(); }, takeerror: function() { this.img.src = "http://guest@192.168.188.65/tmpfs/auto.jpg?" + (new Date()).getTime(); }, startonload: function() { this.img.src = "http://guest@192.168.188.65/tmpfs/auto.jpg?" + (new Date()).getTime(); this.img.onerror=this.takeerror(); this.img.onload=this.update(); }, load: function() { if (navigator.appName.indexOf("Microsoft IE Mobile") != -1) { this.preload(); this.changesrc(); return; } this.startonload(); }, start: function() { Log.info('Starting module: ' + this.name); var self = this; var imgObj = ""; var img = new Image(); this.img = new Image(); this.imgObj; setInterval(function() { self.updateDom(); }, this.config.animationSpeed); }, // Override dom generator. getDom: function() { var wrapper = document.createElement("div"); var imagewrapper = document.createElement("iFrame"); imagewrapper.style = "border:0" imagewrapper.width = 0; imagewrapper.height = 0; imagewrapper.src = "http://guest@192.168.188.65/tmpfs/auto.jpg"; wrapper.innerHTML = "<img class="center-ver3" src="http://guest@192.168.188.65/tmpfs/auto.jpg" />"; wrapper.appendChild(imagewrapper); return wrapper; } });
(The iFrame is not visible, it is just for open a Browser session with a user without a password)
Can anyone help me by my probem?
thx