givo / lib-kurento Goto Github PK
View Code? Open in Web Editor NEWA typescript library for simplifying the use of Kurento in Node.js
A typescript library for simplifying the use of Kurento in Node.js
Hey, thanks for the awesome lib!
I'm recreating the one2many kurento demo tutorial, and running into a simple problem: When I receive a "present" message from a client, I immediately set up a libKurento.WebRtcEndpointWrapper with the Sdp, but before it is constructed I also receive "onIceCandidate" from the client, so I am unable to call webRtcEndpoint.addClientIceCandidate on the endpoint to put it in the queue.
There's two ways I can think of fixing this without modifying lib-kurento: 1) Have the client only start sending onIceCandidates AFTER it receives the sdp answer. 2) queue the messages myself and pass them to the WebRtcEndpointWrapper when it is ready (not utilizing its internal queue)
That said, if I could create a libKurento.WebRtcEndpointWrapper WITHOUT specifying an sdp (so it could have it around to start queuing ice candidates whenever they are received), and then when I receive an sdp from the client I can call WebRtcEndpointWrapper.init(sdpOffer), that would allow me to utilize the internal queue of WebRtcEndpointWrapper.
So here's what I'm proposing:
Of course I'm new to all this so I might be way off the mark -- please let me know if I'm thinking about this correctly!
However, can't use your lib in my node ts app. What might go wrong?
import * as libKurento from 'lib-kurento';
src/index.ts(2,29): error TS2307: Cannot find module 'lib-kurento'.
Thanks for sharing awesome library!
I suggest adding these lines to the Recording Example
in README.md
:
recorderEndpoint.endpoint.addListener('Error', (err) => {
console.log('recorderEndpoint.endpoint error', err);
})
It greatly helps to debug recording problems.
If I call setMaxVideoRecvBandwidth()
in my code
await webRtcEndpoint.init()
// no effect!
await webRtcEndpoint.endpoint.setMaxVideoRecvBandwidth(50000)
it doesn't take effect (poor quality of recorded videos).
I had to modify SdpEndpointWrapper.init()
to run setMaxVideoRecvBandwidth()
before processOffer()
async init() {
await super.init();
// mod
await this._endpoint.setMaxVideoRecvBandwidth(50000)
// process sdp offer
this._sdpAnswer = await this._endpoint.processOffer(this._sdpOffer);
this.emit("SdpAnswerCreated", this._sdpAnswer);
}
Maybe it's a good idea to make some event on EndpointWrapper.init()
right after _endpoint
creation to have time to manipulate it before processOffer()
begins.
async init() {
this._endpoint = await this._pipeline.create(this._endpointName, this._createOptions);
this.emit("EndpointCreated", event);
or, simpler, no automatic processOffer()
on SdpEndpointWrapper.init()
(extract it to separate method)
Using [email protected]
// . . . . .
let createRecorderStateLogger = (eventLabel) => {
let callback = (event) => {
let descriptionParts = [event.type, event.mediaType, event.state].filter(x => x)
let description = descriptionParts.join(' ')
this.log(`recorderEndpoint : ${eventLabel} event: ${description}`)
}
callback.bind(this)
return callback
}
let eventsNamesToLog = [
'RecordingStarted', 'RecordingStopped',
'MediaFlowingIn', 'MediaFlowingOut',
'MediaStoppedFlowingIn', 'MediaStoppedFlowingOut',
]
// logging recorder state changes
for (let eventNameToLog of eventsNamesToLog) {
this.recorderEndpoint.on(
eventNameToLog,
createRecorderStateLogger(eventNameToLog)
);
}
this.recorderEndpoint.on('RecordingStarted', (evt) => {
// NOT FIRED!!!
this.wsMessageToClient({
category: MessageFromServerCategory.recordingStarted,
})
});
// start recording
await this.recorderEndpoint.record();
setTimeout(async () => {
await this.recorderEndpoint.stopRecord();
}, 7000);
[25.12.2019 18:20:59] recorderEndpoint : MediaFlowingIn event: MediaFlowInStateChange AUDIO FLOWING
[25.12.2019 18:20:59] recorderEndpoint : MediaFlowingIn event: MediaFlowInStateChange VIDEO FLOWING
[25.12.2019 18:20:59] recorderEndpoint : RecordingStopped event: Recording
[25.12.2019 18:21:05] recorderEndpoint : RecordingStopped event: Stopped
Video file is saved normally but event object has type = 'Recording'
on RecordingStopped
event and RecordingStarted
event is not fired at all.
// package-lock.json:
"lib-kurento": {
"version": "0.0.5",
"kurento-client": {
"version": "6.12.0",
Hi,
In both examples of the README, there's a call to socket.on
where socket
is of type WebSocket
.
However, WebSocket
does not have any member on
. How do I proceed?
I'm compiling to es5 and have the libraries for es2019 and dom in my tsconfig.json
Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.