Exemplo n.º 1
0
 def get_incoming(self):
     if self.incoming_endpoint_id:
         incoming = media.WebRtcEndpoint(self.room.get_pipeline(),
                                         id=self.incoming_endpoint_id)
     else:
         incoming = media.WebRtcEndpoint(self.room.get_pipeline())
         self.incoming_endpoint_id = incoming.id
         session = get_session()
         session.add(self)
         session.commit()
     return incoming
Exemplo n.º 2
0
    def post(self):
        sdp_offer = self.request.body
        pipeline = kurento.create_pipeline()
        wrtc = media.WebRtcEndpoint(pipeline)

        wrtc.on_media_session_started_event(self.on_event)
        wrtc.on_media_session_terminated_event(self.on_event)

        sdp_answer = wrtc.process_offer(sdp_offer)
        self.finish(str(sdp_answer))

        # setup recording
        recorder = media.RecorderEndpoint(pipeline,
                                          uri="file:///tmp/test.webm")
        wrtc.connect(recorder)
        recorder.record()

        # plain old loopback
        # wrtc.connect(wrtc)

        # fun face overlay
        face = media.FaceOverlayFilter(pipeline)
        face.set_overlayed_image(
            "https://raw.githubusercontent.com/minervaproject/pykurento/master/example/static/img/rainbowpox.png",
            0, 0, 1, 1)
        wrtc.connect(face)
        face.connect(wrtc)
Exemplo n.º 3
0
 def disconnect(self):
     incoming = self.get_incoming()
     outgoing = media.WebRtcEndpoint(get_pipeline())
     incoming.disconnect(outgoing)
     self.pipeline_id = None
     session = get_session()
     session.add(self)
     session.commit()
Exemplo n.º 4
0
 def get_incoming(self):
     # if self.incoming_endpoint_id:
     #     incoming = media.WebRtcEndpoint(get_pipeline(), id=self.incoming_endpoint_id)
     # else:
     #     incoming = media.WebRtcEndpoint(get_pipeline())
     #     self.incoming_endpoint_id = incoming.id
     #     session = get_session()
     #     session.add(self)
     #     session.commit()
     incoming = media.WebRtcEndpoint(get_pipeline())
     return incoming
Exemplo n.º 5
0
  def post(self):
    sdp_offer = self.request.body
    pipeline = kurento.create_pipeline()
    MultiResHandler.incoming = media.WebRtcEndpoint(pipeline)
    MultiResHandler.high_res = MultiResHandler.incoming
    MultiResHandler.low_res = media.GStreamerFilter(pipeline, command="capsfilter caps=video/x-raw,width=160,height=120", filterType="VIDEO")
    MultiResHandler.med_res = media.GStreamerFilter(pipeline, command="capsfilter caps=video/x-raw,width=320,height=240", filterType="VIDEO")

    sdp_answer = MultiResHandler.incoming.process_offer(sdp_offer)
    self.finish(str(sdp_answer))

    MultiResHandler.high_res.connect(MultiResHandler.incoming)
    MultiResHandler.incoming.connect(MultiResHandler.low_res)
    MultiResHandler.incoming.connect(MultiResHandler.med_res)
Exemplo n.º 6
0
    def internalEndpointInitialization(self, endpointLatch):
        if self.isWeb():
            self.webEndpoint = media.WebRtcEndpoint(self.pipeline)
            if self.dataChannels:
                self.webEndpoint.useDataChannels()
            #todo
            self.webEndpoint.setMaxVideoRecvBandwidth(600)
            self.webEndpoint.setMinVideoRecvBandwidth(300)
            self.webEndpoint.setMaxVideoSendBandwidth(600)
            self.webEndpoint.setMinVideoSendBandwidth(300)
            self.webEndpoint.OnIceCandidate()
            endpointLatch.countDown()

            print("EP {%s}: Created a new WebRtcEndpoint" % self.endpointName)
            self.endpointSubscription = self.registerElemErrListener(
                self.webEndpoint)
Exemplo n.º 7
0
    def __init__(self, session):
        self.pipeline = None
        self.webRtc = None
        self.player = None
        self.recording_path = "file:///tmp/dd"
        self.recording_ext = ".webm"

        self.pipeline = kurento.create_pipeline()

        self.webRtc = media.WebRtcEndpoint(self.pipeline)
        self.player = media.PlayerEndpoint(self.pipeline,
                                           uri=self.recording_path +
                                           "_caller" + self.recording_ext)
        self.session = session

        # Connection
        self.player.connect(self.webRtc)

        # Player listeners
        self.player.addErrorListener(self.onErrorEvent)
Exemplo n.º 8
0
 def connect(self, offer):
     incoming = self.get_incoming()
     outgoing = media.WebRtcEndpoint(self.room.get_pipeline())
     incoming.connect(outgoing)
     return outgoing.process_offer(offer)
Exemplo n.º 9
0
 def record(self):
     wrtc = media.WebRtcEndpoint(get_pipeline())
     recorder = media.RecorderEndpoint(get_pipeline(),
                                       uri="file:///tmp/test.webm")
     wrtc.connect(recorder)
     recorder.record()
Exemplo n.º 10
0
 def get_candidates(self):
     wrtc = media.WebRtcEndpoint(get_pipeline())
     wrtc.gather_candidates()
     time.sleep(10)
     return kurento.get_ice_candidates()
Exemplo n.º 11
0
 def ice_candidate_found(self, sdp_offer):
     wrtc = media.WebRtcEndpoint(get_pipeline())
     wrtc.ice_candidate_found(self.on_event)
     wrtc.process_offer(sdp_offer)
     wrtc.gather_candidates()
Exemplo n.º 12
0
 def add_candidate(self, candidate):
     wrtc = media.WebRtcEndpoint(get_pipeline())
     wrtc.add_ice_candidate(candidate)