How can I stream video to a browser using Java/Spring? - java

We a have jboss server running and have a basic web setup using Spring but now I would like to stream video into the browser. I am trying to use xuggle but then I read on their website that you can't put it into an Applet or use it with java webstart, so I'm assuming that means I can stream to a browser, is this assumption correct? If so does anyone else know any libraries or how I should go about doing this? If you need any more info or have questions I'll be happy to answer although I'm very new to streaming video and relatively knew to Spring.
UPDATE: So I'm able to generate a video using xuggle, and then I can embed that video in my html code... but I can't generate and stream at the same time. Does anyone have any ideas how to make xuggle push date out to my tomcat server?

You may want to look at Red5 media server.

Since you are doing jsp, just have your code write out the HTML 5 video element. That will provide basic video functionality. This will work in all HTML 5 compliant browsers as well as all mobile devices.

Related

Reading network traffic from the browser using Java code

Folks,
I was looking for Java capability of reading thru the network tab.
I had a task of hitting a URL in the browser, reading and validate some tags which are fired on page load.
I Know to fetch the View Source Data of the page, but not sure on getting network tab data.
example:
Opening a URL in chrome browser and watching Network tab in the developer tool, i see bunch of Get requests(tags,js etc) getting fired & need to capture this data.
I wanted to know which is the best way to achieve this and great if any code snippet is available.
Cheers
You can use HttpClient to work on api testing. There are many tutorials to work on api testing using Java. For starter you can read about Apache Http client.

Using RED5 to record video stream

First of all - My English is very bad! so I hope you will understand what i'm asking...
I'm having difficulties in understanding how to use red5 to record stream from the client webcam onto the server side. I have red5 installed on a remote unix server, and i want to enable the users in my website to record stream from their webcam and store it on the server.
I have knowledge in javascript/php/java, and I know that I need to RTFM. I did try to search for some helpful information but i couldn't find any leads regarding my question.
Could you please help me with the first steps like how to connect to the remote server (I'm using Eclipse IDE for Java EE Developers).
Thank you
I advice you to take a look to openmeeting ,it's open source and use RED5 as media streaming server, and provides recording feature from client, and many other interesting features related to webcam.

How to make Tomcat stream media?

I am entirely new to streaming implementation. I have developed some RESTful web services using Jersey/Tomcat. There are few cases where I need to send audio/video files to the clients, which uptil now I have been sending as a file fr download - now I want to stream these files.
Do I need to write some code for this ? Or I need some third party solutions ...I have heard about Wowza / Darwin / Red5...But I dont know if they can be integrated with Tomcat and my existing services. Any third party solutions need to be free / opensource, and they should support both audio and video streaming. In the near future I need to add transcoding support too..for which I am planning to use Xuggler. So it would be good if the server is having such support.
Any pointers would be appreciated. Thanks !!
Red5 is essentially Tomcat with added features. I don't know how far back in time the fork was made but the basic functionality is all there.
Also - Red5 and xuggler play nicely together.
You'd still need to code up the client side of the streaming portion though. Its possible that HTML 5 will give you this for cheap.

How to talk to Tomcat server from a PHP application

I am developing a new report engine for my company, our main web application is writing by PHP 5 and running on an Apache server. The new report server which I designed to use Apache FOP 1.0 ruing on Tomcat7,so far I created My own XSLT stylesheets and I can manage to generate a PDF report from the URL and let it display in my web browser.My goal on this project is to generate dynamic report from xml file which export from the PHP application.
Could anyone explain to me the logic behind How I can give those two talk to each others. I understand I could POST the XML and XSLT as string to the report server and POST it back the result I want(like PDF).
I know this will need Java involved,and as a PHP dev. I really don't have much background about Java,if you could show me some examples or links, it would be much appreciate.
I am using Saxon-B with Fop 1.0 on Tomcat 7 for the report server.
if you need more info from me,please also leave a comment. I will add it soon.
Thanks
There are two things your going to need to study.
http://www.w3schools.com/php/php_ajax_intro.asp This is a tutorial on using the XHR object from php. You should go through that. Also, if you aren't familiar with the XHR object, I would read this as well: http://www.w3schools.com/XML/xml_http.asp
You're going to have to create a servlet capable of responding to these requests. There are various tutorials on how to create a servlet.
Here is a link to a youtube video I fall back on when I forget how to do servlets: http://www.youtube.com/watch?v=EOkN5IPoJVs
In the video, he just uses straight up javascript; so you're php code is going to be doing what the javascript did in the video (item 1 on my list).
The video uses an older version of eclipse (I think ganymede), but it is pretty close to the same process in the newest version of eclipse.
Just to be blunt, this isn't something you're going to be able to figure out and make work properly. You've probably got at least a day to a weeks worth of learning here depending on your experience and aptitude; and this will only get you something basic. The servlet you make won't be secure, it won't have user authentication...my point is don't take anything for granted.

How to upload and stream flash videos using java?

I want to create a html page that can be used to upload videos and also able to playback the videos. I am totally new to this. 2 weeks before only i learnt uploading and processing images. So, i need some guidelines like
How to upload video?
what concepts i have to learn?
what are all the libraries i may require?
How to convert it into flash format?
How to stream it back to user?
I am using Java in server side!
And i also want to know that Is there any way to do them all with AJAX?
Any suggestions or advices or links or anything that can help me would be more appreciative!!!
Thanks in Advance!
Hmmm... seems interesting..
How to upload video?
Well it depends.
If you are using a thick client (aka swing or swt) then you can use Apache Commons File Uplaod API.
For JSP http://www.roseindia.net/jsp/file_upload/index.shtml
With JSF - (http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html and http://onjava.com/pub/a/onjava/2005/07/13/jsfupload.html)
With AJAX - http://www.openjs.com/articles/ajax/ajax_file_upload/ (basic example but enough to guide in right direction :))
what concepts i have to learn?
As a library integrator you will need to know about the front end technology you are going to use (JSF, JSP or PHP etc)
You should know about basic of multimedia handling in java (sometimes help in debugging)
Basic of flash video (specially how streaming works in internet video http://blog.xuggle.com/2009/01/23/overly-simplistic-guide-to-internet-video/ )
Assuming you already know about servlets etc.
Have a look at HTML5. It has some great offerings like video playback etc.
what are all the libraries i may
require?
Again depends
IF choosing javascript for front end + AJAX in mind http://jqueryui.com/ or http://jquery.com/
IF JSF is the choice for front end - http://www.jboss.org/richfaces or http://www.primefaces.org/ along with JSTL etc
You will need a library like http://www.xuggle.com/xuggler/
Xuggler is the easy way to uncompress,
modify, and re-compress any media file
(or stream) from Java. Xuggler is
available under the GNU Lesser General
Public License.
Most of the Flash video sites either use xuggler or FFMpeg for conversion and playback.
How to convert it into flash format?
Use Xuggler http://www.xuggle.com/xuggler/. It uses the FFMpeg http://www.ffmpeg.org/. Though you have to use at server side for conversion (As of now you can not use it in applet). Refer to http://wiki.xuggle.com/Tutorials for more information.
How to stream it back to user?
I normally do it in this fasion.
<embed height="385" width="640" type="application/x-shockwave-flash" src="http://s.ytimg.com/yt/swf/watch_as3-vflofTU0v.swf" id="movie_player" flashvars="rv.7.length_seconds=107&rv.2.thumbnailUrl=http%3A%2F%2Fi4....." allowscriptaccess="always" allowfullscreen="true" bgcolor="#000000">
I hope it will help you :)

Categories

Resources