Search in sources :

Example 1 with SpeexMediaManager

use of org.jivesoftware.smackx.jingle.mediaimpl.jspeex.SpeexMediaManager in project Smack by igniterealtime.

the class Demo method initialize.

public void initialize() {
    ICETransportManager icetm0 = new ICETransportManager(xmppConnection, "10.47.47.53", 3478);
    List<JingleMediaManager> mediaManagers = new ArrayList<JingleMediaManager>();
    //mediaManagers.add(new JmfMediaManager(icetm0));
    mediaManagers.add(new SpeexMediaManager(icetm0));
    mediaManagers.add(new ScreenShareMediaManager(icetm0));
    jm = new JingleManager(xmppConnection, mediaManagers);
    jm.addCreationListener(icetm0);
    jm.addJingleSessionRequestListener(new JingleSessionRequestListener() {

        public void sessionRequested(JingleSessionRequest request) {
            try {
                // Accept the call
                incoming = request.accept();
                // Start the call
                incoming.startIncoming();
            } catch (XMPPException e) {
                LOGGER.log(Level.WARNING, "exception", e);
            }
        }
    });
    createGUI();
}
Also used : ICETransportManager(org.jivesoftware.smackx.jingle.nat.ICETransportManager) JingleMediaManager(org.jivesoftware.smackx.jingle.media.JingleMediaManager) ArrayList(java.util.ArrayList) JingleManager(org.jivesoftware.smackx.jingle.JingleManager) JingleSessionRequest(org.jivesoftware.smackx.jingle.JingleSessionRequest) ScreenShareMediaManager(org.jivesoftware.smackx.jingle.mediaimpl.sshare.ScreenShareMediaManager) SpeexMediaManager(org.jivesoftware.smackx.jingle.mediaimpl.jspeex.SpeexMediaManager) XMPPException(org.jivesoftware.smack.XMPPException) JingleSessionRequestListener(org.jivesoftware.smackx.jingle.listeners.JingleSessionRequestListener)

Example 2 with SpeexMediaManager

use of org.jivesoftware.smackx.jingle.mediaimpl.jspeex.SpeexMediaManager in project Smack by igniterealtime.

the class JingleMediaTest method testCompleteMulti.

public void testCompleteMulti() {
    try {
        XMPPTCPConnection x0 = getConnection(0);
        XMPPTCPConnection x1 = getConnection(1);
        ICETransportManager icetm0 = new ICETransportManager(x0, "jivesoftware.com", 3478);
        ICETransportManager icetm1 = new ICETransportManager(x1, "jivesoftware.com", 3478);
        MultiMediaManager jingleMediaManager0 = new MultiMediaManager(icetm0);
        jingleMediaManager0.addMediaManager(new JmfMediaManager(icetm0));
        jingleMediaManager0.addMediaManager(new SpeexMediaManager(icetm0));
        jingleMediaManager0.setPreferredPayloadType(jingleMediaManager0.getPayloads().get(1));
        List<JingleMediaManager> jml0 = new ArrayList<JingleMediaManager>();
        jml0.add(jingleMediaManager0);
        MultiMediaManager jingleMediaManager1 = new MultiMediaManager(icetm1);
        jingleMediaManager1.addMediaManager(new JmfMediaManager(icetm1));
        jingleMediaManager1.addMediaManager(new SpeexMediaManager(icetm1));
        jingleMediaManager1.setPreferredPayloadType(jingleMediaManager1.getPayloads().get(2));
        List<JingleMediaManager> jml1 = new ArrayList<JingleMediaManager>();
        jml1.add(jingleMediaManager1);
        final JingleManager jm0 = new JingleManager(x0, jml0);
        final JingleManager jm1 = new JingleManager(x1, jml1);
        jm0.addCreationListener(icetm0);
        jm1.addCreationListener(icetm1);
        jm1.addJingleSessionRequestListener(new JingleSessionRequestListener() {

            public void sessionRequested(final JingleSessionRequest request) {
                try {
                    JingleSession session = request.accept();
                    try {
                        Thread.sleep(12000);
                    } catch (InterruptedException e) {
                        LOGGER.log(Level.WARNING, "exception", e);
                    }
                    session.startIncoming();
                } catch (XMPPException e) {
                    LOGGER.log(Level.WARNING, "exception", e);
                }
            }
        });
        for (int i = 0; i < 10; i++) {
            JingleSession js0 = jm0.createOutgoingJingleSession(x1.getUser());
            //                js0.addStateListener(new JingleSessionStateListener() {
            //
            //                    public void beforeChange(JingleNegotiator.State old, JingleNegotiator.State newOne)
            //                            throws JingleNegotiator.JingleException {
            //                    }
            //
            //                    public void afterChanged(JingleNegotiator.State old, JingleNegotiator.State newOne) {
            //                        if (newOne != null) {
            //                            if ((newOne instanceof OutgoingJingleSession.Active))
            //                                System.err.println("|||" + newOne.getClass().getCanonicalName() + "|||");
            //                        }
            //                    }
            //                });
            js0.startOutgoing();
            Thread.sleep(45000);
            js0.terminate();
            Thread.sleep(1500);
        }
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "exception", e);
    }
}
Also used : JmfMediaManager(org.jivesoftware.smackx.jingle.mediaimpl.jmf.JmfMediaManager) ICETransportManager(org.jivesoftware.smackx.jingle.nat.ICETransportManager) ArrayList(java.util.ArrayList) MultiMediaManager(org.jivesoftware.smackx.jingle.mediaimpl.multi.MultiMediaManager) JingleSessionRequestListener(org.jivesoftware.smackx.jingle.listeners.JingleSessionRequestListener) XMPPException(org.jivesoftware.smack.XMPPException) JingleMediaManager(org.jivesoftware.smackx.jingle.media.JingleMediaManager) SpeexMediaManager(org.jivesoftware.smackx.jingle.mediaimpl.jspeex.SpeexMediaManager) XMPPException(org.jivesoftware.smack.XMPPException)

