If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

How to make a audio + video + text chat system in php?

Hello to all,
I came with an idea to develop a system of audio visual chat in php but i would like to know how to capture camera stream with php , is it possible in any means .... i would be interested in knowing the procedure to do so , please help me i wanna put it on my website.

Since the camera is on the user's PC, and PHP (normally) is running on the web server, that aspect of the application will probably not be a PHP issue -- you'll need something running on the browser (Flash, Java applet, whatever?) to handle it. In fact, you'll probably end up doing most of the actual chat work in the browser, and PHP will just be used to establish the initial connections between clients. (And at this point you're getting pretty far out of my area of expertise, such as it is.)

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation

If you're open to using open source libraries, there probably are a bunch out there that can help you out and be easily integrated in your chat system, such as this (however I've never used it, just found it on Google).

If you want to do it by yourself, PHP won't be able to do what you want as the user needs (and should) give explicit permission before their hardware is accessed.

Opera supports navigator.getUserMedia() but I'm not sure whether other browsers support it and mobile devices are going to be a whole other story. Check out these links that should help you out:

If you're open to using open source libraries, there probably are a bunch out there that can help you out and be easily integrated in your chat system, such as this (however I've never used it, just found it on Google).

If you want to do it by yourself, PHP won't be able to do what you want as the user needs (and should) give explicit permission before their hardware is accessed.

Opera supports navigator.getUserMedia() but I'm not sure whether other browsers support it and mobile devices are going to be a whole other story. Check out these links that should help you out:

Thanks for the info ..... I noticed the same that I have to use some client side thing to access the hardware , suppose I program a flash actionscript to access the camera then can you please guide me that how I can redirect that stream to the specified user through php ...... I think I am making myself clear.

Example : We both are chatting through example.com you logged in through demo1 username and I logged in through demo2 username then actionscript takes my webcam stream then what it has to do , to redirect that stream to your side through the example.com website so that you can see me .... the same has to be done from your side so that I can see you.

Since the camera is on the user's PC, and PHP (normally) is running on the web server, that aspect of the application will probably not be a PHP issue -- you'll need something running on the browser (Flash, Java applet, whatever?) to handle it. In fact, you'll probably end up doing most of the actual chat work in the browser, and PHP will just be used to establish the initial connections between clients. (And at this point you're getting pretty far out of my area of expertise, such as it is.)

Thanks for the quick reply , I will try to do something similar to access the hardware ........ Thanks again.

Thanks for the info ..... I noticed the same that I have to use some client side thing to access the hardware , suppose I program a flash actionscript to access the camera then can you please guide me that how I can redirect that stream to the specified user through php ...... I think I am making myself clear.

Example : We both are chatting through example.com you logged in through demo1 username and I logged in through demo2 username then actionscript takes my webcam stream then what it has to do , to redirect that stream to your side through the example.com website so that you can see me .... the same has to be done from your side so that I can see you.

Thanks in advance.

Really excited with your response.

Keep in mind, before you do any programming for this, you need to have a server that can handle this. From what I've read (since this idea also got me interested ) is to have a video streaming server, although these seem a bit complex to set up and usually aren't free. On the other hand, there's HTTP streaming, which can be done from a free server. For this, I figure you can create a default <video> tag that each webcam would link to. Since each camera would have a unique link, there wouldn't be any problem in multiple users simultaneously uploading and downloading (assuming the server can handle it). Flash certainly can be used for this, however, an alternative is Java. You most likely will need to use AJAX to send the data to the server for PHP to have access, so if you don't know AJAX yet, you should familiarize yourself with it (can be done with pure JavaScript or frameworks such as jQuery).

As for how you'd direct that stream to the specific user, well, I haven't done it before so I'd have to figure it out first. My suggestion though would be to find an open source library (there's a lot for this) and check how they're doing it. Don't copy them but just understand the logic.

Keep in mind, before you do any programming for this, you need to have a server that can handle this. From what I've read (since this idea also got me interested ) is to have a video streaming server, although these seem a bit complex to set up and usually aren't free. On the other hand, there's HTTP streaming, which can be done from a free server. For this, I figure you can create a default <video> tag that each webcam would link to. Since each camera would have a unique link, there wouldn't be any problem in multiple users simultaneously uploading and downloading (assuming the server can handle it). Flash certainly can be used for this, however, an alternative is Java. You most likely will need to use AJAX to send the data to the server for PHP to have access, so if you don't know AJAX yet, you should familiarize yourself with it (can be done with pure JavaScript or frameworks such as jQuery).

As for how you'd direct that stream to the specific user, well, I haven't done it before so I'd have to figure it out first. My suggestion though would be to find an open source library (there's a lot for this) and check how they're doing it. Don't copy them but just understand the logic.

Glad to hear that you also liked the idea , I know ajax from jquery and can you please name 1 or 2 library so that I can download and have a look on them as how they are doing it ....... thanks again ....

Keep in mind, before you do any programming for this, you need to have a server that can handle this. From what I've read (since this idea also got me interested ) is to have a video streaming server, although these seem a bit complex to set up and usually aren't free. On the other hand, there's HTTP streaming, which can be done from a free server. For this, I figure you can create a default <video> tag that each webcam would link to. Since each camera would have a unique link, there wouldn't be any problem in multiple users simultaneously uploading and downloading (assuming the server can handle it). Flash certainly can be used for this, however, an alternative is Java. You most likely will need to use AJAX to send the data to the server for PHP to have access, so if you don't know AJAX yet, you should familiarize yourself with it (can be done with pure JavaScript or frameworks such as jQuery).

As for how you'd direct that stream to the specific user, well, I haven't done it before so I'd have to figure it out first. My suggestion though would be to find an open source library (there's a lot for this) and check how they're doing it. Don't copy them but just understand the logic.