Wowza Community

stopRecording API not working


I’m running wowza streaming engine 4.1.0, and having some trouble with stream recordings. I’m using node.js from an external server to make HTTP requests to my wowza server.

I can successfully start a recording with a digest GET request:

var qs = QueryString.stringify({
					app				:	'live',
					streamname		:	stream,
					action			:	'startRecording',
				//	segmentDuration	:	30												//time in seconds
				console.log("got querystring: " + qs);
				var options = {
					host	: 	"",
					port	:	8086,
					method	:	"GET",
					path	:	"/livestreamrecord?"+qs
				Digest.request( options, function ( res){
					console.log("got start record response");
					console.log("headers: ", res.headers);
					console.log("statusCode is: ", res.statusCode);
					console.log("statusMessage is: ", res.statusMessage);

I get the output

got querystring: app=live&streamname=befbf601688edf8a37f14604e93d5cb8&action=startRecording
	CJR making disgest request
	CJR got response headers:  { Authorization: 'Digest username="*****",realm="Wowza Media Systems",nonce="812a5ee5055dc9d72016a86b955474f7",uri="/livestreamrecord?app=live&streamname=befbf601688edf8a37f14604e93d5cb8&action=startRecording",qop="auth",response="951869cc72fb65f974222cf07b8b9f53",opaque="undefined",nc="00000003",cnonce="ee1a576d"' }
	CJR making real request
got start record response
headers:  { location: '/livestreamrecord/index.html',
  'content-type': 'text/html',
  connection: 'Keep-Alive',
  server: 'WowzaStreamingEngine/4.1.0',
  'cache-control': 'no-cache',
  'content-length': '0' }
statusCode is:  302
statusMessage is:  Found

The stop API just replaces startRecording with stopRecording and produces the output

stopping record stream: befbf601688edf8a37f14604e93d5cb8
got querystring: app=live&streamname=befbf601688edf8a37f14604e93d5cb8&action=stopRecording
	CJR making disgest request
	CJR got response headers:  { Authorization: 'Digest username="*****",realm="Wowza Media Systems",nonce="8c3bd2cb3fe52b1f14657a602d1fa5b9",uri="/livestreamrecord?app=live&streamname=befbf601688edf8a37f14604e93d5cb8&action=stopRecording",qop="auth",response="c9fb7d01a147052d365f69dfcfc08d08",opaque="undefined",nc="00000004",cnonce="353c2797"' }
	CJR making real request
got stop record response
headers:  { 'www-authenticate': 'Digest realm="Wowza Media Systems",  nonce="ce8251f556a4859b0226363d1de5e34c", algorithm=MD5, qop="auth"',
  'content-type': 'text/html',
  connection: 'Keep-Alive',
  server: 'WowzaStreamingEngine/4.1.0',
  'cache-control': 'no-cache',
  'content-length': '0' }
statusCode is:  401
statusMessage is:  Unauthorized

As such, the file isn’t saved until the live stream is shut down, and I’m left with orphaned recording sessions that are waiting for streams on the livestreamrecord/index.html page.

UPDATE: I was able to succesfully start and stop a recording session using my brower with the following API, so I know that my server configured correctly

http://[username]:[password]@[wowza-ip-address]:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording  OR action=stopRecording

Based on this behavior, I would expect the api to return a 302 redirect upon a successful call, but I’m still seeing a 401 unauthorized from my node.js server.

UPDATE2: I must have been formulating my “stop” function incorrectly. I did a copy/paste of the start recording function and replaced start with stop and not everything is working, however it’s extremely slow. It takes about 8 seconds to get a response from my wowza server, instead of ~150mS when I make the request from a browser.

If you’re just looking for start and stop recording, the wowza-control module for node.js works quite well, and is set up by default to make digest requests.

Also, this page was very helpfull–>