PDA

View Full Version : Allow a user to perform on their webcam, and all my website visitors can watch LIVE


Josh
11-27-2010, 07:19 PM
Hi,

i'm just thinking of stuff that I want to have eventually in my website.

My website is a talent contest site, check here to get a better understanding of it: www.onlinestage.co.uk (http://www.onlinestage.co.uk)


I want to be able to add a feature that a user is able to perform using their webcam or video camera or other live feed, and it posts the feed to my website page so viewers can watch them live.

I know it's possible but how to do it I wouldn't know, can somebody point me in the right direction please?

Thank you,

Josh.

davidj
11-30-2010, 11:05 AM
You need a way to upload video formats and store info about them for retrieval at a later date

You need to look into file uploading with PHP

Corrosive
11-30-2010, 11:14 AM
You might want to check out something like; http://www.ustream.tv/ for live vids.

Josh
11-30-2010, 11:16 AM
Hi David,

I do have a fully functional php file upload working on my website at the moment.

this is the php code I use;


<?php
session_start();

// Configuration - Your Options
$allowed_filetypes = array('.avi','.mpg','.flv','.swf','.zip','.wmv','. mp4','.vob','.3g2','.3gp','.rm','.doc','.txt','.do cx','.msg','.rtf','.wpd','.wps'); // These will be the types of file that will pass the validation.
$max_filesize = 20024288; // Maximum filesize in BYTES (currently 20MB).
$upload_path = '../../onlinestage.co.uk/uploads/generalfunnystuff/'; // The place the files will be uploaded to (currently a 'files' directory).

$filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.


// Check if the filetype is allowed, if not DIE and inform the user.
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');

// Now check the filesize, if it is too large then DIE and inform the user.
if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)
die('The file you attempted to upload is too large.');

// Check if we can upload to the specified path, if not DIE and inform the user.
if(!is_writable($upload_path))
die('You cannot upload to the specified directory, please CHMOD it to 777.');

$newname= $_SESSION['username']. $ext . $filename; //

// Upload the file to your specified path.
if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $newname))

echo 'Your file upload was successful,'; // It worked.
else
echo 'There was an error during the file upload. Please try again.'; // It failed :(.

?>


Any ideas how I might put this feature in place, i need to think about things like, when I want to stream a live video feed, the user would need to be in front of their camera, the feed would need to be sent to me, and then through my website.

sounds complicated!

Thanks,

josh.

Josh
11-30-2010, 11:19 AM
You might want to check out something like; http://www.ustream.tv/ for live vids.

thanks for that link corrosive, i'll check it out.

davidj
11-30-2010, 06:37 PM
so you are wanting live feeds to be broadcast from your site Artist streams video through your site to the world? or are these pre-recorded, uploaded to your site and downloaded?

Josh
11-30-2010, 08:37 PM
ideally I would like the artist to stream from their camera at home. the feed comes through to me and then it streams live for everybody to watch. Or if the artist could just stream straight from their camera to my website, but I want it to be as easy as it can be for the user, I could do it that way through Ustream but I'd prefer not to give them login details and I'd prefer to be able to manage when and what goes live.

Ustream only gives me the opportunity to stream live from my own camera at home, however it's a good feature that I'll probably use for something.

can this be done?

davidj
12-01-2010, 12:12 PM
Id suggest you use a video upload model rather than a live stream solution