I want to build a basic Client-Server application, where my android smartphone can stream some audiofiles, which are saved on my local server.
For the client-server communication I started with a REST approach, so I'm using simple HTTP-GET Requests on android and PHP & MySQL on the server side. The HTTP-GET request gets returned an URL to play a specific file.
Afterwards I use this URL to start playing the file:
mp.setDataSource("http://127.224.2.222/music/filename.mp3");
In order to do that I saved the music folder right into my www directory of the ApacheWebserver.
Is the REST approach the right way to do it?
What about security concerns, how can I prevent that people download the files?(i.e. I think its quite easy to see the files in a browser, once someone knows the address of my httpget request)
For streaming the music, right now Im using this simple HTTP approach - what are the advantages of an RTSP connection?
For authentication of your webservice, check out OAuth2.0, which is the de-facto standard to do it. If OAuth is too much for your program, you may add a simple token in the URL. This still leaves you wide open to a range of snooping attacks, but does add a little protection.
As for the approach: A http request will simply download the file at top download speed (while sacrificing latency) and buffer it on your phone. An RTP (RTSP is actually a different protocol for controlling a device rather than streaming media over the network) connection has a lot more protocol specifications for RealTime streaming as a low latency and only requesting the next x data packets needed for the buffer. In other words, http will simply get the job done, while RTP is a more elegant solution.