A plugins/examples/jmfplayer/src/main/web/tilego3.avi
A plugins/examples/jmfplayer/src/main/java/jmfplayer/JMFPlayer.java A plugins/examples/jmfplayer/src/main/web/test01.html R plugins/examples/MediaPlayer/JMPlayer.java R plugins/examples/MediaPlayer/samples/test.html R plugins/examples/MediaPlayer/samples/tilego3.avi - Move mediaplayer example to jmfplayer M plugins/examples/index.html - Add mediaplayer example M plugins/netbeans/build.xml M plugins/netbeans/pluglet.properties - require new property jdkhome.nospaces M plugins/release/build.xml - marching toward binary distribution M plugins/netbeans/nbproject/build-impl.xml M plugins/netbeans/nbproject/genfiles.properties M plugins/netbeans/nbproject/project.properties M plugins/netbeans/nbproject/project.xml - IDE changes git-svn-id: svn://10.0.0.236/trunk@222064 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1,139 +0,0 @@
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Panel;
|
||||
import java.awt.print.PrinterJob;
|
||||
import java.io.InputStream;
|
||||
import javax.media.ControllerEvent;
|
||||
import javax.media.ControllerListener;
|
||||
import javax.media.MediaLocator;
|
||||
import javax.media.PrefetchCompleteEvent;
|
||||
import javax.media.RealizeCompleteEvent;
|
||||
import javax.media.bean.playerbean.MediaPlayer;
|
||||
import org.mozilla.pluglet.Pluglet;
|
||||
import org.mozilla.pluglet.PlugletFactory;
|
||||
import org.mozilla.pluglet.PlugletStreamListener;
|
||||
import org.mozilla.pluglet.mozilla.PlugletManager;
|
||||
import org.mozilla.pluglet.mozilla.PlugletPeer;
|
||||
import org.mozilla.pluglet.mozilla.PlugletStreamInfo;
|
||||
import org.mozilla.pluglet.mozilla.PlugletTagInfo2;
|
||||
|
||||
|
||||
public class JMPlayer implements PlugletFactory {
|
||||
public JMPlayer() {
|
||||
}
|
||||
public Pluglet createPluglet(String mimeType) {
|
||||
Pluglet player = null;
|
||||
try {
|
||||
player = new Player();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return player;
|
||||
}
|
||||
public void initialize(String plugletPath, PlugletManager manager) {
|
||||
}
|
||||
public void shutdown() {
|
||||
}
|
||||
}
|
||||
|
||||
class Player implements Pluglet, ControllerListener {
|
||||
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);
|
||||
frm.setSize(defaultSize);
|
||||
player.start();
|
||||
frm.show();
|
||||
}
|
||||
}
|
||||
public Player() {
|
||||
}
|
||||
public void initialize(PlugletPeer peer) {
|
||||
PlugletTagInfo2 info = (PlugletTagInfo2)peer.getTagInfo();
|
||||
w = info.getWidth();
|
||||
h = info.getHeight();
|
||||
defaultSize = new Dimension(w, h);
|
||||
}
|
||||
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() {
|
||||
player.stop();
|
||||
player.close();
|
||||
}
|
||||
public void destroy() {
|
||||
}
|
||||
public PlugletStreamListener newStream() {
|
||||
JMPlayerStreamListener listener = new JMPlayerStreamListener();
|
||||
listener.setPlayer(this);
|
||||
return listener;
|
||||
}
|
||||
public void setWindow(Frame frame) {
|
||||
if(frame == null) {
|
||||
return;
|
||||
}
|
||||
frame.setSize(defaultSize);
|
||||
frame.setLayout(new BorderLayout());
|
||||
frame.add(panel);
|
||||
frm = frame;
|
||||
}
|
||||
public void print(PrinterJob printerJob) {
|
||||
}
|
||||
}
|
||||
|
||||
class JMPlayerStreamListener implements PlugletStreamListener {
|
||||
Player jmp;
|
||||
|
||||
public JMPlayerStreamListener() {
|
||||
}
|
||||
public void onStartBinding(PlugletStreamInfo streamInfo) {
|
||||
if(!jmp.playFile(streamInfo.getURL())) {
|
||||
System.out.println("Error starting player.");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
public void setPlayer(Player 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) {
|
||||
}
|
||||
public int getStreamType() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<html>
|
||||
<head><title>video/avi 3</title></head>
|
||||
<body>
|
||||
<EMBED type="video/avi" name=JMPlayer SRC="tilego3.avi" width=400 height=400>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Reference in New Issue
Block a user