Airplaying video from url to ATV using lots of battery on iphone - iphone

I am writing an app that plays a url using MPMoviePlayerController. The app works in the background and using airplay also works with an ATV, macmini using airserver and XBMC. The url is to a movie file on the local network. The way I understand is that the phone doesn't do any heavy lifting but merely passes the url to the apple tv and as long as the url points to media that the AppleTV supports then it will play.
The problem I am having is that the apple TV must be aggressively pinging the iphone and keeping the wifi active since the battery life is hit really hard. Playing an average sized movie knocks the battery life by about 2/3 on an IPhone 3GS and 1/2 on an IPhone 4S.
If I am playing on the mac mini using air server then the battery life on the phone reduces at the same rate as if the phone was backgrounded and not playing anything. I noticed that if I stop the wifi on the iphone then the movie will keep playing on the mac mini but stops within about 30s on the ATV. I am guessing the ATV keeps pushing out an event saying that it is playing and if it doesn't receive an OK in return then it stops playing.
Is there something I am doing wrong? Have other people experienced the same battery drain using airplay from their phone? I have tried someone else's app and it also did the same.

A packet trace of the traffic would give you a definitive answer. But, assuming the documentation you linked to is correct, your answer may be here:
The AirPlay server is a HTTP server (RFC 2616). Two connections are made to this server, the second one being used as a reverse HTTP connection. This allows a client to receive asynchronous events, such as playback status changes, from a server.
The reverse connection would keep the WiFi radio active.

Related

How to play sound on both speaker in iPhone programmatically during a phone call

I would like to know how to play sound on both the iPhone speakers during a call.
It is working fine when I'm trying it when iPhone is not on the call.
The actual problem I'm facing is: When i have play sound from both speaker and phone was not on call it working fine. But if iPhone is switched to a call and I am trying to play sound no sound is playing.
I very much doubt it is possible.
A telephone is an emergency communication device. The inability to make, receive or even clearly hear a phone call could literally kill someone. Consequently, the iPhone API strongly protects the integrity of the phone before all other functions.
Even if you did figure out a way, I doubt Apple would let it through. (Think of the liability issues for them and you!) The iPhone isn't a very small laptop, its a phone with a computer attached and the phone comes first.
You should always consider that when starting a design.
iOS disables an apps Audio Session during phone calls. Thus an app has no access outside its security sandbox to the mic or speaker until this audio interruption (the phone call) ends.

GameKit keeping connection going while device screen off or in background

I am working on an appliction that requires bluetooth connectivity, which i use GameKit for data transfer, however im seeing that when i go in background mode, or I just turn off the screen in app, the bluetooth connection is dropped... Ive seen other apps that keep the connection alive in such situations, anyone have any idea if I am missing something that wont cause the connection to drop on such cases? Have been looking around but havent found anything useful...
Thanks
Daniel
This is not intentionally supported by Apple.
If you are writing this for an application that doesn't have to be distributed through the App Store, you can set the application up to play a silent audio file in the background. This will allow GameKit to continue to work even when your application has been put into the background or if the screen has locked.
If this application has to be distributed through the App Store, Apple require the audio to be a real feature, with audible music playing.
If you have two devices connected using GKSession and then one of them is interrupted by call or goes into background, when it wakes up connection should be still alive (you should be able to send/receive packets between devices).
You may try setting
UIRequiresPersistentWiFi
in your plist.

iphone 3G data network timeout?

My iPhone app sends data persistently over the network, and can handle having the network completely unavailable for a time. However I do my dev on an ipod and have difficulty testing 3G connectivity issues; My question: is there period of non-connectivity, while an app is in the foreground, after which the iphone will stop checking for the network, such that there are no bars and reachability returns 0 until the user "wakes" the phone, e.g. by locking/unlocking? Or can e.g. 1 hr without data network pass and the iphone will recognize that the network is back and reachability will start returning true (I am polling every 1 minute while there is not connection to my server).
This is my experience with wifi: if, while running my app, the ipod hasn't connected to a wifi network for 1/2 hr, it stops looking for networks, and I need to lock and unlock it to stir the device into looking again.
One other thing: the iPhone has the screen dimmed by the proximity sensor while all this persistent network use is happening.
Wi-Fi going down after 30 min of inactivity is a documented behavior. Cellular network is always active, unless turned off by the user. So if it goes down for a while it should get back online automatically when possible even if there was no user activity.

video streaming between two iphones?

is it possible to show what is showing in camera in one IPhone to another iphone through
bluetooth(GKSession)..Remote Live is available in Appstore.any idea pls?
I have never developed for iPhone before, but the idea sounds like it should be possible. I would take the approach of remote desktop basically. On the host phone, start up the camera and capture the image/video stream, then on the receiving phone have the client app that pairs to the host via bluetooth (wouldnt a wireless connection be better?) and send the data to the client phone to be rendered?

iPod touches cannot find each other through GameKit

I have two physical iPod touch devices. If I try running a program that uses a GKPeerPickerController to find another iPod touch running the same program, they just stay at the peer picker screen without any progress. Both have bluetooth enabled. I have tried my own program, along with Apple's GKTank sample app. Neither of the iPods seem to be able to detect bluetooth devices, such as computers in discoverable mode... could this have anything to do with it?
I was able to fix this problem by restoring the software on the older iPod. I wonder if jailbreak may have caused this issue?
A couple assumptions are throwing you off:
The GameKit Bluetooth stuff runs its own protocol, which doesn't involve traditional Bluetooth pairing or discoverability.
The simulator doesn't support connecting to devices via GameKit, so you need to test this with two real devices (or two computers, as the simulator will run the GK protocol over your current TCP connection [ethernet, wifi, etc]).
The Bluetooth bring-up of TCP/IP and Bonjour is really slow, so your first connection will often take upwards of 30 seconds to do any discovery. Even then, it seems flaky to me.
Jailbreaking your iPhone puts everything in play. You should expect stuff to not work, and be grateful if/when it does.
Gamekit only work on second generation iPod Touches (and iPhone 3G and 3GS). You didn't say whether what version your touches are.
I have been getting this error throughout the development of my game. It also leads to other problems when trying to reconnect to another game as the peer picker takes ages to connect so users get impatient. Apple needs to work on getting this more reliable.
I have restored my ipods now so will be interested to see the outcome.