Search in sources :

Example 1 with JingleSessionListener

use of org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener in project Smack by igniterealtime.

the class ContentNegotiator method triggerContentEstablished.

/**
     * Trigger a session established event.
     * @throws NotConnectedException 
     * @throws InterruptedException 
     */
private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) throws NotConnectedException, InterruptedException {
    // Let the session know that we've established a content/media segment.
    JingleSession session = getSession();
    if (session != null) {
        List<JingleListener> listeners = session.getListenersList();
        for (JingleListener li : listeners) {
            if (li instanceof JingleSessionListener) {
                JingleSessionListener sli = (JingleSessionListener) li;
                sli.sessionEstablished(pt, rc, lc, session);
            }
        }
    }
    // Create a media session for each media manager in the session.
    if (mediaNeg.getMediaManager() != null) {
        rc.removeCandidateEcho();
        lc.removeCandidateEcho();
        jingleMediaSession = getMediaNegotiator().getMediaManager().createMediaSession(pt, rc, lc, session);
        jingleMediaSession.addMediaReceivedListener(session);
        if (jingleMediaSession != null) {
            jingleMediaSession.startTrasmit();
            jingleMediaSession.startReceive();
            for (TransportCandidate candidate : getTransportNegotiator().getOfferedCandidates()) candidate.removeCandidateEcho();
        }
        JingleMediaManager mediaManager = getMediaNegotiator().getMediaManager();
        getSession().addJingleMediaSession(mediaManager.getName(), jingleMediaSession);
    }
}
Also used : JingleListener(org.jivesoftware.smackx.jingleold.listeners.JingleListener) TransportCandidate(org.jivesoftware.smackx.jingleold.nat.TransportCandidate) JingleMediaManager(org.jivesoftware.smackx.jingleold.media.JingleMediaManager) JingleSessionListener(org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener)

Example 2 with JingleSessionListener

use of org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener in project Smack by igniterealtime.

the class JingleSession method triggerSessionClosedOnError.

/**
     * Trigger a session closed event due to an error.
     */
protected void triggerSessionClosedOnError(XMPPException exc) {
    for (ContentNegotiator contentNegotiator : contentNegotiators) {
        contentNegotiator.stopJingleMediaSession();
        for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates()) candidate.removeCandidateEcho();
    }
    List<JingleListener> listeners = getListenersList();
    for (JingleListener li : listeners) {
        if (li instanceof JingleSessionListener) {
            JingleSessionListener sli = (JingleSessionListener) li;
            sli.sessionClosedOnError(exc, this);
        }
    }
    close();
}
Also used : JingleListener(org.jivesoftware.smackx.jingleold.listeners.JingleListener) TransportCandidate(org.jivesoftware.smackx.jingleold.nat.TransportCandidate) JingleSessionListener(org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener)

Example 3 with JingleSessionListener

use of org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener in project Smack by igniterealtime.

the class JingleSession method triggerSessionClosed.

// Triggers
/**
     * Trigger a session closed event.
     */
protected void triggerSessionClosed(String reason) {
    //        for (ContentNegotiator contentNegotiator : contentNegotiators) {
    //
    //            contentNegotiator.stopJingleMediaSession();
    //
    //            for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
    //                candidate.removeCandidateEcho();
    //        }
    List<JingleListener> listeners = getListenersList();
    for (JingleListener li : listeners) {
        if (li instanceof JingleSessionListener) {
            JingleSessionListener sli = (JingleSessionListener) li;
            sli.sessionClosed(reason, this);
        }
    }
    close();
}
Also used : JingleListener(org.jivesoftware.smackx.jingleold.listeners.JingleListener) JingleSessionListener(org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener)

Example 4 with JingleSessionListener

use of org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener in project Smack by igniterealtime.

the class JingleSession method triggerMediaReceived.

/**
     * Trigger a session established event.
     */
//    protected void triggerSessionEstablished() {
//        List<JingleListener> listeners = getListenersList();
//        for (JingleListener li : listeners) {
//            if (li instanceof JingleSessionListener) {
//                JingleSessionListener sli = (JingleSessionListener) li;
//                sli.sessionEstablished(this);
//            }
//        }
//    }
/**
     * Trigger a media received event.
     */
protected void triggerMediaReceived(String participant) {
    List<JingleListener> listeners = getListenersList();
    for (JingleListener li : listeners) {
        if (li instanceof JingleSessionListener) {
            JingleSessionListener sli = (JingleSessionListener) li;
            sli.sessionMediaReceived(this, participant);
        }
    }
}
Also used : JingleListener(org.jivesoftware.smackx.jingleold.listeners.JingleListener) JingleSessionListener(org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener)

Aggregations

JingleListener (org.jivesoftware.smackx.jingleold.listeners.JingleListener)4 JingleSessionListener (org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener)4 TransportCandidate (org.jivesoftware.smackx.jingleold.nat.TransportCandidate)2 JingleMediaManager (org.jivesoftware.smackx.jingleold.media.JingleMediaManager)1