Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

request mjpeg file

how do I make a request for a MJPEG file to a IP Camera?

— asked November 15th 2010 by ale ale
  • camera
  • ip
  • mjpeg
  • request
5 Comments
  • you can get better responses to your questions if you are more specific

    — commented November 15th 2010 by Aaron Saunders
  • yes, first sorry for my English, are able to do REQUEST for jpg images from a ip camera, but they are not able to procure a mjpeg file from a ip camera

    — commented November 15th 2010 by ale ale
  • what device? Are you asking how to get a movie file from the camera?

    — commented November 15th 2010 by Aaron Saunders
  • for device I mean the iphone or androi, yes I ask for get a file mjpeg from an ip camera

    — commented November 16th 2010 by ale ale
  • I am having the same issue, however to be more clear (and to help out @ale ale)

    in my index.html page i have a standard img tag, its source is outside of the project:
    <img src="http://192.168.1.100/mjpg/video.mjpg" alt="" />

    The application A) does not know how to display a Motion-JPEG, and B)the debug window is trying to Proxy it
    [22:31:07:638] [Titanium.Proxy] [Debug] Looking up proxy info…
    [22:31:07:651] [Titanium.Proxy] [Debug] Proxy auto config activated by…
    [22:31:07:656] [Titanium.Proxy] [Debug] Checking whether http://192.168.1.100/mjpg/video.mjpg should be bypassed.
    [22:31:07:656] [Titanium.Proxy] [Debug] No bypass

    so really what I need to see answered is why does the compiled app not understand how to display a Motion-JPEG?

    Thanks,
    Chris

    — commented March 1st 2011 by Chris James

3 Answers

  • I am having the same issue, however to be more clear (and to help out @ale ale)

    in my index.html page i have a standard img tag, its source is outside of the project:
    <img src="http://192.168.1.100/mjpg/video.mjpg" alt="" />

    The application A) does not know how to display a Motion-JPEG, and B)the debug window is trying to Proxy it
    [22:31:07:638] [Titanium.Proxy] [Debug] Looking up proxy info…
    [22:31:07:651] [Titanium.Proxy] [Debug] Proxy auto config activated by…
    [22:31:07:656] [Titanium.Proxy] [Debug] Checking whether http://192.168.1.100/mjpg/video.mjpg should be bypassed.
    [22:31:07:656] [Titanium.Proxy] [Debug] No bypass

    so really what I need to see answered is why does the compiled app not understand how to display a Motion-JPEG?

    Thanks,
    Chris

    — answered March 1st 2011 by Chris James
    permalink
    1 Comment
    • sorry that should not have been an answer

      — commented March 1st 2011 by Chris James
  • Use a webView:

    Here's a demo of a live MJPG stream.

    
    var win = Ti.UI.currentWindow;
    
    win.backgroundColor = '#555';
    
    var mjpeg_source = 'http://webcam.mum.edu/cgi-bin/video320x240.mjpg';
    
    var playerHTML = '<html><body style="background:#000;padding:0px;margin:0px;"><img width="320" height="240" src="'+mjpeg_source+'"></body></html>';
    
    
    var mjpeg_webview = Titanium.UI.createWebView({
        html: playerHTML,
        width:320,
        height:240,
        top:10
    });
    
    win.add(mjpeg_webview);
    
    — answered March 1st 2011 by Kosso
    permalink
    3 Comments
    • The Desktop API does not support the function 'createWebView', still stuck

      — commented March 2nd 2011 by Chris James
    • Ahh! whoops! You should then just be able to use the thml I used in the main app window. AFAIK, the desktop app is more or less a big 'webview'(browser) itself! :)

      — commented April 6th 2011 by Kosso
    • I think I have not been able to explain my point, Titanium uses a proxy for all links and src attributes through an internal javascript proxy. an MJPEG will never stop loading as it is adding frames onto the end of a stack (especially from a security camera). It then never loads into the "Application". It doesn't matter how it's presented to the app, it will try to proxy those links.

      — commented April 7th 2011 by Chris James
  • You can use:

    exports.create = function(mjpgurl) {
         var self = Titanium.UI.createWebView({
                url:mjpgurl,
            width:320,
                height:240
        });
        Ti.App.addEventListener('resume',function(){self.reload});
        return self;
    }
    
    — answered March 7th 2013 by Rainer Schleevoigt
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.