Example 3 with SpeexMediaManager

use of org.jivesoftware.smackx.jingle.mediaimpl.jspeex.SpeexMediaManager in project Smack by igniterealtime.

the class JingleMediaTest method testCompleteSpeex.

public void testCompleteSpeex() {
    try {
        //SmackConfiguration.DEBUG = true;
        XMPPTCPConnection x0 = getConnection(0);
        XMPPTCPConnection x1 = getConnection(1);
        JingleMediaManager jingleMediaManager0 = new SpeexMediaManager(new STUNTransportManager());
        JingleMediaManager jingleMediaManager1 = new SpeexMediaManager(new STUNTransportManager());
        List<JingleMediaManager> jml0 = new ArrayList<JingleMediaManager>();
        List<JingleMediaManager> jml1 = new ArrayList<JingleMediaManager>();
        jml0.add(jingleMediaManager0);
        jml1.add(jingleMediaManager1);
        final JingleManager jm0 = new JingleManager(x0, jml0);
        final JingleManager jm1 = new JingleManager(x1, jml1);
        jm1.addJingleSessionRequestListener(new JingleSessionRequestListener() {

            public void sessionRequested(final JingleSessionRequest request) {
                try {
                    JingleSession session = request.accept();
                    session.startIncoming();
                } catch (XMPPException e) {
                    LOGGER.log(Level.WARNING, "exception", e);
                }
            }
        });
        JingleSession js0 = jm0.createOutgoingJingleSession(x1.getUser());
        js0.startOutgoing();
        Thread.sleep(150000);
        js0.terminate();
        Thread.sleep(6000);
        x0.disconnect();
        x1.disconnect();
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "exception", e);
    }
}
Also used : JingleMediaManager(org.jivesoftware.smackx.jingle.media.JingleMediaManager) ArrayList(java.util.ArrayList) SpeexMediaManager(org.jivesoftware.smackx.jingle.mediaimpl.jspeex.SpeexMediaManager) XMPPException(org.jivesoftware.smack.XMPPException) JingleSessionRequestListener(org.jivesoftware.smackx.jingle.listeners.JingleSessionRequestListener) XMPPException(org.jivesoftware.smack.XMPPException) STUNTransportManager(org.jivesoftware.smackx.jingle.nat.STUNTransportManager)

Aggregations

ArrayList (java.util.ArrayList)3 XMPPException (org.jivesoftware.smack.XMPPException)3 JingleSessionRequestListener (org.jivesoftware.smackx.jingle.listeners.JingleSessionRequestListener)3 JingleMediaManager (org.jivesoftware.smackx.jingle.media.JingleMediaManager)3 SpeexMediaManager (org.jivesoftware.smackx.jingle.mediaimpl.jspeex.SpeexMediaManager)3 ICETransportManager (org.jivesoftware.smackx.jingle.nat.ICETransportManager)2 JingleManager (org.jivesoftware.smackx.jingle.JingleManager)1 JingleSessionRequest (org.jivesoftware.smackx.jingle.JingleSessionRequest)1 JmfMediaManager (org.jivesoftware.smackx.jingle.mediaimpl.jmf.JmfMediaManager)1 MultiMediaManager (org.jivesoftware.smackx.jingle.mediaimpl.multi.MultiMediaManager)1 ScreenShareMediaManager (org.jivesoftware.smackx.jingle.mediaimpl.sshare.ScreenShareMediaManager)1 STUNTransportManager (org.jivesoftware.smackx.jingle.nat.STUNTransportManager)1