summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Daniel Yu <dsyu@google.com> 2016-06-22 09:49:34 -0700
committer Daniel Yu <dsyu@google.com> 2016-06-22 10:07:32 -0700
commit83b25f7c46099c3fcc7007b3914ed08e879751ca (patch)
tree4c58d125a7dab6b61c0e6afa4ffbd620c0f4f5bf
parentb47e5dc798c836311dec4de20ace7cbcf70a8c68 (diff)
docs: Fixing MediaSession note in PIP preview docs
Updating PIP preview docs to mention that devs need to use MediaSession.setCallback to get input events while in PIP mode, and not MediaSession.setMediaButtonReceiver. Note: Changes also include changes made previously for DP4 in a different branch that for some reason were not auto-merged into mnc-io-docs, so including these changes as well to ensure they don't get overwritten. Bug: 29215189 Change-Id: Iab51c26ebd1f1403633eb9a1616d43690173446c
-rw-r--r--docs/html/preview/features/picture-in-picture.jd36
1 files changed, 29 insertions, 7 deletions
diff --git a/docs/html/preview/features/picture-in-picture.jd b/docs/html/preview/features/picture-in-picture.jd
index 893f8c1ca568..03a17682a0a4 100644
--- a/docs/html/preview/features/picture-in-picture.jd
+++ b/docs/html/preview/features/picture-in-picture.jd
@@ -150,11 +150,20 @@ public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
Picture-in-picture</h2>
<p>When your activity switches to PIP, the system considers the activity in a
-paused state, and calls your activity's <code>onPause()</code> method. Video
-playback should not be paused and should continue playing if the activity is
-paused due to PIP mode. Check for PIP in your activity's
-<code>onPause()</code> method and handle playback appropriately, for
-example:</p>
+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
+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
+{@link android.app.Activity#onPause onPause()} and explicitly
+continuing playback.</p>
+
+<p>If you have to pause playback in your {@link android.app.Activity#onPause
+onPause()} implementation, check for PIP mode by calling {@code
+isInPictureInPictureMode()} and handle playback appropriately, for example:</p>
<pre>
&#64;Override
@@ -170,7 +179,8 @@ public void onPause() {
</pre>
<p>When your activity switches out of PIP mode back to full-screen mode, the
-system resumes your activity and calls your <code>onResume()</code> method.</p>
+system resumes your activity and calls your
+{@link android.app.Activity#onResume onResume()} method.</p>
<h2 id="single_playback">Using a Single Playback Activity for
Picture-in-picture</h2>
@@ -210,4 +220,16 @@ in any area that can be obscured by the PIP window.</p>
<p>When an activity is in PIP mode, by default it doesn't get input focus. To
receive input events while in PIP mode, use
-<code>MediaSession.setMediaButtonReceiver()</code>.</p>
+{@link android.media.session.MediaSession#setCallback
+MediaSession.setCallback()}. For more information on using
+{@link android.media.session.MediaSession#setCallback setCallback()} see
+<a href="{@docRoot}training/tv/playback/now-playing.html">Displaying
+a Now Playing Card</a>.</p>
+
+<p>When your app is in PIP mode, video playback in the PIP window can cause
+audio interference with another app, such as a music player app or voice search
+app. To avoid this, request audio focus when you start playing the video,
+and handle audio focus change notifications, as described in
+<a href="{@docRoot}training/managing-audio/audio-focus.html">Managing Audio
+Focus</a>. If you receive notification of audio focus loss when in PIP mode,
+pause or stop video playback.</p>