tvOS notification when TV's source/input/HDMI changed - input

So I have a video app for tvOS and I would like to serve ads on it, but one of the requirements is to not serve them while the TV is not showing them.
All good, but if you change the source of your TV and the Apple TV is still running it will continue to run and not lock or turn off while watching the videos. I thought that the resign active notification or entered background will give me that information, but they do not.
Is there any way to check if tvOS is currently on screen?
I am using tvOS 12 and AVPlayer.

Related

Camera live View in apple watch

On 3/9 apple demo.
They show how to use apple watch to see the camera live view and open the garage door.
I think they should integrate with HomeKit to control the garage door,
but how to get the camera live view??
Do these live view images come from iphone app?
then using bluetooth to pass the image data to watch?
The iOS parent app to the Watch app most likely integrates with HomeKit to control the garage door and the webcam.
In order to display the images from the webcam on the Watch, they are most likely writing those images into the Shared App Group between the iOS app and the Watch Extension using MMWormhole or a similar approach. They then read the images from the App Group and push them to the Watch over bluetooth and WiFi using the WKInterfaceDevice addCachedImage(_:name:) method. Once the image is uploaded to the Watch, it can then displayed on the Watch using a WKInterfaceImage or WKInterfaceGroup background image.

record app using iOS and Yosemite, but can only see black screen

I am trying to record a video of my app using QuickTime and the new iOS record feature in Yosemite. Problem is all I get is a black screen. Can anyone assist?
I found the solution. It wasn't able to see video until I switched from my Blue microphone to the iPad's built-in one.
in the QuickTime Player go to > File > New Movie Recording
Click the Arrow (that points down) next to the red Circle
in the Camera choose your iOS device , if it not showing , unplug and plug your iOS device again. if you would like to record the sounds that your iOS makes , change the Microphone as well.
Hope this helps.

iOS - make Apple TV always present in landscape orientation

I am building an iOS app that only presents in portrait orientation on the iPhone. (The views do not change when a user rotates the device.)
However, when users connect to an Apple TV, I want to make the views always present in landscape orientation on Apple TV even the iPhone presents in portrait orientation.
How do I achieve this?
Sorry, I read your question wrong the first time. Have you considered an option such as this: "Some video-oriented apps send their content directly to the AirPlay receiver when AirPlay is enabled—bypassing the iOS device’s screen (or displaying a message like “The video is playing on Apple TV”)". So in theory you might just be able to bypass the iphone and just deal with the apple TV settings.

how to keep ios app using opentok video chat in foreground

I've integrated opentok ios sdk in my iOS 7 app, it is working fine, except this problem:
During video chat if I don't access iPhone for 5-10 seconds..then my app moves into background, causing viewer at other end to hear only audio. Video is disabled after app goes to background state.
I've observed same thing with their official example
https://github.com/opentok/opentok-ios-sdk/tree/master/samples/OpenTokFullTutorial
How can I avoid my app going to background while video chat is ongoing. Skype is working fine in this case, I want to achieve same thing.
What you want to do is prevent the iPhone from going to sleep. To do this, you cant try this:
[UIApplication sharedApplication].idleTimerDisabled = YES;
Here is iOS documentation on idleTimerDisabled
If you don't want the app going into background at all (like when the user taps on home button), you can opt to kill the app when it's not running instead of having it run in the background. To do that, check out iOS guide on opting out of background execution
If you do not want your app to run in the background at all, you can
explicitly opt out of background by adding the
UIApplicationExitsOnSuspend key (with the value YES) to your app’s
Info.plist file. When an app opts out, it cycles between the
not-running, inactive, and active states and never enters the
background or suspended states. When the user presses the Home button
to quit the app, the applicationWillTerminate: method of the app
delegate is called and the app has approximately 5 seconds to clean up
and exit before it is terminated and moved back to the not-running
state.
Hope that helped!

iOS 5.1 Stops background music player

I have an app in the store that needs to play Music in background mode. Now with the iOS5.1 release, the music stops when the device is locked/moved to background.
I looked at the release notes and didn't find anything related.... Any idea?
In your app.plist your need to specify that your app will be playing audio in the background. For key "Required background modes" add a value "App plays audio". Note that raw name for that key is UIBackgroundModes, and the value you need to insert in that array is "audio".