java video socket streaming to webview player - java

I am stumped.
I need to stream a video using my own server to a player.
How to stream a video stream to the WebView player?
Server ====socket video stream=====> Client ====> WebView player

If you just want a simple solution that works you can use a static video file on your server and the HTML5 video tag in your webView.
On Android, at this time, you need to have hardware acceleration turned on to support HTML5 video - see 'HTML5 video Support' note at the link below. You also need to set a WebChromeClient for the WebView which is called when anything affecting the UI happens - see the note 'Full Screen Support' at the same link also:
http://developer.android.com/reference/android/webkit/WebView.html
You can find a full working example which appears to be well maintained here:
https://github.com/cprcrack/VideoEnabledWebView
Your server then just has to serve the static video file in the same way it would any static content and it will be delivered using HTTP progressive downloading which looks and feels like streaming to your end user.
This does have limitations, however, as it is not 'real' streaming and you can't for example support adaptive bit rate streaming which allows you deliver different bit rates depending on the network connection. It much simpler however and it does not require a dedicated streaming server.
If you do want to use a dedicated streaming server then it is worth being aware that this is a relatively complex domain and that there are some open source streaming servers available that you might want to take a look at, for example:
http://gstreamer.freedesktop.org
http://www.videolan.org/vlc/streaming.html

Related

Video server using java

I'm making a social media app (currently mobile and soon also web) and it concentrates on videos. I've two problems:
1) from the android app, my current design requests for new feeds from a web service --> the server responds with json data that includes the video url and the other feed data (content, date, ... etc) --> then I set the url for the VideoView which will request the video. Now isn't there a better way so that I fetch a full feed with one request (with one request I return the data and the video/audio/image)?
Also after researching online, some say that you use an IntentService to keep fetching new feeds and cash it locally and some say not. what is the best approach for a social network app in the backend.
2) I read online that http streaming is a very bad idea if you expect multiple concurrent requests for the same video/audio (I don't know if this applies for images too), the limit is almost a dozen of requests. how should the backend store and send videos/audio back to the mobile/web app in an efficient way? how does big social network store their data and send back so that the used can have the best experience (I know my app won't have .01% traffic compared to large social media sites, but I'm expecting thousands of users and hundreds of them might request the same video at the same time)? any link for a server (preferably using Java) to do such thing will be appreciated.
so long story short, if someone can help me find a good resource to design a backend for a soical media app, that would be great. and sorry for the long post.
Your approach seems fine if it works for you - you don't need to use the same server for all your content and a typical 'pattern', which may reassure you is:
static content on simple static web hosting or CDN (e.g. Amazon S3 or simple static web server) - this is content which does not change all that often, like pictures, heading text, info text etc
dynamic content on whatever is your favourite flavour of web server/language technology - this is the content that changes per user or frequently over time.
Video and audio hosted on a separate dedicated streaming server, linked to a CDN mostly likely, or on a web hosting service that specialises in video/audio.
The reason for separating the video is that the technology for streaming videos is quite specialist and if you really want to support many devices then you actually need multiple versions of your video to support all browser/device and network bandwidth combinations. If you want to get started quickly a good cloud video hosting service will do the hard work for you here and allow your videos appear without any 'YouTube' like branding/ads etc.
If you want to run your own video server then there are open source options like VideoLan and GStreamer or paid versions like Woza:
http://www.videolan.org/vlc/streaming.html
http://gstreamer.freedesktop.org
http://www.wowza.com/products/streaming-engine

What is the most efficient way to record video in a browser for purposes of storing on a server?

I'm in the process of developing a java web application using Spring MVC that will (among other things) be capable of recording video from a camera on an Android based tablet and ultimately transfer that video to the server (dbase or filesystem). I see there are a number of tools available that might allow me to do this one of two ways: (1) record that video locally in the browser and potentially upload the final product as a single file to the server (i.e. RecordRTC) or (2) establish a connection to the server that enables me to stream the video direct, leaving it to the server side to manage the actual recording (i.e. Kurento, Jitsi). However, there are a few gotchas in all of this that are making it difficult for me to determine (1) which way makes sense and (2) which way is actually proven to work:
must be capable of running in any browser on an Android based tablet (v 4.2+)
recorded video can be anywhere from 15 sec to 15 min in duration
users will be securely authenticated at login via Spring security; video streams/files need to be handled in that established session (which I don't think is possible with Kurento)
must be open source
I've been developing Java web applications for many years now, but the video capture and processing component is something new to me and I'm hoping those with experience in this arena could guide me in a direction that makes most logical sense.
NOTE: I am open to other ideas that might make more sense than what I've mentioned already. Given the direction of HTML5, I thought WebRTC would be the best route. But given some of the Android based browser limitations, I'm not sure.
Thanks!

Best ways to stream live video to a webpage using Python/C++/Java

I want to read in a live video stream, like RTSP, run some basic processing on it, and display it on a website. What are some good ways to do this? I have used OpenCV for Python before but found it to be a hassle. I am also familiar with Java and C++ if there are better libraries available. I haven't done a lot of web development before either.
What kind of live video source that you mean? If you don't intend to do this code-wise, you can use the free VLC Player to act as a streaming service in between any kind of media stream source (file, network, capture device, disc) and your web video client.
But, if you intend to do this code-wise, you can you VLCJ library. Other options can be Xuggler or FMJ.

Web-cams, Java, Streaming.

I need to set up live streaming from a number of web-cameras to the internet (in browsers), and the streams should be visible only to particular users. I.e. user A logs in to my system with his or her login/password, goes to the video stream page, and sees the stream from a particular cam, and other users cannot see that video, even if they know the url to that stream.
I've looked at a number of solutions so far, but some of them are obsolete, most of them are for image processing, recognition and the like, and some are just a bit too cumbersome, like Red5, for example.
Is there a relatively simple solution for that, that would just allow me to get a videostream from a particular cam connected to my computer?
Thanks in advance.
If you are using Linux I have had success with V4L4J (Video 4 Linux 4 Java) which is small and really quite cool. You would need to do quite a bit of work to get streaming working for a low bandwidth connection but if it is over LAN playing back an MJPEG stream over a TCP socket is easy beans :-)
http://code.google.com/p/v4l4j/
Good luck.
Have a look at Java Media Framework to communicate with your cam.

Frame/clip grabs using Java from a network video camera/adapter (no activex)

I'm interested in doing image processing in Java with frames collected from a network video adapter. The first challenge is finding network video adapters/cameras which don't require an ActiveX control for PTZ control and therefore require IE. Then the issue is how to do still image grabs from network video adapters which only make MP4 available.
Does anyone know of some Java friendly network video cameras and adapters?
Anyone know of some Java code to control PTZ on a network camera?
Two ways in Java that I know of. The first (and the one I current recommend) is the LTI-Civil project. The second is to use Xuggler which uses FFmpeg webcam code behind the scenes.

Categories

Resources