Madis Nõmme
Madis Nõmme

Reputation: 1303

How to detect when recording completes in Kurento Media Server (KMS)?

I have written code that successfully establishes the WebRTC connection from browser to Kurento Media Server (KMS). The stream is recorded on the server side. Recording file gets created almost instantly. When I close the PeerConnection, then after couple minutes the recording file gets the recording contents (it stays at zero size until that time).

Now my question: How to detect that the recording file got written to the disk & filled with right contents? Is there a some message in the Kurento protocol? I did find RecorderEndpoint#record(Continuation) but the Continuation#onSuccess gets called immediately (not couple mins later when the recording file gets right contents).

Upvotes: 4

Views: 1924

Answers (2)

santoscadenas
santoscadenas

Reputation: 1492

Current development version (6.4.1-dev) has new events on RecorderEndpoint. This events are Recording, Paused and Stopped.

If you call stop method and wait for Stopped event, then you can have guarantees that the file has been correctly written.

Next release of Kurento media server should contains this events.

Upvotes: 1

igracia
igracia

Reputation: 3541

I'm afraid there is no such event implemented, though what you describe is quite useful. I suggest you use a watch service, since this feature is still not planned, though we'll have a look at that and study if and when to include it

UPDATE 1: In KMS6, you have the addMediaStateChangedListener method, so you can subscribe a listener to the mediaStateChanged event. In your listener code, you can check the media state and compare it to one of the two possible states: CONNECTED, DISCONNECTED

Upvotes: 3

Related Questions