diff --git a/docs/html/preview/features/picture-in-picture.jd b/docs/html/preview/features/picture-in-picture.jd index 9a96de2a195fd..b5a07626dee56 100644 --- a/docs/html/preview/features/picture-in-picture.jd +++ b/docs/html/preview/features/picture-in-picture.jd @@ -6,48 +6,61 @@ page.tags=androidn
In the Android N Developer Preview, Android TV users can now watch a video in a pinned window in a corner of the screen when navigating within -applications. This new Picture-in-picture (PIP) mode lets apps run a video +apps. Picture-in-picture (PIP) mode lets apps run a video activity in the pinned window while another activity continues in the -background. The PIP window lets users multi-task while using your app, making -browsing and exploring your app easier and more engaging.
+background. The PIP window lets users multitask while using your app, which +helps users be more productive. -Your app can decide when to trigger PIP mode. Here are some examples on +
Your app can decide when to trigger PIP mode. Here are some examples of when to enter PIP mode:
The PIP window is 240 x 135 dp and is shown at the top-most layer in one of +
The PIP window is 240x135 dp and is shown at the top-most layer in one of the four corners of the screen, chosen by the system. The user can bring up a -PIP menu that lets them toggle the PIP window to full screen, or close the PIP +PIP menu that lets them toggle the PIP window to full-screen, or close the PIP window, by holding down the Home button on the remote. If another -video starts playing on the main screen, or the user leaves the app, the PIP -window is automatically closed.
+video starts playing on the main screen, the PIP window is automatically +closed. Users can also close the PIP window through Recents. + +
+Figure 1. A Picture-in-picture +video visible in a corner of the screen while the user browses content +on the main screen.
PIP leverages the multi-window APIs available in the N Developer Preview to provide the pinned video overlay window. To add PIP to your app, you need to @@ -57,13 +70,13 @@ the activity is in PIP mode.
By default, the system will not automatically support PIP for applications. -If you want support PIP in your application, you need to register your video +
By default, the system does not automatically support PIP for apps.
+If you want support PIP in your app, register your video
activity in your manifest by setting
android:supportsPictureInPicture and
android:resizeableActivity to true. Also, specify
that your activity handles layout configuration changes so that your activity
-won't relaunch when layout changes occur during PIP mode transitions.
<activity android:name="VideoActivity" @@ -76,9 +89,10 @@ won't relaunch when layout changes occur during PIP mode transitions.-When registering your activity, keep in mind that in PIP mode, your activity is shown in a small overlay window on a TV screen. Video playback -activities with minimal UI provide the best user experience. Non-video -activities with detailed UI may not provide a good user experience in PIP -mode.
+activities with minimal UI provide the best user experience. Activities that +contain small UI elements might not provide a good user experience +when switched to PIP mode, because users can't see details of the UI elements +in the PIP window.Switching Your Activity to Picture-in-picture
@@ -104,13 +118,14 @@ to PIP mode while controlling video playback.Figure 1. A Picture-in-picture button on a media control bar.
-A new
+PlaybackControlsRow.PictureInPictureActionclass is -provided to use the PIP icon and handle control bar PIP actions.The N Developer Preview includes a new +
PlaybackControlsRow.PictureInPictureActionclass which defines +control bar PIP actions and uses the PIP icon.Handling UI During Picture-in-picture
When your activity enters PIP mode, your activity should only show video -playback. You should remove UI elements before your activity enters PIP, +playback. Remove UI elements before your activity enters PIP, and restore these elements when your activity becomes full-screen again. Override
Activity.onPictureInPictureChanged()orFragment.onPictureInPictureChanged()and enable or @@ -152,7 +167,7 @@ public void onPause() { }
When your activity switches out of PIP mode back to full screen mode, the +
When your activity switches out of PIP mode back to full-screen mode, the
system resumes your activity and calls your onResume() method.
onResume() method.
PIP is intended for activities that play full-screen video. When switching your activity into PIP mode, avoid showing anything except video content. Track when your activity enters PIP mode and hide UI elements, as described -in Handling UI During Picture-in-picture Mode.
+in Handling UI During Picture-in-picture.Since the PIP window is shown as a floating window in the corner of the screen, you should avoid showing critical information in the main screen @@ -169,7 +184,3 @@ in any area that can be obscured by the PIP window.
When an activity is in PIP mode, by default it doesn't get input focus. To
receive input events while in PIP mode, use
MediaSession.setMediaButtonReceiver().
For more information on multi-window APIs, see -Android N -Developer Preview Multi-Window Support.
diff --git a/docs/html/preview/images/pip-active.png b/docs/html/preview/images/pip-active.png index 1e4bb634553ae..dead7669bc0e8 100644 Binary files a/docs/html/preview/images/pip-active.png and b/docs/html/preview/images/pip-active.png differ