diff options
| -rw-r--r-- | docs/html/_redirects.yaml | 4 | ||||
| -rw-r--r-- | docs/html/images/android-7.0/pip-active.png (renamed from docs/html/preview/images/pip-active.png) | bin | 382631 -> 382631 bytes | |||
| -rw-r--r-- | docs/html/images/android-7.0/pip-button.png (renamed from docs/html/preview/images/pip-button.png) | bin | 3942 -> 3942 bytes | |||
| -rw-r--r-- | docs/html/training/_book.yaml | 2 | ||||
| -rw-r--r-- | docs/html/training/tv/playback/picture-in-picture.jd (renamed from docs/html/preview/features/picture-in-picture.jd) | 45 |
5 files changed, 31 insertions, 20 deletions
diff --git a/docs/html/_redirects.yaml b/docs/html/_redirects.yaml index 2b94718e3450..837b222ffb2b 100644 --- a/docs/html/_redirects.yaml +++ b/docs/html/_redirects.yaml @@ -1207,4 +1207,6 @@ redirects: - from: /preview/features/key-attestation.html to: /training/articles/security-key-attestation.html - from: /preview/features/security-config.html - to: /training/articles/security-config.html
\ No newline at end of file + to: /training/articles/security-config.html +- from: /preview/features/picture-in-picture.html + to: /training/tv/playback/picture-in-picture.html diff --git a/docs/html/preview/images/pip-active.png b/docs/html/images/android-7.0/pip-active.png Binary files differindex a24cb0368b7d..a24cb0368b7d 100644 --- a/docs/html/preview/images/pip-active.png +++ b/docs/html/images/android-7.0/pip-active.png diff --git a/docs/html/preview/images/pip-button.png b/docs/html/images/android-7.0/pip-button.png Binary files differindex b876b12605e1..b876b12605e1 100644 --- a/docs/html/preview/images/pip-button.png +++ b/docs/html/images/android-7.0/pip-button.png diff --git a/docs/html/training/_book.yaml b/docs/html/training/_book.yaml index 0e2083a9df35..6142dba6cb7d 100644 --- a/docs/html/training/_book.yaml +++ b/docs/html/training/_book.yaml @@ -695,6 +695,8 @@ toc: path: /training/tv/playback/guided-step.html - title: Enabling Background Playback path: /training/tv/playback/options.html + - title: Adding Picture-in-picture + path: /training/tv/playback/picture-in-picture.html - title: Helping Users Find Content on TV path: /training/tv/discovery/index.html path_attributes: diff --git a/docs/html/preview/features/picture-in-picture.jd b/docs/html/training/tv/playback/picture-in-picture.jd index 03a17682a0a4..e48ae48d3f4e 100644 --- a/docs/html/preview/features/picture-in-picture.jd +++ b/docs/html/training/tv/playback/picture-in-picture.jd @@ -1,11 +1,14 @@ -page.title=Picture-in-picture +page.title=Adding Picture-in-picture page.keywords=preview,sdk,PIP,Picture-in-picture page.tags=androidn +helpoutsWidget=true + +trainingnavtop=true @jd:body -<div id="qv-wrapper"> -<div id="qv"> +<div id="tb-wrapper"> +<div id="tb"> <h2>In this document</h2> <ol> @@ -31,12 +34,12 @@ Support</a></li> </div> </div> -<p>In Android N, Android TV users can now watch a video -in a pinned window in a corner of the screen when navigating within -apps. Picture-in-picture (PIP) mode lets apps run a video +<p>In Android 7.0, Android TV users can now watch a video +in a pinned window in a corner of the screen when navigating within or +between 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 multitask while using your app, which -helps users be more productive.</p> +background. The PIP window lets users multitask while using Android TV, +which helps users be more productive.</p> <p>Your app can decide when to trigger PIP mode. Here are some examples of when to enter PIP mode:</p> @@ -57,14 +60,14 @@ 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 window, by holding down the <b>Home</b> button on the remote. If another video starts playing on the main screen, the PIP window is automatically -closed. Users can also close the PIP window through Recents.</p> +closed.</p> -<img src="{@docRoot}preview/images/pip-active.png" /> +<img src="{@docRoot}images/android-7.0/pip-active.png" /> <p class="img-caption"><strong>Figure 1.</strong> A Picture-in-picture video visible in a corner of the screen while the user browses content on the main screen.</p> -<p>PIP leverages the multi-window APIs available in Android N to +<p>PIP leverages the multi-window APIs available in Android 7.0 to provide the pinned video overlay window. To add PIP to your app, you need to register your activities that support PIP, switch your activity to PIP mode as needed, and make sure UI elements are hidden and video playback continues when @@ -99,7 +102,8 @@ in the PIP window.</p> <h2 id="pip_button">Switching Your Activity to Picture-in-picture</h2> When you need to switch your activity into PIP mode, call -<code>Activity.enterPictureInPictureMode()</code>. The following example +{@link android.app.Activity#enterPictureInPictureMode +enterPictureInPictureMode()}. The following example switches to PIP mode when the user selects a dedicated PIP button on a media control bar:</p> @@ -116,12 +120,13 @@ public void onActionClicked(Action action) { <p>Adding a PIP button to your media control bar lets your user easily switch to PIP mode while controlling video playback.</p> -<img src="{@docRoot}preview/images/pip-button.png" /> +<img src="{@docRoot}images/android-7.0/pip-button.png" /> <p class="img-caption"><strong>Figure 1.</strong> A Picture-in-picture button on a media control bar.</p> -<p>Android N includes a new -<code>PlaybackControlsRow.PictureInPictureAction</code> class which defines +<p>Android 7.0 includes a +{@link android.support.v17.leanback.widget.PlaybackControlsRow.PictureInPictureAction +PlaybackControlsRow.PictureInPictureAction} class which defines control bar PIP actions and uses the PIP icon.</p> <h2 id="handling_ui">Handling UI During Picture-in-picture</h2> @@ -129,8 +134,10 @@ control bar PIP actions and uses the PIP icon.</p> <p>When your activity enters PIP mode, your activity should only show video playback. Remove UI elements before your activity enters PIP, and restore these elements when your activity becomes full-screen again. -Override <code>Activity.onPictureInPictureModeChanged()</code> or -<code>Fragment.onPictureInPictureModeChanged()</code> and enable or +Override {@link android.app.Activity#onPictureInPictureModeChanged +Activity.onPictureInPictureModeChanged()} or +{@link android.app.Fragment#onPictureInPictureModeChanged +Fragment.onPictureInPictureModeChanged()} and enable or disable your UI elements as needed, for example:</p> <pre> @@ -154,7 +161,7 @@ paused state, and calls your activity's {@link android.app.Activity#onPause onPause()} method. Video playback should not be paused and should continue playing if the activity is paused due to PIP mode.</p> -<p>In Android N, you should pause and resume video playback when the system +<p>In Android 7.0, you should pause and resume video playback when the system calls your activity's {@link android.app.Activity#onStop onStop()} and {@link android.app.Activity#onStart onStart()}. By doing this, you can avoid having to check if your app is in PIP mode in @@ -204,7 +211,7 @@ switched into or out of PIP mode as needed, set the activity's </pre> <p>In your activity, override {@link android.app.Activity#onNewIntent -Activity.onNewIntent()} and handle the new video, stopping any existing video +onNewIntent()} and handle the new video, stopping any existing video playback if needed.</p> <h2 id="best">Best Practices</h2> |