Endpoints

class pyforkurento.endpoints.Endpoint(sess_id, point_id, pipeline_class)

Bases: pyforkurento.media_element.MediaElement

All endpoints base class

class pyforkurento.endpoints.PlayerEndpoint(session_id, elem_id, pipeline_class)

Bases: pyforkurento.endpoints.Endpoint

An input endpoint that retrieves content from file system, HTTP URL or RTSP URL and injects it into the media pipeline.

add_event_listener(event, callback)

Adds an event listener function for a specific PlayerEndpoint event or a general MediaElement event

connect(sink_elem=None)

Connect PlayerEndpoint to another element

Params:

sink_elem (obj): Media Element to connect to. If left blank, the element connects to itself

pause()

Pause playing the media item

play()

Start playing the media item

stop()

Stop playing the media item

class pyforkurento.endpoints.WebRTCEndpoint(session_id, elem_id, pipeline_class)

Bases: pyforkurento.endpoints.Endpoint

An output and input endpoint that provides media streaming for Real Time Communications (RTC) through the web. It implements WebRTC technology to communicate with browsers.

add_event_listener(event, callback)

Adds an event listener function for a specific WebRTCEndpoint event or a general MediaElement event

Params:
  • event (str): The event to listen for. Accepted:
    • OnIceCandidate - Invoked when KMS starts generating ICE candidates

    • OnIceGatheringDone - Invoked when KMS is done gathering ICE candidates

  • callback (func): Function to be called when event is registered

add_ice_candidate(candidate)

Adds Ice Candidate recevied from the WebRTC client to KMS

Params:
  • candidate (ICE): The ICE Candidate from the client

connect(sink_elem=None)

Connect WebRTCEndpoint to another element

Params:

sink_elem (obj): Media Element to connect to. If left blank, the element connects to itself

gather_ice_candidates()

Triggers ICE candidate generation by KMS. Call this method AFTER adding an event listener for ‘OnIceCandidate’

process_offer(session_desc_offer)

Process the Session Description Protocol offer generated by the client

Params:
  • session_desc_offer (str): SDP payload from a WebRTC client

Returns

SDP answer from KMS. If a problem occured, sdp_answer is set to be ‘error’

Return type

  • sdp_answer (str)

class pyforkurento.endpoints.RecorderEndpoint(session_id, elem_id, pipeline_class)

Bases: pyforkurento.endpoints.Endpoint

An output endpoint that provides function to store contents in reliable mode (doesn’t discard data).

add_event_listener(event, callback)

Adds an event listener function for a specific RecorderEndpoint event or a general MediaElement event

Params:
  • event (str): The event to listen for. Accepted:
    • Recording - Invoked when the media recording effectively starts

  • callback (func): Function to be called when event is registered

connect(sink_elem=None)

Connect RecorderEndpoint to another element

Params:

sink_elem (obj): Media Element to connect to. If left blank, the element connects to itself

record()

Start the recording the media item

stop()

Stops the recording

class pyforkurento.endpoints.RTPEndpoint(session_id, elem_id, pipeline_class)

Bases: pyforkurento.endpoints.Endpoint

An output and input endpoint. That is, provides bidirectional content delivery capabilities with remote networked peers through RTP protocol.

class pyforkurento.endpoints.HTTPPostEndpoint(session_id, elem_id, pipeline_class)

Bases: pyforkurento.endpoints.Endpoint

An input endpoint that accepts media using http POST requests like HTTP file upload function.