MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Iframe Module for Webcam

    Scheduled Pinned Locked Moved Requests
    2 Posts 1 Posters 2.6k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      schmucke
      last edited by

      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 ;)

      1 Reply Last reply Reply Quote 0
      • S Offline
        schmucke
        last edited by

        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

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post
        Enjoying MagicMirror? Please consider a donation!
        MagicMirror created by Michael Teeuw.
        Forum managed by Sam, technical setup by Karsten.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy