how do I stream content from amazon in android? - android

I am creating an app that streams music from a movie soundtrack, and prompts the user to guess what movie it is from. Do to some legal ramifications of using third party music, I am forced to think of another way to do it, than using my own streaming service. one thing that I have come up with, is using amazon's music service (being that with them, it will allow you to stream up to 30 seconds of music without buying it.) how would I be able to stream music from their site in android? is there an amazon API that I can use? how would I access their server to stream it? and do they allow people to stream from them, or do I have to get special permission?

I bet this is against their terms of service and you will likely be shut down pretty quickly.

Related

Videoportal PWA (Progressive Web App) Video offline function?

We want to build a Videoportal as a PWA. Every video will have a watch offline feature. Can this be done via the Serviceworker caching? Or should another Download-Mechanism enable this Feature. The videos size is about 120mb. Target Device is Android and Web.(Sorry for bad english)
Yes, you can use the Cache Storage API along with service workers to handle offline video playback.
There's a complete sample app at https://github.com/googlearchive/sample-media-pwa.
If you were to use the Workbox libraries for handling your caching logic, then this guidance should help. If you don't end up using Workbox, then you'll need to implement some logic to handle Range: requests in your service worker, or else your video playback will likely not behave as expected when the <video> element tries to load a partial chunk of video bytes.

Understanding Android Service by example

I have an app that plays an song displaying its lyrics on the screen.
Two situations:
When the song is loaded from a local mp3 file.
When the song is loaded from remote location via internet
My understanding is that Android Service comes to rescue when the song is streamed from remote location via internet. Android Service helps here because of the i/o overheads involved. In the first case, where the song is played form local location, services is perhaps an overkill. I can simply play the music loading it in the activity and use MediaPlayer API to play it.
Is this understanding correct? Am I missing anything?
Update: The song size is over 10MB. So when you stream it via a slow internet over phone there might be some buffering and stuff to be accommodated for better user experience.
Thanks in advance.
There are different Services for different use cases. For a Media Player it depends if you want to have the playback continuously playing in the back- or foreground.
So both cases are applicable for a Media Player Service. But the Android Developer Guide Media Player Service outshines my answer
Using a Service with MediaPlayer
If you want your media to play in the background even when your application is not onscreen—that is, you want it to continue playing while the user is interacting with other applications—then you must start a Service and control the MediaPlayer instance from there. You should be careful about this setup, because the user and the system have expectations about how an application running a background service should interact with the rest of the system. If your application does not fulfil those expectations, the user may have a bad experience. This section describes the main issues that you should be aware of and offers suggestions about how to approach them
Your second case is more a question about networking and in this case you could use a IntentService to download the .mp3 and pass it to the MediaPlayer.

Android Game and Server with notifications

Currently, I'm working on my new project - a (quite) simple game on Android allowing users to play with each other. One game is divided into few rounds, that users play separately. When one user has finished his round, application should send message to a server, which, in turn, should send notification to the other player with set of actions made by first player.
Beside that, players should be able to send invitations to the game to other players and server, for its own, should be able to send notifications, when, for example, user didn't make a move for a long time. (sort of reminders)
I'm wondering which technology/library/... I can use to make this work. I read a little bit about GCM, but I'm not sure it's good choice. I don't want my app to send some "pings" to server in every second/minute to check if it has something new happened. I want it to be as light and speed as possible.
Can you give me a hint?
Thanks in advance.
#Tomek,
First, probably you will will need to keep a persistent connection while the person is in the game to you server to have a minimal latency.
Second, you know java if you are writing on Android
Third, asynchronous event-driven server model might be a good choice.
I'd like to recommend you to take a look on netty
http://netty.io/
At the same time, Google has a multi-player API, but it is too vendor lock and the general idea behind is different
https://developers.google.com/games/services/common/concepts/realtimeMultiplayer

Platform to use for radio server?

I'm making a mobile app where users should be able to start their own radio broadcast channels from their mobile phone. Other users will then be able to browse broadcasts and connect. It also includes some special perks to make it unique.
I've got the general concept of it thought out.
The thing is, I'm not sure how to implement some kind of "server" for it. I could think of two solutions to my problem currently:
Running a server which manages both the list of broadcasts channels,
and also broadcasts the channel to all users.
Running a server which manages the list. It stores a handle for connecting directly to the broadcasters phone.
Now I'm a total beginner when it comes to how demanding something is. Am I thinking correctly if i say that the first solution would overload the server when there are many users on it?
That would make the second option seem good, although if a channel gets popular enough, wouldn't it require insane amounts of bandwidth for the broadcaster?
Help me out guys, as I said I'm a total beginner when it comes to these kinds of things.
I would just use SHOUTcast or Icecast. It is very easy to start up either of these from another application.
These servers are very simple in their operation. Data comes in (usually encoded in MP3 by the source client [your mobile app]), and the server sends the exact data right out the door to any connected clients. It does implement a small buffer so that receiving clients can be initially flooded with data, to speed up the time before audio is played. You could always implement one of these yourself, but there is no sense in re-inventing the wheel.
You absolutely cannot run a server on the phone itself. Not only won't there be enough bandwidth, but each connection consumes some resources, which are extremely limited on a mobile device. You should host the streams on your own servers, and use the mobile device as a source client.
You're going to have to utilize some off the shelf product here. There's no way you're going to write something yourself that will do what you're hoping (unless your product is a total flop, and no one is using it). People can't broadcast much off their phones (your initial thought), so, you'll *have to be re-broadcasting everything for them, to whoever wants to be listening. It doesn't really matter how popular a specific "station" is, because the point is that you have to be broadcasting to whoever wants to be listening. These sorts of solutions require all sorts of very convoluted server mirroring schemes.
I'm not sure if something like SmartFoxServer can help you or if you want to try to leverage a VOIP server of some kind. I'm sure someone else will pipe in with a more specific and useful suggestion, but I can tell you for certain that this is NOT something you're going to write yourself, if you have no experience with this sort of thing.
And not that you asked, but I'll also note that if the users start broadcasting copyrighted material, then you're liable for pirated distribution of it. So, I'd be VERY careful what you allow people to transmit!

Android OS - Access and play sounds within an app after initiating a phone call

I've seen similar question posted, but with no answers.
My question is, after the intent to make a new phone call is initiated, is there anyway to keep the phone call active while accessing sound playbacks within a custom application?
If not, is it possible to modify the phone call activity, so the accessible sounds are in the same interface as the current phonecall?
You can keep the call active while playing audio in another application, but the caller won't be able to hear it. It would work like navigation directions while you are on a phone call, you hear them, but not the person on the phone.
You cannot modify the call activity to inject audio into the audio stream of the call, its an Android security measure as far as I know.

Categories

Resources