Video Streaming on website using java - java

I am developing a website where users can upload and watch videos. I have never done anything like this before and needs some guidance. I want the videos to be stored on my server and users can search and watch them from a video player on my website. What are the java libraries to implements this and what are the other technologies I will need.

Here's a list of Technologies you can consider to use or study.
JSP + Servlet = You would implement your own MVC
implementation(Though I would not recommend this if you are building
a large scale application unless you are really good at it. Consider
Number 2)
Consider To Use an MVC framework(like Struts2, Spring MVC etc.) or
like what Thorn Said, a REST framework like Jersey(Though I have not
tried using a REST framework).
Database Access - Do I need to explain why?
An ORM library - using an ORM can speed up development(this can be
subjective though), it makes data access more abstract and
portable,ORM implementation classes know how to write
vendor-specific SQL.
File Upload library - if you are going to use as Struts2 your
framework once of its depencies is the Apache Commons Library(Just
check their documentation).
You've said that the users will upload their videos and you will store them in your server
and you will play those videos in their web-browser you need to do File convertions, Why?
in HTML5, since not all browsers support all video formats, so you need to consider
converting the video to another format if you are going for an html5 player. you can check out different file formats that different browser supports here
For File conversion check this Here
Now for the client side video, you can Use the MediaElement.js it has a flash fallback, just in case that users video does not support HTML5.

First check out this for your player:
Player
Now your logic needs to be a little different. You should make thumbnails of the videos and send them to the player with a link. This way you only need one setup of the player and pass the url information into it.

Rather than starting this project with a list of technologies you need to master, I would recommend starting with an outline of what you want it to look like - how will the user interact with the site? What functionality will it have and how do you want this exposed to the user?
Next I would think about the data. How will it be stored? How will the video files be names and associated with users? What attributes of the videos do we need to store? For example, each video file can have an associated user (who posted it), some attributes, like date, file size, resolution, frame rate. Will we also be storing comments or ratings? Keywords? A Description?
Probably you will want a database to store this data, but I would just store the video files as regular files in the directory.
Now onto choosing a set of tools to get this done...
Java Servlets or a REST framework like Jersey.
File upload using an Apache commons library (probably no need for this if using Jersey framework)
Database access
HTML 5 video playback or Flash video or JavaFX 2
With HTML5 (browser based video playback without a plug-in) is not supported on all browsers yet.
A search feature could also be done in Java. You would need some database skills here and to do search well is far from trivial. But a basic search where you give the application a keyword and it gives you all videos listing this keyword should be simple.

Related

How to implement a Java back end to put web form input into a database?

So if you want to take input from an html form and put that into a database, you can have the form's action direct to a php file like example.php. That php file can then manage database calls with like mysqli_connect() and whatnot.
My question is, what is the equivalent of this when you want to use a Java back end instead? Do I have the form's action direct to a .java file? I know how to use Hibernate for databases, but I don't know how to connect the input from the web form to my Java code.
I have no clue what terms to even google for. I tried "java back end tutorial" but that wasn't useful at all. I'd appreciate any simple explanations, or even the correct technologies to look up.
You can develop Web application and Web site with Java. Google it and you will see a lot of tutorials on how to do it.
The initial technology to develop Web apps with Java is Servlet or JSP as said above by user2963623.

simple cms - only to create/edit content and export it via jdbc or java api

