Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Setting up your own on-demand video site with PHP, Part 2: Basic structure

Build an enterprise-ready on-demand video library with open source tools

Duane O'Brien, PHP developer, 自由职业者
Duane O'Brien has been a technological Swiss army knife since the Oregon Trail was text only. His favorite color is sushi. He has never been to the moon.
Katie Horn, Developer, 自由职业者
According to her mother, Katie Horn has spent far too much of her 28 years on the computer. She has a degree in computer science from Chapman University, after which she has mostly enjoyed the jobs with "systems" or "engineer" somewhere in the title. Despite a degree of proficiency in the area, she would prefer never again to be called "network admin."
Will Robot, PHP Developer, Freelance Writer
Will Robot is a semi-professional dabbler in too many things. He lives with between four and five cats and thinks anything can be improved with the addition of a laser and at least two blinking LEDs.

Summary:  Setting up your own on-demand video site doesn't have to be complicated. Upload some videos and put them up for people to watch — easy enough. But if you're going to be doing a lot of videos, you'll need a way to keep them organized. This three-part "Setting up your own on-demand video site with PHP" series takes you through everything you need to know to create video optimized for the Web, as well as creating a PHP application that will help keep your videos organized and accessible. Part 1 lays the groundwork by assembling and installing the necessary components and gathering and converting the video. Here in Part 2, we build the basic application. And in Part 3 you add create a slick user interface and integrate the example with YouTube.

View more content in this series

Date:  14 May 2008
Level:  Intermediate PDF:  A4 and Letter (153 KB | 23 pages)Get Adobe® Reader®

Activity:  10513 views
Comments:  

Before you start

This series was written with the developer in mind. You should be comfortable working with PHP and Web applications. You don't need to be an expert to go through this series, but not a lot of time will be spent explaining PHP syntax and Web application concepts. If you're unfamiliar with either, but keen to learn, feel free to dive right in. It wouldn't hurt to have some basic understanding of digital video, but we'll explain most of what you need to know.

About this series

Part 1 covers the putting together of the pieces, installing the components, dealing with video conversion, and preparing for the application. We lay out lot of groundwork here. There's a lot to learn about digital video, and we'll need to get set up for doing all the coding here in Part 2.

Here, you build a basic application to manage the uploaded files and the tagging. You'll be using a PHP framework — CakePHP — to help jump-start this process. The application won't be another video-sharing site. The focus will be on managing your own files and getting them up there for people to see.

In Part 3, you add some advanced features and create a slick user interface. We'll smooth out the UI and look at using APIs from popular video-sharing sites to disseminate your videos. If Part 1 is about getting up to speed, and Part 2 is about making it all work, then Part 3 is about making it awesome.


About this tutorial

We're going to be doing a lot of coding. We'll use CakePHP to jump-start the application, and you'll start by baking out the basics of the application. We'll knock down some of the basic user- and video-management stuff, then we'll jump into the two big problems to solve: the file upload and using the OpenFLV libraries to play the videos. If you haven't completed Part 1 yet, you really need to go back and do that before you begin.


System requirements

To work with digital video in this series, you'll need to set up a few things; the installation of basic components won't be covered here:

  • Some digital video content — It can be video you've found, shot, or imported from another medium.
  • A Microsoft® Windows® XP box — The examples provided use some software written for Windows XP. However, if you're adept at editing and converting video on computers running other operating systems, you certainly may do so.
  • FFmpeg — An open source command-line video-conversion utility.
  • Riva FLV Encoder V2.0 for Windows — A video-conversion utility for Windows that is no-cost for the first 30 days of use.
  • Wikipedia for .flv conversion programs for other platforms.
  • Red5 — A Java™-based open source Flash server.
  • JW FLV Media Player V3.15 — A small embeddable Flash media player.

For the Web application, you'll also need the following:

  • An HTTP server that supports sessions (and preferably mod_rewrite). This series was written using Apache V1.3 with mod_rewrite enabled.
  • The 1.2 beta version of CakePHP.
  • PHP V5.1.4 or greater — Not all the frameworks being examined require this release level of PHP, but for the sake of ease, all frameworks will use the same PHP installation. This series was written using PHP V5.2.3.
  • A reasonably recent version of MySQL — Several other database options are available and supported, but both this series and the sample application were written using MySQL V5.0.37.

If you don't know anything about writing code, PHP, databases, etc., you will find this series challenging. You should get up to speed on writing Web applications in PHP first. (See Resources for links to each project.)

1 of 8 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source
ArticleID=307613
TutorialTitle=Setting up your own on-demand video site with PHP, Part 2: Basic structure
publish-date=05142008
author1-email=d@duaneobrien.com
author1-email-cc=
author2-email=K4@engineering.phenomenauts.com
author2-email-cc=cappel@us.ibm.com
author3-email=willrobot@gmail.com
author3-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.