jCapture is a plug-in for DokuWiki. It allows to capture screen shots or record screen activity and audio and upload them directly to DokuWiki media manager without having to save into a file. With jCapture you can quickly create documentation pages for UI-rich software products.
LGPL
jCapture is an applet. It was tested in FireFox 3.6+, IE 7+, Chrome, and DokuWiki 2009-12-25c+. It requires Java 6 update 10 or above.
| Filename | Filesize | Last modified |
|---|---|---|
| jcapture.zip | 1.7 MB | 2013/01/16 19:30 |
Download and install the plugin using the Plugin Manager and the URL (http://www.hammurapi.com/products/jcapture/jcapture.zip) given above.
/somenonexistingcodebase because the web server must return proper error code for the applet to work correctly. If this attribute is not set, codebase defaults to page location. In this case DokuWiki returns “Page does not exist” with status code 200 and the applet fails.
If your server doesn't return proper error codes for non-existing resources but rather some customized pages, you should configure some URL on the server to return proper error codes and point applet's codebase to that location.
Once you install the plug-in, there will be a new tool bar item as shown below
When you click on the toolbar button, a translucent window shows up2). Select “No” if browser asks whether to block unsigned content.
Move and resize the window as required. Drag the center of the window to move, and the borders to resize.
Click Options button to configure capturing/recording parameters. Then click Capture to create a snapshot, or Record to record a flash video of screen activity. A file name dialog will pop-up with auto-generated file name. Change the name if required and click OK. The image or video will be uploaded to the web and a link to the image will be inserted into the cursor position in the edit area. For large images/slow connections a progress dialog appears after several seconds and disappears once upload is complete. If upload is successful, the capture window disappears. In the case of a problem an error dialog pops-up and the window remains visible for another capture attempt.
The video clip below was recorded with jCapture.
More examples of jCaptured videos and images are here.
This section describes configuration options. Configuration options are persisted in a local file in the user directory and are loaded when applet starts.
Options on this tab apply to the video part of recordings. Some options also apply to screenshot capturing.
This tab applies only to recordings.
Post-recording editor allows to delete “noise” from the movie such as:
When user clicks on “Stop” button, jCapture offers to edit the recorded movie before uploading. If user clicks “Yes” then a movie editor dialog opens (see below).
The dialog consists of the following parts:
Shows frame which has focus in the timeline. Frame image scales when editor is resized, preserving aspect ratio.
Timeline has two rows:
Hovering mouse over the timeline opens a tool-tip with a thumbnail image of the frame under the mouse pointer.
Timeline columns are shown with white background for active frames (mouse moved or screen changed) and gray background for inactive frames. It allows easily spot inactivity periods.
Frames in the timeline can be selected with mouse or keyboard (shift-arrow).
Frames marked for deletion are shown with a little red X in the screen cell and with sound volume rendered in gray instead of blue.
Single frame deletion state can be toggled by double-clicking on the frame column in the timeline.
To delete/undelete a group of frames, select them, right click, and then select “Delete frames” or “Undelete frames” in the context menu.
If “Normalize volume” check box is selected, then recorded audio volume is normalized to make the highest amplitude in the recording to be 0.95 of maximum possible amplitude for the given audio format. Number in parentheses after “Normalize volumen” shows volume increase in decibels if normalization is applied.
One of frames in the movie (including frames marked for deletion) can be selected to be the “spash frame”. The splash frame is the first frame in the movie which is shown as a still picture on a web page, before movie starts playing. Splash frame allows to communicate the main point of the movie as a picture.
To select the splash frame, click on a frame column in the timeline, right-click and check “Splash” checkbox menu item. To un-select uncheck the Splash menu item or select another frame as the splash frame.
The splash frame is decorated with a little green rectangle in the timeline.
Movie editor can play a movie from the current position or play current selection. To play from the current position, select a single frame, right click and choose “Play” from the context menu. To play a range of frames, select several frames, right click and select “Play”.
To stop playing click on the screen or on the timeline. When playing finishes, the movie returns to the focus frame.
jCapture applet jars are signed and trusting the applet content is all you have to do to make it work - just click the Run button (see below).
If you run into permission problems (which should never happen), you may need to grant the following permissions to the applet codebase as shown below
grant codeBase "http://localhost/dokuwiki/lib/plugins/jcapture/lib/-" {
permission java.awt.AWTPermission "setWindowAlwaysOnTop";
permission java.net.NetPermission "getProxySelector";
permission java.awt.AWTPermission "createRobot";
permission java.awt.AWTPermission "readDisplayPixels";
permission java.net.SocketPermission "*:*", "connect, resolve";
};
Replace http://localhost/dokuwiki with the URL of your DokuWiki installation.
The last permission is needed to connect through proxy. If you know address(es) and port(s) of your proxy server(s), then you can replace “*.*” with server(s) IP adress(es) and port(s).
You can use policytool or edit .java.policy file directly.
Default image format is PNG. You can change image format either through the Options dialog or by changing file extension of the capture. The plug-in capitalizes the extension and passes it as image format parameter to javax.imageio.ImageIO.write() method. Therefore, all formats supported by this class are supported by the plug-in. On Java 6 update 21 supported formats are: BMP, JPG, JPEG, PNG, WBMP, GIF. We tested gif, jpeg, and png extensions - it works fine!
If the plug-in doesn't work, check Java console and Error console (if you are using FireFox). You can also use a web debugger like Fiddler to trace interaction between the browser/applet and the server.
Java 7 tries to download jcapture.jar.pack.gz before downloading jcapture.jar. It also applies to other jars. Some hosting providers (e.g. 1and1) return code 300 - Multiple choice in this case, instead of code 404 Not found. In this case JCapture doesn't work (it's Java's “feature”, not JCapture's). One solution to the problem is to add CheckSpelling Off to .htaccess file - it works with 1and1. Another possible solution is to rename/convert .jar files to .jar.pack.gz files.
{{ }} tag to embed down-scaled videos into the page, adding &direct parameter will create a direct link to the file. This approach works well with Image Box plug-in. Example: [{{myvideo.swf?200x100&direct|My video}}].
Below is an Ant build file to compile sources, create a jar file and sign jars. Keystore password is passed to the signjar task through storepass property. This article describes how to create a keystore and a key.
Replace _key_alias_ and _path_to_keystore_ placeholders with real values.
The build file expects sources to be in src folder and dependency jars to be in lib folder.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <project default="build"> <target name="build"> <delete dir="build" failonerror="false" /> <mkdir dir="build/jcapture" /> <delete file="lib/jcapture.jar" failonerror="false" /> <javac srcdir="src" debug="on" destdir="build/jcapture"> <classpath> <fileset dir="lib" includes="*.jar"/> <fileset dir="C:/Program Files/Java/jdk1.6.0_20/jre/lib" includes="plugin.jar"/> </classpath> </javac> <jar destfile="lib/jcapture.jar"> <fileset dir="build/jcapture" /> <fileset dir="src" excludes="**/*.java" /> <manifest> <attribute name="Vendor" value="Hammurapi Group" /> <attribute name="Bundle-Version" value="0.1" /> <attribute name="Bundle-SymbolicName" value="com.hammurapi.jcapture" /> <attribute name="Class-Path" value="apache-mime4j-0.6.jar commons-codec-1.3.jar commons-logging-1.1.1.jar httpclient-4.0.1.jar httpcore-4.0.1.jar httpmime-4.0.1.jar " /> </manifest> </jar> <delete dir="build/signed" failonerror="false"/> <mkdir dir="build/signed"/> <signjar destDir="build/signed" alias="_key_alias_" keystore="_path_to_keystore_" storepass="${storepass}" preservelastmodified="true"> <path> <fileset dir="lib" includes="*.jar" /> </path> </signjar> <property name="releaseDir" value="release" /> <delete dir="${releaseDir}" failonerror="false" /> <mkdir dir="${releaseDir}"/> <zip destfile="${releaseDir}\jcapture.zip"> <zipfileset prefix="jcapture/" dir="${basedir}" excludes=".classpath, .project, bin/**, build/**, wink, build.xml, lib/**" /> <zipfileset prefix="jcapture/lib" dir="${basedir}/build/signed" /> </zip> </target> </project>
During recording jCapture caches audio on disk, screenshots are stored in memory using soft references and in a temporary file from which screenshot images are loaded if garbage collector clears image reference. Composition of SWF file happens in-memory. Therefore, it is possible to run into OutOfMemoryError that for long recordings. If it happens, go to the Control Panel, open Java configuration and add -Xmx<max heap size> runtime JVM parameter. For example -Xmx800m sets the maximum heap size to 800 Megabytes.
You can check amount of free/max memory available to the applet JVM in jCapture Options/About tab:
jCapture comes with SWF video encoder. Additional encoders can be added in the following way:
java.util.ServiceLoader.It seems that an AVI encoder shall be relatively easy to implement with Monte Media Library. Take a look at the Main class in AVIDemo.jar The encoder shall reconstruct screenshots from delta images by writing deltas on the BufferedImage and then write the image to AVI output as shown in the demo.
Modify the php code so the applet classpath can be managed from the DokuWiki control panel. This would allow to add video encoders by adding jar's to the classpath instead of modifying applet.php.
Classpath entries shall be resolvable relative to the jCapture lib folder (relative to the main jar). In this case encoders can be distributed as dokuwiki plugins, e.g. for AVI it'd be jcapture.avi plugin. Such plugins will have just jar files and will be referenced by jCapture classpath, e.g. ../../jcapture.avi/lib/jcapture-avi-encoder.jar. The main jar in the encoder plugin shall have Class-Path entry in its manifest file referencing other dependency jars.
jCapture can be integrated with other web applications, e.g. other Wikis.
There are two approaches:
These two approaches are explained below.
In this case the applet tag can be customized to furnish jCapture applet with upload URL and pass-through parameters which are passed to the upload request.
uploadUrl - URL to upload file.sectok, opaque - these parameters are “pass-through” - their values, if provided, are passed to the upload request.ow - always “1”;Filename - file name without namespace, i.e. the part after the last colon.ns - namespace, the part before the last colon, if filename contains colon, colon otherwise.Filedata - binary file data.
In this case integration is achieved by creating a subclass of AbstractCapturingApplet and implementing HttpUriRequest createRequest(String fileName, InputStreamBody bin) and String bodyName(String fileName) methods.
Below is DokuWiki implementation of createRequest()'' method for your reference.
String uploadUrl = getParameter("uploadUrl"); if (uploadUrl==null || uploadUrl.trim().length()==0) { String dokuHost = getParameter("host"); if (dokuHost.toLowerCase().startsWith(HTTPS_PREFIX)) { if (dokuHost.lastIndexOf(":")<HTTPS_PREFIX.length()) { // No port number dokuHost+=":443"; } } else if (dokuHost.endsWith(":80")) { dokuHost = dokuHost.substring(0, dokuHost.length()-3); } System.out.println("DokuHost: "+dokuHost); StringBuilder uploadUrlBuilder = new StringBuilder(dokuHost); String dokuBase = getDokuBase(); System.out.println("DokuBase: "+dokuBase); uploadUrlBuilder.append(dokuBase); uploadUrlBuilder.append("lib/exe/mediamanager.php"); uploadUrl = uploadUrlBuilder.toString(); } System.out.println("Uploading to "+uploadUrl); HttpPost httppost = new HttpPost(uploadUrl); if (!httppost.containsHeader("Cookie")) { httppost.setHeader("Cookie", getCookies()); } httppost.setHeader("Pragma", "No-cache"); MultipartEntity reqEntity = new MultipartEntity(); String sectok = getParameter("sectok"); if (sectok!=null && sectok.trim().length()>0) { reqEntity.addPart("sectok", new StringBody(sectok)); } reqEntity.addPart("ow", new StringBody("1")); String opaque = getParameter("opaque"); if (opaque!=null && opaque.trim().length()>0) { reqEntity.addPart("opaque", new StringBody(opaque)); } reqEntity.addPart("Filename", new StringBody(fileName)); int nsIdx = fileName.lastIndexOf(":"); String namespace; if (nsIdx==-1) { namespace = ":"; } else { namespace = ":"+fileName.substring(0, nsIdx); fileName = fileName.substring(nsIdx+1); } if (namespace!=null) { reqEntity.addPart("ns", new StringBody(namespace)); } reqEntity.addPart("Filedata", bin); httppost.setEntity(reqEntity); return httppost;
Body name method removes namespace part from file name.
@Override protected String bodyName(String fileName) { return fileName.substring(fileName.lastIndexOf(":")+1); }
Such integration requires no changes in the jCapture Java code. See source code for more details.
If you want to participate in jCapture development, join jCapture Applet project on SourceForge.