Java - Live Streaming Video which uploaded to Database - java

I think the title says all, but here's what I've done so far:
I managed to upload video to MySQL with Large Blob
Currently, I also managed to stream the video, but this way take 2 steps, which is:
First: I extract the blob into local directory
Second: I use that directory path as src in my video playing page.
Now that my lecturer wants it without extracting to local disk first, he wants to live streaming from database. I only managed to do this if it's a picture, but a video I don't get any clue.
I hope anybody could help me or at least give me clues, thanks in advance :)

I think this should be a good place to start from:
this
Also, if you are just downloading the file, this link might help.
And if you have your own software on the clients side to show the stream, I would suggest that you will open a socket between the client and server and then just sent the video in pieces.

Related

How to capture (record) video stream that enters to my browser?

Imagine you watch sports live in your browser. It means you receiving a video stream, right? I need to record this stream and save to disk. The problem is that I don't have a clue from where to start. I'm not new to programming, but have a little experience in live video streaming.
I see this problem divided into this parts:
1) Parse html page and find live source URL. (? sounds silly, I'm not sure it is easy to find URL)
2) When I have URL everything else becomes easy. I would use Java for example, to receive and record stream.
So the main problem is to find live source URL. Does anybody know how to do that?
a) From HTML5 video player
b) From flash player
I had similar concerns before the best think I can suggest would be ;
For the first option :
open browser developer tools or wireshark and monitor the network while watching the video this is the most efficient way of locating the video source than you can just download the stream from the link
The second option :
there are some java libraries(jentpcap,jpcap ) for capturing ip packets after capturing the network adapter a while, you can filter them by type such a mpeg and get destination url note:some servers are sending these video samples as fragments you might need to merge them after downloading.
one more suggestion is gstreamer , as far as I know it has java wrappers and it is very useful for recording live videos to a file.
If the sport you are watching has any sort of value then it will most likely be protected by DRM and you will not be able to do what you are suggesting on your PC/laptop.
You can still capture the file but as it is encrypted you won't be able to play it back.
If it is not protected by DRM then finding the URL from the source can work - it depends on the video file type and whether the server is using any sort of authentication before mapping the URL sent from the browser to the URL of the actual video.
You also likely need to understand the type of URL - not all videos play in all devices, and some video URL's actually point to a manifest or 'index' file which then contains the actual URL's for the individual video and audio streams.

Android GTFS app

I'm trying to work on an app which uses GTFS. This may seems like a stupid question but I couldn't find any answer to it.
The GTFS for Israel, a rather small country with not so many buses infrastructure, is around 120 MB zipped file.
Right now the only possible way I could think of for getting it working is to download the file, but downloading 120 MB using the phone could take quite a long time. Sure you can do this only once and save it in a database on the phone, but it still requires downloading 120 MB.
Since it is zipped, I can't unzip it over the server and than just get the txt files..
So basically I'm asking, How can I get the information to the phone, without downloading the zipped file?
I've seen and used apps which uses that same GTFS file, and they load up really fast, even on the first load..
I hope you understand my issue, not sure how to explain it better.
Thanks!
P.s I would make an iPhone app too, and it's the same issue, hence the iPhone tag
One approach might be to preprocess the GTFS data during your app development. You could load it into a SQLite database, and use Core Data to get the data you need out of the file at runtime. This also gives you an opportunity to include only the data that you actually need for your app - it doesn't make sense to ask users to download extra data that they won't need.
Use protocol binary format (pbf) formely google and now open source. It is compact and very fast searchable, so no need to decompress it on a device and load it into a database on that device because pbf acts as a database. Just include pbf library in your code to query it. Of course you have to compress it once before distributing the data online.

How to display a portion of video file in a java web application?

I have several video files stored in the file system. My requirement is to load a portion (say initial 5 minutes or the portion between 4 minutes to 10 minutes) of the video file and then display it in the webpage. What is the best way to do this in Java? I can move the video file to database if that can be useful. Somebody, please let me know.
You could make use of some streaming server, Red5 is one, and it is Open Source as well. There are a lot of examples they give with the download, you could make use of them. Good luck with that.

java JSP coding in learning management system

I am working on a project named as LMS (Learning management system) and the modules allocated to me are:-
The uploaded course content saved as ppt,doc ,pdf or audio/video file should be opened in the same window.The application by which file needs to be opened should be embedded in the context window itself.
The uploaded course content saved as ppt,doc ,pdf file can be converted to audio/video file.
I have to code them in JSP.
Being new to java i am not getting how to do these. Can you plz plz help me out by showing me some direction? I shall be very thankful to you.
I will be waiting for your reply desperately.
Thanks and regards
swati
First I have to ask do you already have a transformation server/code to do the conversion in point nbr2 or do you ask for guidance on that to? If that's the case maybe you can look into HTML5 for this otherwise use something like flash.
I would say use HTML5 for video and the other things I would require the users to install the correct plug in adobe reader ... I think it's reasonable to put requirements on the user when using an enterprise app.
Almost all of this could be done in HTML JavaScript inside your jsp.

Playing a sound file on website media player

Hey all, i'm new to web development so i'm really dumb when it comes to tools for working on it. I have .amr files recorded from my BB application that are sent and saved on a server. I want to be able to play these files via a webplayer on a website, I have a couple of questions regarding this:
1) Would it be sound to convert these files to something like mp3 o wav instead of trying to play using the amr format? The sound files are received by a java web service and saved as files on my hard drive with the URL saved on a MySQL database. So if a conversion method is suggested I would prefer it be in Java.
2) What player can I use and how, to play these files? Be it the amr files or converted files
3) How can I create a link that will point to said audio file so people can go to it and hear it? I know this differs a little from my original question line but I have to able to do it as well.
thanks in advance
1) MP3 or wav would be a good idea. You could use something like LAMEonJ (http://openinnowhere.sourceforge.net/lameonj/) for wav -> mp3. And with luck there's something similar for AMR.
2) Is the <audio> tag in HTML5 likely to be an option? The users could then play the file directly in the browser, and you could just render HTML on the website, rather than providing it through a webservice.
I think you are suggesting an applet on a web page, that connects to the server via a webservice, which would certainly be possible but a lot more work.
Otherwise, if you're just serving a music file, you're not going to be able to control what player is used on the client side, once they have your file they can do with it whatever they like.
The only down side of HTML5 is that they'll need a relatively recent browser.
3) If you're using <audio> then this is already taken care of.
If you google for the <audio> tag I think you'll find a lot of information,as well as strategies for providing alternative players to older browsers.

Categories