recording in javascript

1,009 views
Skip to first unread message

Mark Spowage

unread,
Nov 10, 2014, 11:28:39 AM11/10/14
to kur...@googlegroups.com
The new tutorials reveals recording via java. Based on 'legacy' example the code below was used for javascript recording. Is browser javascript
recording workable now ? No errors appeared, yet no file appeared either. The legacy "kwsUtils" javascript record did work.
kurentoClient(ws_uri, function(error, kurentoClient) {
		if(error) return onError(error);

		kurentoClient.create("MediaPipeline", function(error, pipeline) {
			if(error) return onError(error);


                  pipeline.create('RecorderEndpoint', {uri : file_uri}, function(error, recorder) {
					if (error) return onError(error);



			pipeline.create("WebRtcEndpoint", function(error, webRtc){
				if(error) return onError(error);

				webRtc.processOffer(sdpOffer, function(error, sdpAnswer){
					if(error) return onError(error);

					webRtcPeer.processSdpAnswer(sdpAnswer);
				});

                                 webRtc.connect(recorder, function(error) {
							if (error) return onError(error);
							console.log("Connected");
							recorder.record(function(error) {
								if (error) return onError(error);
								console.log("record");
                                                            });

LuLop

unread,
Nov 10, 2014, 11:32:08 AM11/10/14
to kur...@googlegroups.com
It's working and many people is using that feature. 

Be sure that you specify your file_uri using URI format: "file:///my_path". If you specify just a path it will not work.

L.

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

alexander....@gmail.com

unread,
Nov 24, 2014, 9:11:41 AM11/24/14
to kur...@googlegroups.com
Mark,

I have exactly the same problem. I'm using the same sequence of API calls and passing file:///my_path as uri.
Media server logs show that RecorderEndpoint is created and recieved 'record' operation.
Still no file is created. I've tried different pathes.

Have you overcome this?

Thanks

понедельник, 10 ноября 2014 г., 22:28:39 UTC+6 пользователь Mark Spowage написал:

Ivan Gracia

unread,
Nov 24, 2014, 9:30:49 AM11/24/14
to kur...@googlegroups.com
Keep in mind that the KMS runs with user nobody, so you have to use a path with the right permissions. Could you check that?

Alexander Morokhovets

unread,
Nov 24, 2014, 12:10:06 PM11/24/14
to kur...@googlegroups.com
Yes, I've checked. It's /tmp with rwxrwxrwt (1777) set on it. Should be fine.
I've also tried  nobody:nogroup rwxr-xr-x /tmp/kurento. Still no luck.

Are there any logs except /var/log/kurento-media-server/media-server.log ?

Relevant media-server.log entries:
[2014-11-24 20:56:27.316044] [0x158be700] [debug]   KurentoWebSocketTransport WebSocketTransport.cpp:437 processMessage() Message: >{"id":3,"jsonrpc":"2.0","method":"create","params":{"constructorParams":
{"mediaPipeline":"a9579d5f-ff5b-4285-b7ad-b53238f4478e","uri":"file:///tmp/kurento/1416848188547.webm"},"sessionId":"c75c9db3-5a0a-4b28-8710-dbd136ca67ff","type":"RecorderEndpoint"}}
<
[2014-11-24 20:56:27.317505] [0x158be700] [info]    KurentoRecorderEndpointImpl RecorderEndpointImpl.cpp:39 RecorderEndpointImpl() Set WEBM profile
[2014-11-24 20:56:27.524392] [0x150bd700] [debug]   KurentoWebSocketTransport WebSocketTransport.cpp:437 processMessage() Message: >{"id":5,"jsonrpc":"2.0","method":"invoke","params":{"object":"a9579d5f-f
f5b-4285-b7ad-b53238f4478e/ffa227fc-910d-4f22-89b4-c91d841c39a3","operation":"record","sessionId":"c75c9db3-5a0a-4b28-8710-dbd136ca67ff"}}

Any help?

Thanks

Mon Nov 24 2014 at 8:30:49 PM, Ivan Gracia <izan...@gmail.com>:

Keep in mind that the KMS runs with user nobody, so you have to use a path with the right permissions. Could you check that?

To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "kurento" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kurento/MBis0tZPowo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kurento+unsubscribe@googlegroups.com.

Ivan Gracia

unread,
Nov 24, 2014, 12:12:27 PM11/24/14
to kur...@googlegroups.com
As Luis said, this is working for most people, and in our environments. I was just hoping that it was an issue with permissions. Could you please send us the entire log file attached?


To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

alexander....@gmail.com

unread,
Nov 24, 2014, 12:20:05 PM11/24/14
to kur...@googlegroups.com

See log attached! (Only last part of log is relevant)

Thanks for quick response.

понедельник, 24 ноября 2014 г., 23:12:27 UTC+6 пользователь igracia написал:
As Luis said, this is working for most people, and in our environments. I was just hoping that it was an issue with permissions. Could you please send us the entire log file attached?


On Mon Nov 24 2014 at 6:10:08 PM Alexander Morokhovets <alexander....@gmail.com> wrote:
Yes, I've checked. It's /tmp with rwxrwxrwt (1777) set on it. Should be fine.
I've also tried  nobody:nogroup rwxr-xr-x /tmp/kurento. Still no luck.

Are there any logs except /var/log/kurento-media-server/media-server.log ?

Relevant media-server.log entries:
[2014-11-24 20:56:27.316044] [0x158be700] [debug]   KurentoWebSocketTransport WebSocketTransport.cpp:437 processMessage() Message: >{"id":3,"jsonrpc":"2.0","method":"create","params":{"constructorParams":
{"mediaPipeline":"a9579d5f-ff5b-4285-b7ad-b53238f4478e","uri":"file:///tmp/kurento/1416848188547.webm"},"sessionId":"c75c9db3-5a0a-4b28-8710-dbd136ca67ff","type":"RecorderEndpoint"}}
<
[2014-11-24 20:56:27.317505] [0x158be700] [info]    KurentoRecorderEndpointImpl RecorderEndpointImpl.cpp:39 RecorderEndpointImpl() Set WEBM profile
[2014-11-24 20:56:27.524392] [0x150bd700] [debug]   KurentoWebSocketTransport WebSocketTransport.cpp:437 processMessage() Message: >{"id":5,"jsonrpc":"2.0","method":"invoke","params":{"object":"a9579d5f-f
f5b-4285-b7ad-b53238f4478e/ffa227fc-910d-4f22-89b4-c91d841c39a3","operation":"record","sessionId":"c75c9db3-5a0a-4b28-8710-dbd136ca67ff"}}

Any help?

Thanks

Mon Nov 24 2014 at 8:30:49 PM, Ivan Gracia <izan...@gmail.com>:

Keep in mind that the KMS runs with user nobody, so you have to use a path with the right permissions. Could you check that?

To unsubscribe from this group and all its topics, send an email to kurento+u...@googlegroups.com.
media-server.log.gz

alexander....@gmail.com

unread,
Nov 24, 2014, 4:05:18 PM11/24/14
to kur...@googlegroups.com, alexander....@gmail.com
Still struggling...

Hypothesis: do I need additional configuration in kurento.conf since I'm running KMS and application server on different machines?

Thanks

понедельник, 24 ноября 2014 г., 23:20:05 UTC+6 пользователь alexander....@gmail.com написал:

Ivan Gracia

unread,
Nov 25, 2014, 5:45:21 AM11/25/14
to kur...@googlegroups.com, alexander....@gmail.com
Have you tried any other tutorial? I thought you could at least see the video... Check if the Hello World works for you. 

Are both the client and both servers in the same network?

alexander....@gmail.com

unread,
Nov 25, 2014, 6:33:38 AM11/25/14
to kur...@googlegroups.com, alexander....@gmail.com
> Have you tried any other tutorial? I thought you could at least see the video... Check if the Hello World works for you. 

I probably forgot to mention that video/audio works great and pretty stable!
It's just that the recorder does not create any files when I connect it to WebRtcEndpoint and invoke #record.


> Are both the client and both servers in the same network?

I think they are not.
I'm running node app on my dev machine.
And KMS is running on our dev ubuntu dev box elsewhere


I'm using kurento-client from node.js app. API call sequence is pretty much the same as in original post.
Yesterday I've tried to migrate to nightly build but had troubles building node.js client so still no luck.


Another question: I only need to record audio but it's not clear how to specify media profile in javascript.
Documentation says:
==
Choose either a module:elements.RecorderEndpoint#MediaProfileSpecType.WEBM or a {@link module:elements.RecorderEndpoint#MediaProfileSpecType.MP4} profile for recording
==
I can't wrap my mind around how to translate this to javascript.

Thanks for your quick replies!


вторник, 25 ноября 2014 г., 16:45:21 UTC+6 пользователь igracia написал:
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

alexander....@gmail.com

unread,
Nov 25, 2014, 9:56:55 AM11/25/14
to kur...@googlegroups.com, alexander....@gmail.com

Some followup:

Using nightly build on client and server does not help
I've also tried running application server (kurento-client) and KMS on the same box with no success.
All is working except RecorderEndpoint does not create any files.

I would love to provide any configuration files or logs to help with this.

This issue is a blocker for my application and there are couple of other platforms that fit my needs but migrating would be a step back cause I like Kurento architecture and codebase much more!


вторник, 25 ноября 2014 г., 17:33:38 UTC+6 пользователь alexander....@gmail.com написал:

Santiago Carot Nemesio

unread,
Nov 25, 2014, 10:51:19 AM11/25/14
to kur...@googlegroups.com, alexander....@gmail.com
Hi,
Have you tried any of the other recorder examples? Do they work? I've been looking at the logs and everything looks fine. Could you provide the source code of you application (or better a small functional snippet of code that reproduces your error case) so that we can test it?

Regards

LuLop

unread,
Nov 25, 2014, 10:56:45 AM11/25/14
to kur...@googlegroups.com, alexander....@gmail.com
Alexander,

Are you sure the kurento-media-server process has permissions to write in the target files? You should check that the user running Kurento Media Server has write permissions on the files specified at the recorder as recording URI.

Best.

L.

alexander....@gmail.com

unread,
Nov 25, 2014, 11:10:48 AM11/25/14
to kur...@googlegroups.com, alexander....@gmail.com

> Have you tried any of the other recorder examples? Do they work?

Where can I find any js recorder examples? Current site docs shows only java one.


>  Could you provide the source code of you application (or better a small functional snippet of code that reproduces your error case) so that we can test it?

Here is the code that connects users between each other and starts recording. Sorry, I cannot make a small functional  snippet right away. Will create it later if this will not help

Room.prototype.connectViewer = function(id, webRtcEndpoint, cb) {
 
var self = this;


 
var recordParams = {
    uri
: "file:///tmp/kurento/" + Date.now() + ".webm"
 
};
 
self.pipeline.create('RecorderEndpoint', recordParams, function(err, recorder) {
   
if (err) return cb(err);


   
self.viewers[id].recorder = recorder;


    webRtcEndpoint
.connect(recorder, function(err) {
     
if (err) return cb(err);


      recorder
.record(function(err) {
       
if (err) return cb(err);


        async
.each(_.keys(self.viewers), function(viewerId, cb) {
         
if (viewerId == id) {
            cb
();
         
} else {
           
self.viewers[viewerId].webRtcEndpoint.connect(webRtcEndpoint, function(err) {
             
if (err) return cb(err);


              webRtcEndpoint
.connect(self.viewers[viewerId].webRtcEndpoint, function(err) {
               
if (err) return cb(err);


                cb
();
             
});
           
});
         
}
       
});
     
});
   
});
 
}, function(err) {
    cb
(err);
 
});
}



I've tried to set uri to file:///tmp/filename.webm with the same results.
The part that is connecting users between them is working great besides it's inside #record callback.

Thanks!

вторник, 25 ноября 2014 г., 21:51:19 UTC+6 пользователь Santiago Carot Nemesio написал:

alexander....@gmail.com

unread,
Nov 25, 2014, 11:12:48 AM11/25/14
to kur...@googlegroups.com, alexander....@gmail.com
> Are you sure the kurento-media-server process has permissions to write in the target files? You should check that the user running Kurento Media Server has write permissions on the files specified at the recorder as recording URI.

Yes, we have discussed it earlier in this thread. I think /tmp with rwxrwxrwt should be enough?

Anyway I will double recheck it a bit later!

Thanks!

вторник, 25 ноября 2014 г., 21:56:45 UTC+6 пользователь lulop написал:

Ivan Gracia

unread,
Nov 25, 2014, 12:06:23 PM11/25/14
to kur...@googlegroups.com, alexander....@gmail.com
Going back to the permissions, you could just in case try to run the service as root. For this, edit the file /etc/default/kurento-media-server, and change the key DAEMON_USER=nobody to DAEMON_USER=root. You will need to restart the service with sudo kurento-media-server restart for the changes to have effect. Check that the service is indeed being run as root. In that case, ps -ef | grep kurento should yield something like this 

root      1631     1  2 18:01 ?        00:00:00 /usr/bin/kurento-media-server

Look for root in the first column. 

If you are able to create the file after this, then the problem is with permissions :-)

alexander....@gmail.com

unread,
Nov 25, 2014, 1:17:00 PM11/25/14
to kur...@googlegroups.com, alexander....@gmail.com

Tried this, no .webm files, empty directory.

вторник, 25 ноября 2014 г., 23:06:23 UTC+6 пользователь igracia написал:

Ivan Gracia

unread,
Nov 26, 2014, 6:48:29 AM11/26/14
to Kurento Public, alexander....@gmail.com
Ok, then the permissions thing is definitely counted out. Could you try, as Santi suggested, any other recorder example? Maybe this one? 

We don't see anything wrong in the KMS logs. The only option would be to reproduce your setup. Could you explain it a bit?

Ivan Gracia


alexander....@gmail.com

unread,
Nov 26, 2014, 10:08:05 AM11/26/14
to kur...@googlegroups.com, alexander....@gmail.com
> Could you try, as Santi suggested, any other recorder example? Maybe this one? 

I've tried and it worked! Thanks for pointing me to develop branch :)
Comparing code line by line I've finally managed to track down a bug.

Guys! I want to apologize for taking so much of your time.
The reason was merely in callback hell.
In the code snippet I've posted above the last outstanding callback with just "cb(err);" in it should be placed as async.each argument, not pipeline.create.
Because of that sdp offer was never processed (I introduced this bug exactly when I injected recorder related code).

Code in kurento-tutorial-js/kurento-hello-world-recorder-generator makes great use of js generators (and 'co' library).
This approach could save me two whole days of bug hunting by just organizing callbacks in much clearer way.

Thanks a lot for your time!

среда, 26 ноября 2014 г., 17:48:29 UTC+6 пользователь igracia написал:

shivash...@gmail.com

unread,
Dec 17, 2017, 8:52:06 PM12/17/17
to kurento
Reply all
Reply to author
Forward
0 new messages