Original source: @ Iron Man-like Qing Brothers Welcome to share the original to Bole headlines
This document contains:
Part I:iOS 9 Split-screen multitasking – Getting Started
Part II: iOS9 Split-screen multitasking –slide over & split View Quick Start
Part III: iOS9 Split-screen multitasking – pip ) Quick Start
Use PIP on the supported ipad based on the guidelines in this chapter.
To have video playback support PIP mode, make sure your Xcode project and app are configured as follows:
- Set BASESDK to "Latest IOS", refer to the Setting the Base SDK section of the APP distribution guide.
- Check the target of the project in capabilities, and select background modes's audio and airplay. (for future Xcode updates, this option is named audio, airplay, and picture.).
- Make sure that your application's audio session takes the appropriate category, such as Avaudiosessioncategoryplayback.
Next, select the appropriate avkit, AV Foundation, or WebKit class service video playback for the video playback. The choice depends on the characteristics of the application and the user experience you want to provide.
- The Avkit framework provides the Avplayerviewcontroller class, which automatically displays picture-in-picture buttons for users.
If you use Avkit to support the PIP feature, but to exit a specific PIP video, set the player View controller's Allowspictureinpictureplayback property to No.
- Avkit also provides the Avpictureinpicturecontroller class, which can be used with the Avplayerlayer class of the AV Foundation framework. Use this method if you want to provide your own view controller and custom user interface for video playback.
- If you support Pip this way, but to exit a specific video pip feature, do not associate the Avplayerlayer of the video with the Avpictureinpicturecontroller object. As long as you use the playback layer to instantiate a picture-in-picture controller, this playing video layer has the function of picture-in picture, the option to opt out does not perform the instantiation.
The WebKit framework provides the Wkwebview class, which supports the PIP feature of iOS 9.
If you use WebKit to support the PIP feature, but you want to exit a picture-in-picture of a particular video. Set the Allowspictureinpicturemediaplayback property of the associated Web view instance to No. (This property is available in the next beta version of 9 in iOS)
If you have an old app that uses deprecated Mpmovieplayerviewcontroller or MPMoviePlayerController to play a video, you must use the Advanced iOS video playback framework to support PIP.
Important: Apple wants to keep the PIP function in the user's control, only the user explicitly requests the PIP function to respond. In particular, when you fall back to the background, you can't immediately respond to user-evoked PIP functionality, and apps will be rejected by the App Store.
When the user presses the home button or triggers a notification to bring them into the other app, IOS 9 automatically transfers a full-screen video to PIP. The requirements for using this feature for video playback are as follows:
- Let the app support the PIP feature as described earlier in this chapter.
- Use the view's view to fill the bounds of the window to play the video in full screen.
Tip: Users can draw auto-evoke in disable PIP, by setting settings > General > Multitasking > Persistent Video Overlay. If you think everything is set up, but when you press the home button and find your video does not enter Pip, check this setting.
When the app plays a video that goes to pip playback, the system manages the rendering of the video content, and your app continues to run in the background. When your application runs in the background, be sure to discard unwanted resources such as view controllers, views, images, and data caches. In this case, you expect to perform appropriate and necessary actions, such as video compositing, audio processing, downloading the content to be played next, but you must be careful to consume as little resources as possible. If your application consumes too many resources in the background, the system terminates it.
All say the programmer's high wages, but very little understanding of their overtime pain, you are not every time in the mind, according to the time to reduce the wages are less, so will want to cry in the heart, or raise wages, or raise wages, or raise wages, why?? Because don't let us work overtime, this is impossible!!!
Want to subvert your work model? Want to reduce your overtime? Join us and explore the free mode of our programmers!
A native app for programmers to share knowledge and skills as a reward for online interactive interactive platform.
We have a top technical team of nearly 20 people, as well as excellent product and operations teams. Team leaders have more than 10 years of experience in the industry.
Now that we are recruiting the original heroes, you will be working with us to change the way programmers work and change the world of programmers! There will also be generous rewards. As our original participant, you will experience this programmer artifact with us, you can offer professional advice, we will adopt it humbly. Everyone will be a hero, and you will be the hero we need! You can also invite your friends to participate in this heroic recruiting interaction.
We will not delay you too much time, we only need your professional opinion, as long as you take 1 hours from one months, you can save two hours a day, everything is for our own!
To? Or not?
Connector Person code: 1955246408 (QQ)
IOS 9 Split-screen multitasking (3): Pip Quick Start