4

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).

Madis Nõmme
  • 1,264
  • 2
  • 15
  • 25

2 Answers2

3

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

igracia
  • 3,543
  • 1
  • 18
  • 23
  • Are there events/callbacks Kurento java client that I can listen/register to detect when the PeerConnection gets closed at KMS? It could serve also as a way to detect that there will not be more data coming into the recording – Madis Nõmme Jul 08 '15 at 06:48
  • I've expanded my answer with some relevant info regarding the detection of the closing of the other peer. – igracia Jul 08 '15 at 11:16
  • Thanks for the update. I sorted to checking the recording file size change for now. Once the file hasn't changed for predefined period of time (e.g. 5 seconds) I consider it finished. Then I can start taking next steps (mixing it with another recording/encoding/archiving). – Madis Nõmme Jul 09 '15 at 10:56
  • Great! Thanks for the feedback on this, too. I'll pass it on to the rest of the team. It's a great idea to have that callback to know when the recorded file has been created. – igracia Jul 09 '15 at 13:50
  • @MadisNõmme Whenever you send the stop command, you can be sure that when the callback arrives, the file is closed already – igracia Oct 13 '15 at 16:24
1

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.

santoscadenas
  • 1,482
  • 9
  • 17