Search in sources :

Example 1 with AudioChannel

use of org.jivesoftware.smackx.jingle.mediaimpl.jmf.AudioChannel in project Smack by igniterealtime.

the class JingleMediaTest method testAudioChannelOpenClose.

public void testAudioChannelOpenClose() {
    for (int i = 0; i < 5; i++) {
        try {
            AudioChannel audioChannel0 = new AudioChannel(new MediaLocator("javasound://"), InetAddress.getLocalHost().getHostAddress(), InetAddress.getLocalHost().getHostAddress(), 7002, 7020, new AudioFormat(AudioFormat.GSM_RTP), null);
            AudioChannel audioChannel1 = new AudioChannel(new MediaLocator("javasound://"), InetAddress.getLocalHost().getHostAddress(), InetAddress.getLocalHost().getHostAddress(), 7020, 7002, new AudioFormat(AudioFormat.GSM_RTP), null);
            audioChannel0.start();
            audioChannel1.start();
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                LOGGER.log(Level.WARNING, "exception", e);
            }
            audioChannel0.stop();
            audioChannel1.stop();
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                LOGGER.log(Level.WARNING, "exception", e);
            }
        } catch (Exception e) {
            LOGGER.log(Level.WARNING, "exception", e);
        }
    }
}
Also used : MediaLocator(javax.media.MediaLocator) AudioChannel(org.jivesoftware.smackx.jingle.mediaimpl.jmf.AudioChannel) AudioFormat(javax.media.format.AudioFormat) XMPPException(org.jivesoftware.smack.XMPPException)

Example 2 with AudioChannel

use of org.jivesoftware.smackx.jingle.mediaimpl.jmf.AudioChannel in project Smack by igniterealtime.

the class JingleMediaTest method testAudioChannelStartStop.

public void testAudioChannelStartStop() {
    try {
        AudioChannel audioChannel0 = new AudioChannel(new MediaLocator("javasound://"), InetAddress.getLocalHost().getHostAddress(), InetAddress.getLocalHost().getHostAddress(), 7002, 7020, new AudioFormat(AudioFormat.GSM_RTP), null);
        AudioChannel audioChannel1 = new AudioChannel(new MediaLocator("javasound://"), InetAddress.getLocalHost().getHostAddress(), InetAddress.getLocalHost().getHostAddress(), 7020, 7002, new AudioFormat(AudioFormat.GSM_RTP), null);
        for (int i = 0; i < 5; i++) {
            audioChannel0.start();
            audioChannel1.start();
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                LOGGER.log(Level.WARNING, "exception", e);
            }
            audioChannel0.stop();
            audioChannel1.stop();
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                LOGGER.log(Level.WARNING, "exception", e);
            }
        }
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "exception", e);
    }
}
Also used : MediaLocator(javax.media.MediaLocator) AudioChannel(org.jivesoftware.smackx.jingle.mediaimpl.jmf.AudioChannel) AudioFormat(javax.media.format.AudioFormat) XMPPException(org.jivesoftware.smack.XMPPException)

Aggregations

MediaLocator (javax.media.MediaLocator)2 AudioFormat (javax.media.format.AudioFormat)2 XMPPException (org.jivesoftware.smack.XMPPException)2 AudioChannel (org.jivesoftware.smackx.jingle.mediaimpl.jmf.AudioChannel)2