def ice_candidate(self, data, clientId, done): #Manage the ice candidate for communicating with Janus from client if 'sessionId' in data and 'candidate' in data: candidate = data['candidate'] if candidate: webRtcManager().tickleIceCandidate(data['sessionId'], candidate['candidate'], candidate['sdpMid'], candidate['sdpMLineIndex']) else: webRtcManager().reportEndOfIceCandidates(data['sessionId']) done(None)
def init_connection(self, data, clientId, done): #initialize the session on Janus #if there is not any session before, Janus is stopped, #so it will turn Janus on sessionId = webRtcManager().startPeerSession(clientId) if sessionId: done({ 'success': True, 'sessionId': sessionId }) else: done({ 'error': True, 'message': 'Unable to start a session' })
def _haltCamera(self): self.close_camera() webRtcManager().closeAllSessions()
def closeLocalVideoSession(self, sessionId): return webRtcManager().closeLocalSession(sessionId)
def shutdown(self): self._logger.info('Shutting Down GstreamerManager') self._freeApPipeline() self._haltCamera() webRtcManager().shutdown()
def startStreaming(self, data, sendResponse): webRtcManager().startVideoStream() sendResponse({'success': 'no-error'})
def initJanus(self, sendResponse): #Start session in Janus if webRtcManager().startJanus(): sendResponse({'success': 'no-error'}) else: sendResponse('error_init_janus', True)
def stop_connection(self, sessionId, clientId, done): #Stop Janus session #if this is the last (or unique) session in Janus, #Janus will be stopped (of course, Gstreamer too) webRtcManager().closePeerSession(sessionId) done(None)
def start_connection(self, data, clientId, done): #Start Janus session and it starts to share video sessionId = data['sessionId'] webRtcManager().setSessionDescriptionAndStart(sessionId, data) done(None)
def start_plugin(self, data, clientId, done): #Manage the plugin and the type of video source: VP8 or H264 webRtcManager().preparePlugin(data['sessionId']) done(None)