diff --git a/mozilla/java/plugins/examples/MediaPlayer/JMPlayer.java b/mozilla/java/plugins/examples/MediaPlayer/JMPlayer.java
new file mode 100644
index 00000000000..35d444f983e
--- /dev/null
+++ b/mozilla/java/plugins/examples/MediaPlayer/JMPlayer.java
@@ -0,0 +1,163 @@
+import javax.media.*;
+import javax.media.util.*;
+import javax.media.format.*;
+import javax.media.bean.playerbean.*;
+import javax.media.control.*;
+
+
+import org.mozilla.pluglet.*;
+import org.mozilla.pluglet.mozilla.*;
+import org.mozilla.pluglet.mozilla.PlugletTagInfo2;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.print.*;
+import java.io.*;
+import java.util.*;
+
+
+public class JMPlayer implements Pluglet {
+ public JMPlayer() {
+ }
+
+ public PlugletInstance createPlugletInstance(String mimeType) {
+ return new JMPlayerInstance();
+ }
+
+ public void initialize(PlugletManager manager) {
+ }
+
+ public void shutdown() {
+ }
+}
+
+class JMPlayerInstance implements PlugletInstance, ControllerListener {
+ PlugletInstancePeer peer;
+ Dimension defaultSize;
+ Frame frm;
+ int w, h;
+ MediaPlayer player = null;
+
+ Panel panel;
+
+ public synchronized void controllerUpdate(ControllerEvent ce) {
+ if(ce instanceof RealizeCompleteEvent) {
+ player.prefetch();
+ }
+ if(ce instanceof PrefetchCompleteEvent) {
+ Dimension dim = player.getPreferredSize();
+ frm.pack();
+ panel.setSize(dim);
+// player.setBounds(0, 0, w, h);
+ frm.setSize(defaultSize);
+ player.start();
+ frm.show();
+ }
+ }
+
+ public JMPlayerInstance() {
+ }
+
+ public void initialize(PlugletInstancePeer peer) {
+ PlugletTagInfo2 info = (PlugletTagInfo2)peer.getTagInfo();
+ w = info.getWidth();
+ h = info.getHeight();
+ defaultSize = new Dimension(w, h);
+ this.peer = peer;
+ }
+
+ public boolean playFile(String url) {
+ player.setMediaLocator(new MediaLocator(url));
+ if(player.getPlayer() == null) {
+ return false;
+ } else {
+ player.addControllerListener(this);
+ player.realize();
+ }
+ return true;
+ }
+
+ public void start() {
+ player = new MediaPlayer();
+ panel = new Panel();
+ panel.add(player);
+ }
+
+ public void stop() {
+ (new Exception()).printStackTrace();
+ player.stop();
+ player.deallocate();
+ player.close();
+ }
+
+ public void destroy() {
+ }
+
+ public PlugletStreamListener newStream() {
+ org.mozilla.util.Debug.print("--TestInstance.newStream\n");
+ JMPlayerStreamListener listener = new JMPlayerStreamListener();
+ listener.setPlayer(this);
+ return listener;
+ }
+
+ public void setWindow(Frame frame) {
+ if(frame == null) {
+ return;
+ }
+ if(panel == null) {
+ System.out.println("++ Initialize failed.");
+ return;
+ }
+// PlugletTagInfo2 info = (PlugletTagInfo2)peer.getTagInfo();
+// defaultSize = new Dimension(info.getWidth(), info.getHeight());
+ frame.setSize(defaultSize);
+ frame.setLayout(new BorderLayout());
+ frame.add(panel);
+ frm=frame;
+ }
+
+ public void print(PrinterJob printerJob) {
+ }
+}
+
+class JMPlayerStreamListener implements PlugletStreamListener {
+ JMPlayerInstance jmp;
+ int total=0;
+
+ public JMPlayerStreamListener() {
+ }
+
+ public void onStartBinding(PlugletStreamInfo streamInfo) {
+
+
+ if(!jmp.playFile(streamInfo.getURL())) {
+ System.out.println("++ Error starting player ");
+ return;
+ }
+
+ }
+
+ public void setPlayer(JMPlayerInstance jmp) {
+ this.jmp = jmp;
+ }
+
+ public void onDataAvailable(PlugletStreamInfo streamInfo, InputStream input,int length) {
+ }
+
+ public void onFileAvailable(PlugletStreamInfo plugletInfo, String fileName) {
+ }
+
+ public void onStopBinding(PlugletStreamInfo plugletInfo,int status) {
+ System.out.println("++ On stop binding.");
+ }
+
+ public int getStreamType() {
+ return 1;
+ }
+
+}
+
+
+
+
+
+
diff --git a/mozilla/java/plugins/examples/MediaPlayer/README b/mozilla/java/plugins/examples/MediaPlayer/README
new file mode 100644
index 00000000000..30e6e045ca4
--- /dev/null
+++ b/mozilla/java/plugins/examples/MediaPlayer/README
@@ -0,0 +1,43 @@
+MediaPlayer Pluglet Example.
+================================
+
+This directory contains the source code for MediaPlayer pluglet example.
+Pluglet is using Java Media Frameworks 2.0b MediaPlayer bean.
+
+========================================================================
+Win32 Build Directions:
+========================================================================
+Requirements:
+
+* built latest mozilla tree for WinNT4.0
+
+* JDK1.3
+
+* built Java-Implemented Plugins.
+
+* JMF2.0b installed.
+
+How To Build:
+
+* add jmf.jar to classpath
+
+* type "nmake /f makefile.win"
+
+
+How to Run:
+
+* Follow the directions in ..\..\README
+
+* Add jmf.jar to classpath
+
+* Set PLUGLET environment to the directory you have JMPlayer.jar
+
+* Run mozilla and load page play.html from this directory and you will see
+ sample avi file. (In addition you need to download some avi file and
+ name it test.avi.)
+
+Warning: JMF MediaPlayer does not support all the video formats so you can
+see some errors from player when loading unsupported format file.
+
+
+
diff --git a/mozilla/java/plugins/examples/MediaPlayer/makefile.win b/mozilla/java/plugins/examples/MediaPlayer/makefile.win
new file mode 100644
index 00000000000..6ed420e4562
--- /dev/null
+++ b/mozilla/java/plugins/examples/MediaPlayer/makefile.win
@@ -0,0 +1,26 @@
+#
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.0 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+# the License for the specific language governing rights and limitations
+# under the License.
+#
+# The Initial Developer of the Original Code is Sun Microsystems,
+# Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems,
+# Inc. All Rights Reserved.
+
+.SUFFIXES: .java .class
+.java.class:
+ $(JDKHOME)\bin\javac -classpath "../../classes;$(CLASSPATH)" $<
+default: JMPlayer.jar
+JMPlayer.jar: JMPlayer.class manifest
+ $(JDKHOME)\bin\jar cvfm JMPlayer.jar manifest *.class
+
+clobber:
+ -del *.class *.jar
+export: JMPlayer.jar
+ copy *.jar $(PLUGLET)
\ No newline at end of file
diff --git a/mozilla/java/plugins/examples/MediaPlayer/manifest b/mozilla/java/plugins/examples/MediaPlayer/manifest
new file mode 100644
index 00000000000..b5d98e6e15b
--- /dev/null
+++ b/mozilla/java/plugins/examples/MediaPlayer/manifest
@@ -0,0 +1,2 @@
+MIMEDescription: video/mpeg;video/quicktime;video/avi:avi;mpg;mpeg;mov:Pluglet JMPlayer
+Pluglet-Class: JMPlayer
diff --git a/mozilla/java/plugins/examples/MediaPlayer/play.html b/mozilla/java/plugins/examples/MediaPlayer/play.html
new file mode 100644
index 00000000000..0473bf0f878
--- /dev/null
+++ b/mozilla/java/plugins/examples/MediaPlayer/play.html
@@ -0,0 +1,5 @@
+
+
+