Here is the basic code that plays a video as an applet. I have 3 questions
about it
Code:
import java.applet.*;
import java.awt.*;
import java.net.*;
import javax.media.*;
public class PlayerApplet extends Applet implements ControllerListener {
Player player = null;
public void init() {
setLayout(new BorderLayout());
String mediaFile = "file://C:/Documents and
Settings/Administrador/mivideo.avi";
try {
URL mediaURL = new URL(getDocumentBase(), mediaFile);
player = Manager.createPlayer(mediaURL);
player.addControllerListener(this);
}
catch (Exception e) {
System.err.println("Got exception "+e);
}
}
public void start() {
player.start();
}
public void stop() {
player.stop();
player.deallocate();
}
public void destroy() {
player.close();
}
public synchronized void controllerUpdate(ControllerEvent event) {
if (event instanceof RealizeCompleteEvent) {
Component comp;
if ((comp = player.getVisualComponent()) != null)
add("Center",comp);
if ((comp = player.getControlPanelComponent()) != null)
add ("South", comp);
validate();
}
}
}
1) How can I show the video in a fixed position?. I mean I want the video to
appear at (x,y) x=50, y=100 and it has a size of 400x300 pixels.
2) How can I draw an image over the video. I mean I want to draw a rectangle,
for example, over the video.
3) I realize that in that way the player can only play uncompressed video
files. What can I do for it to play any video files.
Thanks in advance.
[Message sent by forum member 'renzord' (renzord)]
http://forums.java.net/jive/thread.jspa?messageID=241063
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".