Java RTSP get contents - java

Can I download the contents from an RTSP url in java? Just like we can get contents of an HTTP url as an InputStream...
Thanks
Chris

Java uses "protocol handlers" to determine how to retrieve the resource identified by a URL. It's not limited just to the HTTP/HTTPS.
Apparently the Java Media Framework API can access RTSP resources. I don't know if it installs a protocol handler for RTSP or if it uses some different strategy. Google for Java Media Framework RTSP for all the details.

Related

java - send a file to client by file URL without download on the server

In my web application I have a link which, when clicked, invokes an external web service to retrieve a download URL for a file.
I need to send back to client the file which is beyond this URL, instead of the download URL retrieved from the web service. If possible, I would also like to do it without having to download the file on my server beforehand.
I've found this question about a similar task, but which used PHP with the readfile() function.
Is there a similar way to do this in Java 8?
If you doesn't even want to handle that file you should answer the request with a redirect (eg HTTP 301 or 302). If you want to handle the file you should read the file in a byte buffer and send it to the client which would make the transfer slower.
Without seeing your implementation so far, this is my best suggest.

Is there a way to redirect WOPI rest calls to read share point files?

We are integrating Office Online with our application to open Open Microsoft Office files(.docx, .xls, .pptx, etc.). To do that, we use the WOPI protocol.
These files can be local files or files hosted on SharePoint.
For SharePoint files to open them with office online through our application, we have to perform the following steps:
the control comes to WOPI getFileInformationCall
we need to hit the Microsoft graph API
to download the file
we read the file and return the file information from the REST call.
This all steps take time and are a bit fragile. Does anyone know if there is a way to redirect WOPI REST calls to get SharePoint files? Or is there another way to optimize these steps?
You can return FileUrl as a property returned from CheckFileInfo operation.
FileUrl is a URI to the file location that the WOPI client uses to get the file. If this is provided, the WOPI client may use this URI to get the file instead of a GetFile request.

How to Upload Image/Videos to Google Cloud Storage Using Java

I'm developing a server in Java which will provide URLs for images that clients uploaded. Basically the Android/iOS will send some kind of data (I still don't know which data would be sent for image and videos) then I'll upload those images/videos to Google Storage and provide URLs which the users (Android/iOS) will be able to stream.
I've just started with Google Storage and I can't find any example of how to upload an image using Java. All examples I found or are deprecated or it's in PHP or it's not clean.
I think I will need to use the JSON client Library but I can't find a good example for this library either.
Please any help will be VERY appreciate.
Based on your answer to my comment above, you could use the method I described in the following Stack Overflow response in order to save the file from your servlet to the Datastore and return the URL:
How to return a file with Google Cloud Endpoints?.
The two differences between your requirements and the method described in this response are:
The way the file is created: in your case through a file input stream, as you mentionned
The way you return the URL: since you will probably not use Google
Endpoints (because of file input stream) you don't need to return the URL in a string wrapper.

Host a streaming webcam on website with VLC/Red5 or whatever

I currently have a website that i am running at my home based on Java/SpringMVC web server.
I want to stream my webcam to my website so i can connect to it where ever i am from a browser and see my room.
Does anyone know an easy solution/server to use to do this and how to capture this in HTML.
Maybe a guide or sample project or something. I cant find anything useful/straight forward on Google.
I have already tried Red5/VLC as a media server but have had no luck so far capturing the video on a webpage. (using html5 video tags on chrome.)
I need to have this embedded in my home website. So it has to be browser based
I have decent Enterprise Java skills but streaming video is kind of new to me.
Thanks
Yes, you can stream a webcam to a website via multiple ways.
use Windows media Server/ Flash media Server. Push your webcam to the server by Windows Media Encoder or flash media encoder, and use the server live link to link with your website via any suitable player (like jwplayer).
Use Windows Media Encoder to stream your webcam to anyone without a server involved. when your encoder starts, you will get a URL to view your stream, which you can use to publish in your site.
use third party streaming services, where they give you a publishing point to publish your webcam stream, and use the link provided by them to show it on your website. (check with brighcove or Mogulus by LiveStream
Hope this helps.

How to implement communication between Java client application (Android) and PHP server application?

I have a simple Java client application (Android app). I have to write a PHP server application which receives a request from the Java client application to write some data to a MySQL database or read some data from the MySQL database. It should respond with a status message (Write failed/success) or the data requested respectively.
How would I get the Java client send a request and receive the reply from the PHP program and how would the PHP program receive the request and send the reply? I have googled about SOAP and REST architectures, but looking for a simple tutorial which will allow me to implement this simple program.
Thanks.
With basic Java SE API you can use java.net.URLConnection to fire a HTTP request. A basic example of firing a GET request can be found in Sun tutorial on the subject. A POST request isn't much different, you instead just need to set URLConnection#setDoOutput() to true and write the query string to URLConnection#getOutputStream() instead of in URL.
Note that it's "lazily executed", the request will only be fired if you actually obtain the response stream by URLConnection#getInputStream(), even though you don't need it.
If you want less verbose code and/or more control over the request, then I can recommend to use Apache Commons HttpComponents Client.
The PHP program in turn can just be written the usual way. Get request parameters by $_GET, $_POST and so on and echo the response. Nothing special needs to be done here. You may however consider to use an more easy parseable response format, such as XML or JSON.
You should build a simple JSON or XML based REST web service with PHP.
Then with the Android SDK, you can use the HttpClient module to connect to your web service. The SDK also provide a JSON and XML module to parse the result.

Categories

Resources