Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Embed mjpg Webcam?

    Hi,

    I'm trying to embed a motion JPEG (.mjpg) webcam stream into a webpage.
    I the an IP address followed by the filename and extension. Simply entering this into the address bar in Firefox displays the image, but I need a way to embed it to work in all browsers.

    Can anyone help?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Many webcams cater to the browser that is being used. IE needs a video stream where as other browsers can use the image stream. What webcam is it? And does it have more than one stream available ie a movie stream? If you go to the ip address in your browser and view the source you can see how they determine what stream to display.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    They are using an AXIS 241S with an ActiveX plugin.
    I was hoping not to use any plugins as our firewall wont allow most users to install it.

    I think I need to go back to the guys who set the camera up and ask for a jpeg image option. Then I can refresh the image using javscript, hopefully without any plugins.
    Last edited by htcilt; 06-28-2010 at 04:42 PM.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You won't need any plugins. If you have access to the admin area of the camera you can modify how it will display the video. I used an axis 207mw and it had an area in the admin that gave you the html you could use to put on your own pages.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks _Aerospace_Eng_,
    I'll contact the admin guys and see if they can help.

  • #6
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Here is the code I'm using from the Axis website:

    http://www.axis.com/techsup/cam_serv...deo_medium.htm

    It basically loads an activex object for IE or shows the mjpg as a direct image in all other browsers.
    The problem for IE is the 1st time the page is loaded, you get the "Install this software?" security dialog. This will be blocked by our firewall for most users.
    I can allow this through, but is there a way to avoid the install completely?
    Its a shame IE cant just show the mjpg like every other browser can!

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The only other way would be to make the camera use java to display the video. I'm not sure what features your camera has but I'm pretty sure that is what we did with the axis camera we used. We made the camera use java to display any video or images. I'm not sure though if it will ask the user to allow the java install. This is from the user manual for the 241S
    Quote Originally Posted by AXIS
    If your workstation restricts the use of additional software components, the AXIS 241Q/241S can be configured to use a Java applet for updating JPEG images. Please see the online help for more information
    Last edited by _Aerospace_Eng_; 06-29-2010 at 03:06 PM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks for the info.
    I've managed to work around the firewall problem by saving the codebase cab file to our server and pointing the code to that. Now all users get the popup to install the plugin.

    Is there a way in javascript to detect if a particular plugin is installed on the client's computer? The plan is to show a bit of text explaining that they need to click on "install" and that it is safe to do so.
    I originally just has a cookie to detect if the client had visited the page before i.e. if 1st visit, set the cookie to 1 and display the "you must click on install" text.
    This is fine, but it doesn't take into account it the client clicks on "dont install" but then comes back to the site later, or reads the "you must click on install" after clicking on "dont install" and reloads the page.

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    It depends on the browser. Most of the modern ones have a list of plugins it has available to it. I'm not sure if the activex plugin or whatever plugin you use will show up in this list. You can put this in an html page
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    
    <script type="text/javascript">
    
    numPlugins = navigator.plugins.length;
    if (numPlugins > 0)
    document.writeln("<b><font size=+3>Installed plug-ins</font></b><br>");
    else
    document.writeln("<b><font size=+2>No plug-ins ");
    document.writeln("are installed.</font></b><br>");
    document.writeln("<hr>");
    for (i = 0; i < numPlugins; i++) {
    plugin = navigator.plugins[i];
    document.write("<center><font size=+1><b>");
    document.write(plugin.name);
    document.writeln("</b></font></center><br>");
    document.writeln("<dl>");
    document.writeln("<dd>File name:");
    document.write(plugin.filename);
    document.write("<dd><br>");
    document.write(plugin.description);
    document.writeln("</dl>");
    document.writeln("<p>");
    document.writeln("<table width=100% border=2 cellpadding=5>");
    document.writeln("<tr>");
    document.writeln("<th width=20%><font size=-1>Mime Type</font></th>");
    document.writeln("<th width=50%><font size=-1>Description</font></th>");
    document.writeln("<th width=20%><font size=-1>Suffixes</font></th>");
    document.writeln("<th><font size=-1>Enabled</th>");
    document.writeln("</tr>");
    numTypes = plugin.length;
    for (j = 0; j < numTypes; j++) {
    mimetype = plugin[j];
    if (mimetype) {
    enabled = "No";
    enabledPlugin = mimetype.enabledPlugin;
    if (enabledPlugin && (enabledPlugin.name == plugin.name))
    enabled = "Yes";
    document.writeln("<tr align=center>");
    document.writeln("<td>");
    document.write(mimetype.type);
    document.writeln("</td>");
    document.writeln("<td>");
    document.write(mimetype.description);
    document.writeln("</td>");
    document.writeln("<td>");
    document.write(mimetype.suffixes);
    document.writeln("</td>");
    document.writeln("<td>");
    document.writeln(enabled);
    document.writeln("</td>");
    document.writeln("</tr>");
       }
    }
    document.write("</table>");
    document.write("<p><hr><p>");
    }
    </script>
    </body>
    </html>
    Run it on a system that you know has the plugin installed and see what it says.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #10
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks for your continued support _Aerospace_Eng_.

    navigator.plugins doesn't seem to be accessible by IE. IE is the only browser I need to target.

    From what I've read here:
    http://www.aspfree.com/c/a/Windows-S...et-Explorer/1/

    Its is possible to check in IE using VBScript. For example, the following checks (boolean) for Flash 10

    Code:
    checkForSW10 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.1")))
    I've modified this to check for the Axis plugin
    Code:
    <script type="text/vbscript">
    checkForAxis = (IsObject(CreateObject("AxisMediaControlEmb.AxisMediaControlEmb.1")))
    if checkForAxis = true then
      document.write("<br><b>Axis installed.</b>")
    else
      document.write("<br><b>Axis NOT installed.</b>")    
    end if  
    </script>
    This works fine on my computers where the plugin is already installed, but on a computer that hasn't already got it I get "ActiveX component can't create object" script error. Strange. I would have expected this error for both rather than just one? So close!

    I'll try uninstalling the plugin on my computer and run the script again.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •