LiveStreamRecord -- Want to call startRecording() from php

I found LiveStreamRecord module from this forum and it works great. I have modified it according to my need so it will auto update my video library when I click on “Stop recording” so far so good and I’m really happy with this.

Now I need to make a recording scheduler from where I can set start recording time and stop recording time, in php. again so far so good.

I’m using RtmpClient.class.php and if I use simple

$client->startRecording(“demo”); // demo is my stream name

It starts recording and

$client->stopRecording(“demo”);

stops recording. The problem comes when I try to send some extra parameters as we can send from flash “livestreamrecord.fla”

It requires AMFDataList and its not working for me.

If you have any working example of PHP or there is any other solution like Server side API Or web service or etc it will be a great help.

You might try creating an HTTPProvider interface that you can then call from PHP.

BTW, how are you calling into Wowza from PHP now. I am not sure how you made this work. Please explain.

Charlie

No real hints. There are example HTTPProviders in the Useful Code section of the forums. I would just dig in and give it a go. It shouldn’t be too hard.

Charlie

I am suggesting that you abandon the PHP to RTMP tool that you have found and replace it with an HTTPProvider. Then you can still control Wowza from PHP but you will do it using a REST API.

If you want to stick with this PHP tool then you will need to contact the author of the tool. The problem is more likely on his end.

Charlie

There are several guide in the Useful code section with whole HTTProviders you can start with:

http://community.wowza.com/c/-/10

Richard

You also have to modify /conf/VHost.xml to add your HTTProvider

It’s not per application, it is per port and in Wowza Server 2, per RequestFilter:

http://{server IP}:1935/{filterCondition}

For example:

http://{server IP}:1935/crossdomain.xml

“crossdomain” is the RequestFilter in this case, which is met by an HTTProvider in /conf/VHost.xml.

You have to add your HTTProvider to this list.

Don’t make it last in the list though. The last item is catchall, so any HTTProvider with a RequestFilter should be above it.

Richard

Start by getting a reference to an application. For exammple:

import com.wowza.wms.application.*;

import com.wowza.wms.vhost.*

IVHost vhost = VHostSingleton.getInstance(VHost.VHOST_DEFAULT);

IApplication app = vhost.getApplication(“live”);

String storageDir = app.getAppInstance(“definst”).getStreamStorageDir();

Richard

Well I searched google for any pre-made tool and I found one.

It a socket based script called “php-rtmp-client” at http://code.google.com/p/php-rtmp-client/

this guy has done really gr8 job. We all must help him, bcoz I’m very much confident that if we help him we can get a very good php tool.

You must try it.

Any hint how to create HTTPProvider interface for required module? but I dont think it will solve the issu, bcoz calling the function is not an issue I can call it using that php-rtmp-client the main issue is that AMFDataList. I’m not being able to manage it in php. If I simply call that recording function without AMFDataList it works fine but with default recording option.

Waiting for your reply.

Limit of php is limit of your imagination :wink:

No I don’t want to stick with that tool. I refereed to that tool bcoz I just found it. My need is to control wowza through PHP.

ok Plz gimme some hints OR link how to setup HTTP Provider for wowza. Working with REST API … I’m happy with it.

Guys I have seen some code and instructions mentioned all over the forum.

Now my option is to use HttpProvider and I think its really good.

I have made few simple modules for HttpProvder and as far as I know the way to access it is some thing like

http://{server IP}:1935/{application}

and every time I get following response

Wowza Media Server Pro Unlimited with MPEG-TS 1.7.2 build12107

weather I sue http://{server IP}:1935/{application} OR http://{server IP}:1935/

Here is the code I’m using

public class HttpTest implements IHTTPProvider

{

private WMSProperties properties = null;

public void onBind(IVHost vhost, HostPort hostPort)

{

}

public void onUnbind(IVHost vhost, HostPort hostPort)

{

}

public void setProperties(WMSProperties properties)

{

this.properties = properties;

}

public void onHTTPRequest(IVHost inVhost, IHTTPRequest req, IHTTPResponse resp)

{

String msgStr = “Hello Wowza”;

String retStr = “”+msgStr+""+msgStr+"";

try

{

OutputStream out = resp.getOutputStream();

byte[] outBytes = retStr.getBytes();

out.write(outBytes);

}

catch (Exception e)

{

WMSLoggerFactory.getLogger(HTTPServerVersion.class).

error("HTMLServerVersion: "+e.toString());

}

}

}

Waiting for your help.

thanx

I love your Richard … its working thanx alot.

now next thing is how to call a function through httpProvider

I mean as I todl you my task is to make a recording scheduler. so I have to call “startRecording” and “stopRecording” functions of application “LiveStreamRecord” (I got that on demand recording module from your forum).

how to call these functions keeping in mind that my live stream name is “demo”