views:

63

answers:

0

A videoconferencing project I was working on used JMF to capture video and audio, and transmit it to another endpoint. An issue was that my team didn't want the user of the product to have to install JMF.

I thought it might be worthwhile to share our solution to this problem. It works. It works well. My question to you is: does anyone have a better way to do it?

Environment: Windows, XP and above

  1. Download JMF for Windows
  2. Install it on your machine

  3. Locate the following dlls in the win32 folder after jmf installs:

    jmacm.dll
    jmam.dll
    jmcvid.dll
    jmdaud.dll
    jmdaudc.dll
    jmddraw.dll
    jmfjawt.dll
    jmg723.dll
    jmgdi.dll
    jmgsm.dll
    jmh261.dll
    jmh263enc.dll
    jmjpeg.dll
    jmmci.dll
    jmmpa.dll
    jmmpegv.dll
    jmutil.dll
    jmvcm.dll
    jmvfw.dll
    jmvh263.dll
    jsound.dll

  4. Copy the dlls into a temporary folder

  5. Locate the jmf.properties file (Do a search on your computer for it)
  6. Download the JMF source code
    In the source code, find the following files:

JMFinit.java
JMRPropertiesGen.java
Registry.java
RegistryGen.java

  1. Create a package; I'll call it JMFNoInstall
  2. Add the files listed in step 5
  3. Add a class called Main to this package as such:

 

package JMFNoInstall;
// add your imports and whatnot here
public class Main()
{
    public Main()
    {
        JMFinit.main(null);
        JMFPropertiesGen.main(null);
        Registry.main(null);
        RegistryGen.main(new String[] {
            new File(".").getAbsolutePath(),
            "registrylib"
        });
    }
}

The jmf.properties file needs to go in the same folder as the class that has your main method or the same folder as the JAR archive that contains the main method.
The dlls need to go into the win32 folder. You can have your program check to see if they are in the win32 folder. If they are not, you can have it copy them over from some location. The jmf.properties file gets updated whenever the the Main class listed above runs. You only need to run this once, the first time the program is ever run, or if the user would like to add new capture devices. Lastly, just make sure the jmf.jar file that comes along with the Windows JMF download is included in the classpath. You're good to go at this point. All the functionality of JMF without actually having to install it.

There really isn't a lot of work involved with this, and you can incorporate it into your custom installer quite easily.

Has anyone found a better way to do this though? There are a few pitfalls of doing it this way.