Page 1 of 1

Video player [SOLVED]

Posted: Wed Nov 07, 2012 7:58 am
by SpiritWebb
Alright, I will try to best explain this as I can.

I am building a website for someone, and they asked me today if I could add a feature, and I am unsure how to go about it. Basically, upload a video to their site to a folder, and a player be embedded in the videos page. Now when a video is uploaded, the player's playlist is updated with the new video.

Any ideas on how to accomplish this? They don't want to use YouTube, they want to use their own server and video player. See side note, as wanting to accomplish the same thing but with videos...so aggravating. I have this one some bugs to finish and I can turn it over to them for reviewing and final touch ups before completing the work. Any help would be appreciated!


-Side note:

I added a flash photo album that allows them to upload photos and the album auto updates with the new pictures.-

Re: Video player

Posted: Wed Nov 07, 2012 3:59 pm
by Jackolantern
Honestly I would look for something open source to do this. The issue is that to make the video uploading even half-way user friendly, you need to be automatically converting the video file formats on the server. Flash, Silverlight and HTML5 all call for specific video file formats (HTML5 actually requires 2 different formats to play in all browsers), and they are not the typical formats users have. So once you consider the automatic video converting functionality, and all of the video organization and display options, it would likely be better to find something already available. Particularly considering how many of these surely must exist, since "YouTube clone" is up there in popularity with social network, email site, etc., and likely has dozens of options online.

Re: Video player

Posted: Wed Nov 07, 2012 5:46 pm
by SpiritWebb
I got one in place now, but getting an error using copy(), but if I change it to move_uploaded_file() no errors, but no upload happens. See code below:

PHP Code:

Code: Select all

// Start video upload -----------------------------------------------
if(isset($_POST['vsubmit'])){
  // get the original filename
  $video = $_FILES['vupload']['name'];
  
  // video storing folder, make sure you indicate the right path
  $folder = "../videos/";
  
  //video checking if exist or the input field is not empty
  if($video){
    // creating a filename
    $filename = $folder . $video;
    
    // uploading video file to specified folder
    $copied = copy($_FILES['vupload']['tmp_name'], $filename);  // <--- If I change it to move_uploaded_file() no error and nothing happens.  If I change it to    copy(), it says its empty.

    // checking if upload successful
    if (!$copied){

      // creating variable for the purpose of checking:
      // 0 - unsuccessful, 1 - successfull
      $ok = 0;
      var_dump($_FILES);
    } else {
      $ok = 1;
    }
  }
}
// End video upload -------------------------------------------------
HTML to upload:

Code: Select all

<td bgcolor="#FFDDDD"><form id="form4" name="vidUpload" action="" method="post" enctype="multipart/form-data">
    <br />
    <input type="file" name="vupload">
    <input type="submit" name="vsubmit" value="Upload Video">
    <<<< ONLY:  allowed
    </form></td>

Re: Video player

Posted: Wed Nov 07, 2012 7:59 pm
by SpiritWebb
I got it to generate the playlist and play music, just still cannot get it to upload the file from my previous post.

Re: Video player

Posted: Wed Nov 07, 2012 8:32 pm
by SpiritWebb
Here is the var_dump($_FILES) that is displayed if it didn't upload:

Code: Select all

array (size=1)
  'vupload' => 
    array (size=5)
      'name' => string '04 O Holy Night.mp3' (length=19)
      'type' => string '' (length=0)
      'tmp_name' => string '' (length=0)
      'error' => int 1
      'size' => int 0

Re: Video player

Posted: Wed Nov 07, 2012 8:34 pm
by SpiritWebb
I fixed the problem. Videos uploading successfully, playlist automatically updating with new video. Apparently the video CAN NOT have any spaces in the title when uploading!

Re: Video player [SOLVED]

Posted: Wed Nov 07, 2012 10:44 pm
by Jackolantern
Glad you got it working :) Is this a publicly-available video site solution?

Re: Video player [SOLVED]

Posted: Wed Nov 07, 2012 11:41 pm
by SpiritWebb
As in terms of something like YouTube? No, its for a paranormal group's website. So they can upload their videos and share without uploading to a video hosting and posting an embed option!

If thats not what you meant, you lost me! :lol: