Skip to content

Xaqron/ckc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CKC

Civilized Kurento Client provides wrapper classes for kurento-client functionality.

Usage

npm install --save ckc
const CKC = require('ckc')
const WebRtcEndpoint = CKC.WebRtcEndpoint
const KurentoClientFactory = CKC.KurentoClientFactory

async function test (kurentoServerUrl) {
  const kurentoClient = await KurentoClientFactory.build(kurentoServerUrl)
  let mediaPipeLine = await kurentoClient.createMediaPipeline()
  let webRtcEndpoint = await WebRtcEndpoint.build(mediaPipeLine)
  // Add client ice candidates in a loop
  webRtcEndpoint.addIceCandidate(iceCandidate)
  // here you can get generated ice candidates
  webRtcEndpoint.onIceCandidate(async (iceCandidate) => {
    console.log(`Received ice candidate: ${iceCandidate}`)
    // send generated ice candidates to client
  })
  // Using client sdp offer generate answer and send to client
  let sdpAnswer = await webRtcEndpoint.processOffer(sdpOffer)
  await webRtcEndpoint.gatherCandidates()
}

test('ws://localhost:8888/kurento')

Changelog

0.5.1

  • PlayerEndpoint.stop() method added.

  • PlayerEndpoint.isPlaying property added (boolean).

  • Play method now gets a callback to call at the end of video.