Turn off mirroring programmatically in iOS while airplaying to apple tv? - ios

I am working around airplaying in iOS and I can able to do that without any issues. My issue is when mirroring is turned on i can see my mobile screen on apple tv, but I want to turn off mirroring programmatically and have to show apple tv default player and this is possible because I seen Netflix app they are doing this.
So could any one help in this?

Set usesExternalPlaybackWhileExternalScreenIsActive property to YES.
Go through the following doc
https://developer.apple.com/documentation/avfoundation/avplayer/1624255-usesexternalplaybackwhileexterna

Related

iPad 2 and 4 not mirroring/outputting video via HDMI to full screen

I am encountering an issue which I believe is caused, as a result of upgrading to iOS version 6 on my iPad2 and iPad4. I have searched the support boards but have not found a solution to this issue. The issue involves mirroring the iPad on a TV using the official HDMI adaptor as shown here: http://store.apple.com/uk/product/MD098ZM/A/apple-digital-av-adapter
When playing a video on the device using the native MPMoviePlayerController, via the adapter, the result on the TV is not full screen and, instead, it is provided with black borders around the video (these bars are an ever present even when viewing the app's non-video parts or the standard apple menus which I believe was always the case but, previously, the video played full screen via the cable).
I have tested apps which I have developed which contain video playback, as well as a number of leading apps on the marketplace, and all experience the same issue when playing video mirrored on the device with iOS6 and TV at the same time. The only app I found that was able to play the video full screen on TV is the BBC iPlayer, but this seems to switch of mirroring off temporarily when the video is played full screen on TV.
I believe that, when on iOS 5, it was possible to mirror the video playback on device and TV simultaneously, and at full screen, without the black bars on the TV.
Can anyone here please confirm if this issue is related to iOS 6 and be able to kindly point me in the right direction to resolve this issue in the iOS apps that I have developed?
Are you sure that this is not happening because of your external screen's overscan settings?
Check this thread iOS screen mirroring shows overscan borders on selected apps
And here is some information on overscan & underscan from Apple
http://support.apple.com/kb/HT5841

Embedded videos not showing up in iPad landscape view

I am building a website that has embedded videos, mostly from YouTube. The videos are not showing up in landscape view for iPad. Any idea why or how I can fix this? THanks!
Unfortunately i will need more information about this in order to be able to provide you with a specific answer.
Can you see the video on portrait mode but not on landscape?
There is a fair chance you have your YouTube app hidden via a jailbreak tweak, or you have restrictions enabled. Restrictions can be enabled without a jailbreak.As it turns out, having the YouTube app hidden can result in embedded videos not to show. YouTube videos on the actual YouTube site will still play fine regardless, but embedded videos can give you problems if your stock YouTube app is hidden, or you have restrictions enabled.
If your iPad is not jailbroken, then go under Settings/General/Restrictions and ensure that the YouTube app is set to On.
PS: I would also advise you to update your iOS version to the latest one.
I hope this solves your problem, if not then please provide more information like:
1)if your iPad is jailbroken or not
2)the version of iOS you are running
3)a link to one of your pages (or the code)
4)verify that this problem occurs in more than 1 device (to check that it is not a device issue)
Regards,
Thanos

Airplay with photos

I looked up the official documents for airplay, found the airplay can only support audio and video. But beside that, the native photos app can airplay photos. So is there any methods to airplay photos? BTW, I know the "mirroring" mode can do this job: I can detect 2 screens in my code and present a different screen to the iOS device's in this mode. However, the "mirroring" mode only exists in iPad 2, new iPad and iPhone 4S...
I found solution here
http://livevision.us/wordpress/2011/02/16/airplay-without-private-api/
and
How to find the IP-address of the active AirPlay device?
I could send some UIImage to apple TV.
but I don't know if apple allows using these Unoffical Airplay protocol.
It is documented on Apple's site. When the user enables airplay mirroring, your app will find two UIScreen:s. It's quite simple.
Here's a sample app http://developer.apple.com/library/ios/samplecode/GLAirplay/Introduction/Intro.html

Enable/Disable camera app programmatically

Is there a way to programmatically restrict camera access on iPhone 4S 5.0.1?
I am building a simple app with a button to enable/disable shooting with the camera.
I believe it should work in the similar way as the restrictions work in Settings app.
I am not going to deploy it, so I do not mind about Apple's approve.
Thanks!
there is no such a policy based programming like android in iphone to disable the camera. its possible only in rooted iphones.
I think the only option will be with MDM solutions

AirPlay Mirroring iPhone to Mac OS / using UIWebView + AirPlay

I need to live-demo a Mobile Safari browser app (iOS 5, iPhone 4S) on my Macbook and was wondering the best way to do this?
One way I thought might be possible would be using AirPlay Mirroring, but there doesn't seem to be any Mac OS apps capable of showing my iPhone screen mirrored.
I am an (beginner) iOS developer and wondered if there was anyway I could knock up a basic app with a UIWebView in it to somehow stream the contents of the web page and my interactions with it to my Mac.
Any thoughts?
EDIT: Yes I know I could use the iPhone Simulator, but I need to interact with it on the handset using the mobile phone network.
The situation has changed since this was asked.
AirServer (AirServerApp.com) and Reflection (ReflectionApp.com) both support AirPlay mirroring. Here's an article comparing them:
http://www.macstories.net/reviews/mirroring-multiple-ios-devices-to-a-mac-comparing-airserver-and-reflection/
Since your device (iPhone 4s) supports video mirroring via AirPlay, then you should be able to use AirServer to enable mirroring to your Mac.
Update: As pointed out by Marc Surman, AirServer does not support mirroring, rendering this answer incorrect. Thanks for playing.
Mirroring uses FairPlay encryption, which is why AirServer and similar applications can't do mirroring.
You CAN, however, fake this using AirplayKit:
https://github.com/rothacr/AirplayKit
The iOS demo in that repo actually does a simple mirror by sending an image of your screen to the airplay device using a timer. It would probably work just fine for a demo, and should work with AirServer.

Resources