Java Video Oprettelse
Hej Eksperter..Jeg ønsker at oprette forbindelse til en video sekvens f.eks film trailer/teaser .. Gerne i .AVI .. Det skal bruges i en større sammenhæng så bare den del kommer til at virke så skal jeg nok rette det til.
Problemet er at selvom MedieKlasserne skulle understøtte formatted for jeg dog den mærkligste fejl besked.
Fejlbesked :
Unable to handle format: DXGM, 1024x464, FrameRate=24.0, Length=2850816 0 extra bytes
Unable to handle format: mpeglayer3, 44100.0 Hz, 0-bit, Stereo, Unsigned, 16000.0 frame rate, FrameSize=8 bits
Failed to realize: com.sun.media.PlaybackEngine@179dce4
Error: Unable to realize com.sun.media.PlaybackEngine@179dce4
javax.media.CannotRealizeException
at javax.media.Manager.blockingCall(Manager.java:2005)
at javax.media.Manager.createRealizedPlayer(Manager.java:554)
at gui.JMFTest.<init>(JMFTest.java:60)
at gui.JMFTest.main(JMFTest.java:85)
Håber i kan løse problemet koden er forneden :
package gui;
import javax.media.*;
import javax.swing.*;
import java.awt.*;
import java.net.*;
import java.awt.event.*;
import java.io.IOException;
import javax.swing.event.*;
/**
*
* @author Mathias Eriksen
*/
public class JMFTest extends javax.swing.JFrame {
Player _player;
JMFTest() {
addWindowListener( new WindowAdapter() {
@Override
public void windowClosing( WindowEvent e ) {
_player.stop();
_player.deallocate();
_player.close();
System.exit( 0 );
}
});
//setExtent( 0, 0, 320, 260 );
JPanel panel = (JPanel)getContentPane();
panel.setLayout( new BorderLayout() );
String mediaFile = "http://1indgang.dk/Registrering/Test/Sample.vob";
try {
MediaLocator mlr = new MediaLocator(mediaFile);
_player = Manager.createRealizedPlayer( mlr );
if (_player.getVisualComponent() != null)
panel.add("Center", _player.getVisualComponent());
if (_player.getControlPanelComponent() != null)
panel.add("South", _player.getControlPanelComponent());
}
catch (IOException io) {
io.printStackTrace();
//System.err.println( "Got exception " + e );
} catch (NoPlayerException np) {
np.printStackTrace();
} catch (CannotRealizeException cre) {
cre.printStackTrace();
}
}
public static void main(String[] args) {
JMFTest jmfTest = new JMFTest();
jmfTest.setVisible(true);
}