Class AudioMediaSession

  • All Implemented Interfaces:
    mil.jfcom.cie.media.session.MediaSessionListener

    public class AudioMediaSession
    extends JingleMediaSession
    implements mil.jfcom.cie.media.session.MediaSessionListener
    This Class implements a complete JingleMediaSession. It should be used to transmit and receive audio captured from the Mic. This Class should be automatically controlled by JingleSession. But you could also use in any VOIP application. For better NAT Traversal support this implementation don't support only receive or only transmit. To receive you MUST transmit. So the only implemented and functionally methods are startTransmit() and stopTransmit()
    • Constructor Detail

      • AudioMediaSession

        public AudioMediaSession​(PayloadType payloadType,
                                 TransportCandidate remote,
                                 TransportCandidate local,
                                 java.lang.String locator,
                                 JingleSession jingleSession)
        Creates a org.jivesoftware.jingleaudio.jspeex.AudioMediaSession with defined payload type, remote and local candidates.
        Parameters:
        payloadType - Payload of the jmf
        remote - the remote information. The candidate that the jmf will be sent to.
        local - the local information. The candidate that will receive the jmf
        locator - media locator
        jingleSession - the jingle session.
    • Method Detail

      • createSession

        public static mil.jfcom.cie.media.session.MediaSession createSession​(java.lang.String localhost,
                                                                             int localPort,
                                                                             java.lang.String remoteHost,
                                                                             int remotePort,
                                                                             mil.jfcom.cie.media.session.MediaSessionListener eventHandler,
                                                                             int quality,
                                                                             boolean secure,
                                                                             boolean micOn)
                                                                      throws javax.media.NoProcessorException,
                                                                             javax.media.format.UnsupportedFormatException,
                                                                             java.io.IOException,
                                                                             java.security.GeneralSecurityException
        Create a Session using Speex Codec.
        Parameters:
        localhost - localHost
        localPort - localPort
        remoteHost - remoteHost
        remotePort - remotePort
        eventHandler - eventHandler
        quality - quality
        secure - secure
        micOn - micOn
        Returns:
        MediaSession TODO javadoc me please
        Throws:
        javax.media.NoProcessorException - if there is no media processor.
        javax.media.format.UnsupportedFormatException - if the format is not supported.
        java.io.IOException - if an I/O error occurred.
        java.security.GeneralSecurityException - if there was a geneeral security exception.
      • startTrasmit

        @Deprecated
        public void startTrasmit()
        Deprecated.
        use startTransmit() instead.
        Starts transmission and for NAT Traversal reasons start receiving also.
      • setTrasmit

        @Deprecated
        public void setTrasmit​(boolean active)
        Deprecated.
        Set transmit activity. If the active is true, the instance should transmit. If it is set to false, the instance should pause transmit.
        Parameters:
        active - active state
      • setTransmit

        public void setTransmit​(boolean active)
        Set transmit activity. If the active is true, the instance should transmit. If it is set to false, the instance should pause transmit.
        Specified by:
        setTransmit in class JingleMediaSession
        Parameters:
        active - active state
      • stopTrasmit

        @Deprecated
        public void stopTrasmit()
        Deprecated.
        use stopTransmit() instead.
        Stops transmission and for NAT Traversal reasons stop receiving also.
      • newStreamIdentified

        public void newStreamIdentified​(mil.jfcom.cie.media.session.StreamPlayer streamPlayer)
        Specified by:
        newStreamIdentified in interface mil.jfcom.cie.media.session.MediaSessionListener
      • senderReportReceived

        public void senderReportReceived​(javax.media.rtp.rtcp.SenderReport report)
        Specified by:
        senderReportReceived in interface mil.jfcom.cie.media.session.MediaSessionListener
      • streamClosed

        public void streamClosed​(mil.jfcom.cie.media.session.StreamPlayer stream,
                                 boolean timeout)
        Specified by:
        streamClosed in interface mil.jfcom.cie.media.session.MediaSessionListener
      • getFreePort

        protected int getFreePort()
        Obtain a free port we can use.
        Returns:
        A free port number.