コード例 #1
0
ファイル: jingle.py プロジェクト: slokhorst/gajim
 def start_audio(self, jid):
     if self.get_jingle_session(jid, media='audio'):
         return self.get_jingle_session(jid, media='audio').sid
     jingle = self.get_jingle_session(jid, media='video')
     if jingle:
         jingle.add_content('voice', JingleAudio(jingle))
     else:
         jingle = JingleSession(self._con, weinitiate=True, jid=jid)
         self._sessions[jingle.sid] = jingle
         jingle.add_content('voice', JingleAudio(jingle))
         jingle.start_session()
     return jingle.sid
コード例 #2
0
ファイル: jingle.py プロジェクト: slokhorst/gajim
    def start_audio_video(self, jid):
        if self.get_jingle_session(jid, media='video'):
            return self.get_jingle_session(jid, media='video').sid
        audio_session = self.get_jingle_session(jid, media='audio')
        video_session = self.get_jingle_session(jid, media='video')
        if audio_session and video_session:
            return audio_session.sid
        if audio_session:
            video = JingleVideo(audio_session)
            audio_session.add_content('video', video)
            return audio_session.sid
        if video_session:
            audio = JingleAudio(video_session)
            video_session.add_content('audio', audio)
            return video_session.sid

        jingle_session = JingleSession(self._con, weinitiate=True, jid=jid)
        self._sessions[jingle_session.sid] = jingle_session
        audio = JingleAudio(jingle_session)
        video = JingleVideo(jingle_session)
        jingle_session.add_content('audio', audio)
        jingle_session.add_content('video', video)
        jingle_session.start_session()
        return jingle_session.sid