Getting started on a video sharing site [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this questionI'm a CS student and I have a good deal experience in application software (java/c++) but very little in web development. So, I've decided to make a kind of video-sharing site (for experience and fun).
Knowing that, are there any resources (web articles, books..) that you'd suggest to learn from? I know the markup stuff (html/css) but don't really know much php, javascript, (ruby/python/etc?). Also, what language would be best for the task I'm attempting? I'm kind of interested in developing the video player myself, unless it's absolutely too difficult of a task. Thanks!
You say you know markup, and you know app dev, so I'm slightly confused by what you want to learn exactly. When you say video player, which part of it do mean? A custom flash, html5, silverlight player?
My Suggestion
Simplify your frontend
For your purposes, simplify your requirements a bit into digestible junks.
For starters, forget about the video playing for now. Start off by building a site that just shares links to video files.
By doing this, you'll have to build a backend which supports persisting data across many users, and building a site which is datadriven (i.e. your list of video links).
The Core logic or your website doesn't need to know it's a website
You've written apps before right. So start writing the classes for your site that do most of the heavy lifting or storing and retrieving your video files. The input of some of your classes might be a video file memory stream or byte array, and the output might be a physical file path.
You've got you classes, drop frontend on top of it
That's all a website is, a frontend. All your frontend is going to do it accept urls, use you core classes to do whatever the url is asking for, and then return some html. that's it.
What language / framework?
As you come from an OO background I'd recommend .NET. There's a billion resources out there, it's statically typed (which I personally like) and the framework does a lot of the web bits for your.
If you don't like M$, you could try Mono, which is an Open Source implementation of .NET, otherwise as you've done Java, I'd look for a Java web framework.
Remember, you core code can be regular Java libraries. You Java web framework code is just going to use your libraries to retried data, and then use that data to push out html back to the browse. The framework will handle all that url web stuff.... so essentially all that will happen is that a url will just call a certain method in your controller.
MVC. Learn it.
If you're not sure what I mean by Controller... look up and learn the MVC Pattern. It's not exclusive to the web context, but is very useful and the better frameworks implement the pattern.
The actual Video Player
Once you've got your site built and sharing links to the actual video file... then it's just a case of changing your Views (see MVC pattern). Remember, the Player is after all just a frontend element.
What language are you the most comfortable with? That is the most important factor when it comes to development, as it's hard to develop in a new language. I code with Python + PyQt4
, but I can't even make a basic "Hello World" with Qt4 + C++
.
I'd advocate Python and one of the many web frameworks (Flask, Django, Web.py, etc.), as the syntax is very readable and is quite simple to modify.
Here's an example chunk of code from my library-management site, written in Python using Flask as the web framework and SQLAlchemy for database integration:
@app.route('/view/<book_id>')
def view_book(book_id):
book = Book.query.filter_by(id = book_id).first()
Book.query.filter_by(id = book_id).update({'views': book.views + 1})
db.session.commit()
return render_template('view.html', book = book)
But that's just my personal preference. I could imagine Ruby on Rails performing the same task, but PHP is out of the picture IMO. It's just too complicated and clunky for fast modifications and rapid development.
If you want to go the PHP route and get as much experience out of the project as possible, then all you need is php, a data storage engine (any of the supported database clients) and smarty. The video player is client side scripting or you can opt for the HTML 5 <video>
tag. If you want to do something with the videos or inspect file headers I would suggest using ffmpeg.
精彩评论