Set Airplay manually? - ipad

I have an iPad app and I have a video playing in a view. I would like to play video using Airplay but by pressing my own button.
I have set allows airplay = YES and so forth, this works if I enable the full controls, but I want to set no controls and have my own button to play the video using Airplay.
So far, I have found no information that would allow me to play a video on AppleTV without allowing the normal controls.
So just using an UIButton action to force the airplay, or at least get available devices and set it manually. Anything that would allow me to do this.

MPVolumeView will only control audio, it won't control video. For that you'd need iOS 5's AVPlayer, or a movie controller.
An alternative for you might be to use AirplayKit, a 3rd party library.
https://github.com/rothacr/AirplayKit

To answer my own question.
This is quite possible without jailbreak.
Here is apple's own page explaining this, so this will pass the review process.
Apple developer library document explaining how to do this

Related

Is it possible to detect music controls

I have a side project playing with some music controls on my iPhone. I know that i can detect volume up/down keys or track changes for Apple music app. Does anyone know if this is also possible to do for any other music apps like Spotify?
You can use the MPRemoteCommandCenter to detect the controls. I'm not sure if it will work with Spotify but it's definitely worth a shot.

Any way to enable user interaction while viewing fullscreen video in iOS browsers?

My research tells me that there is now way to escape fullscreen video viewing in iOS browsers on iPhone or iTouch. It also seems there there is no way to modify the native controls that are displayed along with the video. Is the user in a total blackbox while viewing video in this case?
I'm trying to find someway for a user to indicate that they like a video as it is playing. Is there anything I can do that isn't a hack? If not is there any indication from Apple that they will ever be willing to change this? I'd rather not make an app out of this project.
You actually can play a video in line on an iOS browser, if this is what you are aiming for although there are restrictions - updated answer:
Play video inline in a browser on iOS
Safari on large screen iOS (iPad) should support inline video (I don't have iPAD hand to verify this still works...).
Safari on 'small screen' iOS (i.e. iPhone) will not support inline video as standard. There is at least one workaround which will allow it but this does bypass much of the native video playback performance gains so it may not meet your needs. It is a work in progress still as you will see from the link, but try the demo on an iPhone browser - you need to hit the small play button beside the video, rather than the one on top of the video at the time of writing:
https://github.com/newshorts/InlineVideo
Playing inline in a UIWebView on iOS
Take a look at this Apple Developer page:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/index.html#//apple_ref/doc/uid/TP40006950-CH3-SW31
In particular:
allowsInlineMediaPlayback
A Boolean value that determines whether HTML5 videos play inline or use the native full-screen controller.
and:
Discussion
The default value on iPhone is NO.
In order for video to play inline, not only does this property need to be set on the view, but the video element in the HTML document must also include the webkit-playsinline attribute.

Adding airplay support to MPMoviePlayer

Hi i am building iOS application target iOS 5 and above. I am using MPMoviePlayerController to stream movie file. I that player i want to give airplay support.
According to apple documentation
Default Movie players (iOS 4.3 and later) support wireless movie
playback to AirPlay-enabled hardware such as Apple TV. The movie
player presents a control that allows the user to choose
AirPlay-enabled hardware for playback when such hardware is in range.
It seems that by default it will display airplay button in fullscreen mode if any airplay device is in range. But it is not seems to be happening. I am unable to see airplay button in movie player.
Am i missing something? Please advise.
By default, MPMoviePlayerController enables AirPlay support. If you haven't set it as FALSE. Then, probably you need to check your network or AppleTV's network connection. They need to be in same network (intranet usually).
There is a safe way to detect whether your iOS device is able to find AppleTV. You can double click HOME button, swipe task bar from left to right side, if you can see "Airplay" route button, then you can reach it. Otherwise, you need to check your AppleTV setting to make sure Airplay function is enabled and AppleTV is connected to same network that you iOS device in.
If you are using your own customized video play controller interface, you can embedded the "Airplay" button into your own UI.
MPVolumeView

how to implement a audio player interface?

I'm using AVAudioPlayer to play mp3 files, but I need to implement ui interface as shown following:
I think it maybe a iOS system control I can use, but I can't find which control it is.
That is an MPMoviePlayerController. Compare, for example this illustration from my book:
The same section of my book tells you how to make and work with one of these. Despite the name, it's great for playing audio with a user interface. The only difference between our screen shots is that you had an AirPlay device present on the network at the time.

iPad application - Mirroring the app in airplay

I've a kids application which is rich in graphics.
It don't have any videos in it. Only background audio will be there
It has some activities like counting numbers, reading alphabets etc.
Can I mirror the application in apple tv using airplay so that what ever they see on iPad app must be shown on TV also?
I googled a lot... but i couldn't find any code. But I read that its possible. Can some one guide in how to proceed with this feature?
To use AirPlay your application does not necessarily have to do anything special. AirPlay is built-into iOS, and any app or game can take advantage of it. The user simply has to double-tap the Home button, swipe to the left, press the AirPlay button and select the mirroring option. This works for all apps automatically, including video and sound.

Resources