送信の設定は ライブ配信テスト:JMF で確認。
import javax.media.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; /** Media Frame */ public class ReceiverTest extends JFrame { private Player player = null; private InputPanel ipanel; private Component canvas; private Component panel; private static final int PORT = 22224; public ReceiverTest() { super( "RTP Receiver" ); ipanel = new InputPanel(); getContentPane().add( ipanel, "North" ); pack(); } /** start play */ public void startPlayer() { try { MediaLocator locator = new MediaLocator( "rtp://" + ipanel.host.getText() + ":" + PORT + "/video" ); player = Manager.createRealizedPlayer( locator ); canvas = player.getVisualComponent(); if ( canvas != null) { getContentPane().add( canvas, "Center" ); } panel = player.getControlPanelComponent(); if ( panel != null) { getContentPane().add( panel, "South" ); } pack(); player.start(); } catch (Throwable t) { t.printStackTrace(); } } /** start here */ public static void main(String[] args) { try { ReceiverTest frame = new ReceiverTest(); frame.show(); } catch (Throwable t) { t.printStackTrace(); } } /** Input receive host name, port number */ class InputPanel extends JPanel implements ActionListener { public JLabel label = new JLabel( "Transmitter Adress:" ); public JTextField host = new JTextField( "", 16 ); public JButton receive = new JButton( "Receive" ); InputPanel() { add( label ); add( host ); add( receive ); receive.addActionListener( this ); } /** Event Processing */ public void actionPerformed( ActionEvent evt ) { if( evt.getSource() instanceof JButton ) { if( (JButton)(evt.getSource()) == receive ) { startPlayer(); } } } } }
0 件のコメント:
コメントを投稿