Ben Close
Ben Close

Reputation: 434

wowza streaming c# HTTP get method for livestreamrecord

Hello I need some help with livestreamrecord recording via http url c# calls,

I can start and stop a stream recording using:

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

When inputting it directly in to a browser or when I redirect my webpage to it from code, but when I try to do the same from c# on a webpage nothing happens.

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://[username]:[password]@[wowza-ip-address]:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording);
    request.Method = "GET";
    request.Proxy = new WebProxy("[wowza-ip-address]", 8086);
    request.Credentials = new NetworkCredential("[username]", "[password]");        
    request.ContentType = "application/x-www-form-urlencoded";

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    Stream stm = response.GetResponseStream();

When I first tried to set it up I kept getting 401 unauthorized error which the code above no long throws, but now I'm stuck as no error is thrown and still no recording is started.

The response returns:

<html><head><title>Wowza Streaming Engine 4 Perpetual Edition 4.0.1 build10615</title></head><body>Wowza Streaming Engine 4 Perpetual Edition 4.0.1 build10615</body></html>

Which indicates it is not reaching the livestreamrecord page.

Ben

Upvotes: 3

Views: 1392

Answers (1)

Ben Close
Ben Close

Reputation: 434

Sovled the problem, thier was a 302 redirect on the request which was producing the 401 unauthorized responses. Adding:

request.AllowAutoRedirect = false;

and removing:

request.Proxy = new WebProxy("[wowza-ip-address]", 8086);

Resolved the problem.

With Proxy in, it didn't throw an error but also didn't record. Removing Proxy allowed the record command to work but throw the 401 response which was then resolved by setting AllowAutoRedirect to false.

Upvotes: 1

Related Questions