(i even don't know if i need a cms)
what i need is: a simple web based way for a functional department to create/edit multilingual text documents (probably tagged with customizable semantic tags).
The containing Texts are used in an RIA showing statistical data and infos about it. This infos and other user visible Stings should be fully managed by functional department.
the destination of the this texts/documents is an embedded apache derby db - delivered together with RIA release (as zip-File,- the texts are static).
So on the other hand the cms (if this is an cms) should provide an interface to export the data - either a simple db-structure to get data via jdbc or a java api.
so what cmc/?? do you suggest for this usecase
thx in advance
Maybe you could use a java web framework like Tapestry to create a simple web application.
It has some premade components too easily modify and save data to a database.

GWT URL routing and other features

I am thinking about using GWT in my future project. I have few questions:
How can I define the structure of URLs? Does it allow me to recognize the parts of the URL by some information I have in database? How it is defined? Directly in Java or XML?
Does it support HTML5 history tools to change the URL without the necessity of using hashes?
Forms and editation of items in database - does it allow to generate Forms by definition and generate their validation, without the necessity of writing everything hard by hand?
Are there any tools for uploading files (images) in iframes, so that the page does not have to me reloaded? Drag'n'drop uploading? Are there any tools to simply manipulate uploaded images? Resize, crop...
Is it natively possible to create similar hover information like it can be seen on (for inst. when you hover an item on the left, there is an information bubble appearing on the right side):
http://goout.cz/theatre/prague/
Is it natively possible to create similar search dialog like on the page http://goout.cz - for inst. when you type 'a' it starts to suggest items in the database with their pictures.
All the GWT application I've found, run in browser rather as an JS application - but is it possible for javascript disabled browser to use them? Can search engines go through them?
Thanks
1. How can I define the structure of URLs? Does it allow me to recognize the parts of the URL by some information I have in database? How it is defined? Directly in Java or XML?
It's up to you to code it all (or almost all) by hand, in Java.
2. Does it support HTML5 history tools to change the URL without the necessity of using hashes?
It's possible to do it (quite easily actually) but GWT doesn't provide built-in support.
3. Forms and editation of items in database - does it allow to generate Forms by definition and generate their validation, without the necessity of writing everything hard by hand?
No. Editors cut the boilerplate by half, but you still have to build your forms by hand (but that's not a bad things: generated things never look or behave like you'd like to). And UiBinder helps creating UIs.
4. Are there any tools for uploading files (images) in iframes, so that the page does not have to me reloaded?
Yes.
Drag'n'drop uploading?
Not directly. There's support for native drag-and-drop, but not for accessing dropped files and uploading them. It's not hard to add though.
Are there any tools to simply manipulate uploaded images? Resize, crop...
The canvas API is supported but you'd have to do it all "by hand" (including, particularly, getting the image to draw it to the canvas, and then upload the canvas content)
5. Is it natively possible to create similar hover information like it can be seen on (for inst. when you hover an item on the left, there is an information bubble appearing on the right side): http://goout.cz/theatre/prague/
Yes.
6. Is it natively possible to create similar search dialog like on the page http://goout.cz - for inst. when you type 'a' it starts to suggest items in the database with their pictures.
Yes.
7. All the GWT application I've found, run in browser rather as an JS application - but is it possible for javascript disabled browser to use them?
No.
Can search engines go through them?
Google can, with little effort.

Android - Obtaining data from a website

I'm finding my way around Android and so far so good. My next big challenge is coming to grips with web services. I would like to build an app that reads data from a web site or database on web server and store the data in my app.
Basically, it will be an app that I build in conjunction with a news website that pulls their latest articles into the app. What I'm finding difficult is how to bridge the gap between my application and the data in the SQL Server database.
I'm familiar with building asp websites that read data from a database, but how would I do something similar with an app?
Do I ask the website to store the articles in an xml format? Or, is there another way that I can request a specific article and be provided with the content?
I hope I'm phrasing the question correctly and that someone can just guide me to the right way to approach this.
Thanks in advance.
You can approach this problem from different perspectives.
The common solution is to build a Webservice that will bridge the gap between your mobile application and the data that remain in your server. I personnaly prefer to setup a Rails backend and thus have a RESTful API that will help me access my data. For instance, to retrieve the list of articles I could just request the following url: http://my_server_host/articles. So for the Webservice part you can have whatever you want: Rails, J2EE, .NET etc. And you can choose the model that fits your needs (REST, SOAP, XML-RPC etc.).
Then you will have to write a class that will contain all the necessary calls to the Webservice you have built. Basically, if your Webservice returns the results as an XML format you will have to:
Send the request to the appropriate URL. (See: HttpGet or HttpPost if you want to modify a resource).
Parse the XML returned. (In short, you can use SAX or DOM to parse your XML response and transform them to a business entity (an Article, a User etc.).)
This hopefully gives you a hint about a possible solution. By the way Google is your friend, but I will probably come back to add external links/resources to help you more.
Edit
Another possible solution that could work for you, since all you need is to retrieve some articles. Just setup a simple Wordpress blog for instance. Wordpress gives you an URL for the blog's RSS feed, all you will have to do is to parse that RSS feed (XML). There is a great article on the IBM website for parsing an RSS feed that you can find here. By the way, this solution is only possible if you want to save your articles on a Wordpress blog. But you got the point hopefully.
Reading your data form the Database on the Server would be bad practice. You'd have to open up some ports and that's defiantly not what you want (if you don't have root-access, you also can't).
For non-interactive content (what you want) you would use XML or JSON.

Clientside Javascript --> Serverside Java --> user is served a .doc

I am helping someone out with a javascript-based web app (even though I know next to nothing about web development) and we are unsure about the best way to implement a feature we'd like to have.
Basically, the user will be using our tool to view all kinds of boring data in tables, columns, etc. via javascript. We want to implement a feature where the user can click a button or link that then allows the user to download the displayed data in a .doc file.
Our basic idea so far is something like:
call a Java function on the server with the desired data passed in as a String when the link is clicked
generate the .doc file on the server
automatically "open" a link to the file in the client's browser to initiate the download
Is this possible? If so, is it feasible? Or, can you recommend a better solution?
edit: the data does not reside on the server; rather, it is queried from a SQL database
Yep, its possible. Your saviour is the Apache POI library. Its HWPF library will help you generate Microsoft word files using java. The rest is just clever use of HTTP.
Your basic idea sounds a bit Rube-Goldbergesque.
Is the data you want in the document present on the server? If so, then all you need to do is display a plain HTML link with GET parameters that describes the data (i.e. data for customer X from date A to date B). The link will be handled on the server by a Servlet that gets the data and produces the .DOC file as its output to be downloaded by the browser - a very simple one-step process that doesn't even involve any JavaScript.
Passing large amount data as GET/POST around might not be the best idea. You could just pass in the same parameters you used to generate the HTML page earlier. You don't even need to use 3rd party library to generate DOC. You could just generate a plain old HTML file with DOC extension and Word will be happy to open it.
Sounds like Docmosis Java library could help - check out theonline demo since shows it something similar to what you're asking - generating a real doc file from a web site based on selections in the web page. Docmosis can query from databases and run pretty much anywhere.

Categories