import com.sun.media.jmc.Media; import com.sun.media.jmc.MediaProvider; import com.sun.media.jmc.control.VideoControl; import com.sun.media.jmc.control.VideoRenderControl; import com.sun.media.jmc.event.BufferDownloadListener; import com.sun.media.jmc.event.BufferDownloadedProgressChangedEvent; import com.sun.media.jmc.event.DurationChangedEvent; import com.sun.media.jmc.event.MediaDurationListener; import com.sun.media.jmc.event.MediaSizeListener; import com.sun.media.jmc.event.MediaStateEvent; import com.sun.media.jmc.event.MediaStateListener; import com.sun.media.jmc.event.SizeChangedEvent; import com.sun.media.jmc.event.VideoRendererEvent; import com.sun.media.jmc.event.VideoRendererListener; import com.sun.media.jmc.track.MediaTrack; import com.sun.media.jmc.type.ContainerType; import com.sun.media.jmc.type.ProtocolType; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.GraphicsEnvironment; import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.net.URI; import java.util.List; import java.util.Map; import javax.swing.JComponent; import javax.swing.JFileChooser; import javax.swing.JFrame; /** * * @author Tamer */ public class Main { public Main() { JFileChooser chooser = new JFileChooser("D:/filimler/stargate/1/SG.A.05.01/"); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { URI resource = chooser.getSelectedFile().toURI(); final MediaProvider mediaProvider = new MediaProvider(resource); // Media akışı (streamming) kullanmak istyorsanız başına // (açıklama) ekleyin. //final MediaProvider mediaProvider = new MediaProvider(URI.create("http://sun.edgeboss.net/download/sun/media/1460825906/1460825906_2956241001_big-buck-bunny-640x360.flv")); // Media akışı (streamming) kullanmak istyorsanız başına // (açıklama) ekleyin. // System.out.println(mediaProvider.getCapabilities()); // System.out.println(mediaProvider.getControls()); // System.out.println(mediaProvider.getCurrentPlayCount()); // System.out.println(mediaProvider.getDuration()); // System.out.println(mediaProvider.getMediaTime()); // System.out.println(mediaProvider.getName()); // System.out.println(mediaProvider.getPlayCount()); // System.out.println(mediaProvider.getRate()); // System.out.println(mediaProvider.getSource()); // System.out.println(mediaProvider.getStartTime()); // System.out.println(mediaProvider.getStopTime()); mediaProvider.addBufferDownloadListener(new BufferDownloadListener() { public void mediaDownloadProgressChanged(BufferDownloadedProgressChangedEvent arg0) { System.out.println(arg0.getProgress()); } }); mediaProvider.addMediaDurationListener(new MediaDurationListener() { public void mediaDurationChanged(DurationChangedEvent arg0) { System.out.println(arg0); } }); mediaProvider.addMediaSizeListener(new MediaSizeListener() { public void mediaSizeChanged(SizeChangedEvent arg0) { System.out.println(arg0); } }); mediaProvider.addMediaStateListener(new MediaStateListener() { public void endOfMediaReached(MediaStateEvent arg0) { System.out.println(arg0); } public void playerStarted(MediaStateEvent arg0) { System.out.println(arg0); } public void playerStopped(MediaStateEvent arg0) { System.out.println(arg0); } public void playerRepeated(MediaStateEvent arg0) { System.out.println(arg0); } public void stopTimeReached(MediaStateEvent arg0) { System.out.println(arg0); } }); mediaProvider.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { System.out.println(evt.getPropertyName()); } }); VideoControl control = mediaProvider.getControl(VideoControl.class); final JComponent videoPane = control.getVideoPane(); videoPane.setIgnoreRepaint(true); final JFrame window = new JFrame(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.add(videoPane); window.pack(); window.setVisible(true); //control.setResizeBehavior(VideoControl.ResizeBehavior.Stretch); // System.out.println(videoPane.getIgnoreRepaint()); window.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getFullScreenWindow() != null) { GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(null); window.dispose(); window.add(videoPane); window.setIgnoreRepaint(false); // Tam ekran apisi için gerekli videoPane.setIgnoreRepaint(false); window.setUndecorated(false); window.setResizable(true); window.pack(); window.setVisible(true); // AWTUtilities.setWindowShape(window, new Ellipse2D.Float(0, 0, 500, 500)); // Pencereyi belirli bir şekle ayarlar. Ancak window.setUndecorated(true); olarak ayarlanmalıdır. } else { window.dispose();
Nedir Java2D
-
Bu yazımda Java2D ile ilgili giriş bilgileri vereceğim. Hemen şunu söylemek
isterim ki bu yazı kod içermiyor. Bu yazıda daha çok grafik ile ilgili
sohbette...
14 yıl önce
Hiç yorum yok:
Yorum Gönder