Open lemontmoon opened 1 year ago
When pressed HOME notification is showing fine while stream is playing in background.
When I install the session demo app without modification the now playing notification appears as expected:
When the Now Playing
notification is shown, then adb shell sysdump media_session
gives me this output of a session in playing state and the notification is displayed by ATV:
androidx.media3.session.id. androidx.media3.demo.session/androidx.media3.session.id. (userId=0)
ownerPid=6564, ownerUid=10076, userId=0
package=androidx.media3.demo.session
launchIntent=PendingIntent{4b346a3: PendingIntentRecord{449fa2b androidx.media3.demo.session startActivity (whitelist: db2a5c8:+30s0ms)}}
mediaButtonReceiver=MBR {pi=PendingIntent{109585d: PendingIntentRecord{ed525d2 androidx.media3.demo.session startForegroundService}}, type=3}
active=true
flags=7
rating type=0
controllers: 5
state=PlaybackState {state=3, position=54168, buffered position=127346, speed=1.0, updated=2537852, actions=7340031, custom actions=[Action:mName='Disable shuffle mode, mIcon=2131230888, mExtras=Bundle[EMPTY_PARCEL]], active item id=2, error=null}
audioAttrs=AudioAttributes: usage=USAGE_MEDIA content=CONTENT_TYPE_MUSIC flags=0x800 tags= bundle=null
volumeType=1, controlType=2, max=0, current=0
metadata: size=14, description=Voyage I - Waterfall, null, null
queueTitle=null, size=13
When PAUSE is called , notification will completely dissapear. We need functionality to keep notification card showing when stream is paused, not stopped.
It's the system that add/removes the notification when paused.
The behavior I'm seeing is that the notification is removed when the session is paused. I think this is the intended behavior. Note that the stop
button on the Now Playing notification issues a pause
command, not a stop
command. Then the notification is removed, because nothing is Now Playing
in the background anymore. Sounds consistent to me also when reading the doc:
TV apps must display a Now Playing card when playing media behind the launcher or in
the background. This card lets users return to the app that is currently playing media.
After pressing stop
, the session is in paused state and the system removes the Now playing
notification, because nothing is playing anymore. adb
output after pressing stop
on the notification:
state=PlaybackState {state=2, position=9601, buffered position=74893, speed=0.0, updated=4438663, actions=7340031, custom actions=[Action:mName='Disable shuffle mode, mIcon=2131230888, mExtras=Bundle[EMPTY_PARCEL]], active item id=2, error=null}
This seems to work as intended.
setSessionActivity is not working anymore
Yeah, there is something wrong with the PendingIntent
. However, this is rather a problem of the session demo app than the Media3 library I think. The library sets the pending launch intent
as expected with the session demo app:
androidx.media3.session.id. androidx.media3.demo.session/androidx.media3.session.id. (userId=0)
ownerPid=14510, ownerUid=10076, userId=0
package=androidx.media3.demo.session
launchIntent=PendingIntent{fc910e3: PendingIntentRecord{449fa2b androidx.media3.demo.session startActivity (whitelist: db2a5c8:+30s0ms)}}
It is also executed by the activity manager, but something is wrong with the intent:
2023-08-18 11:58:50.745 507-4153 ActivityTaskManager system_server I START u0 {cmp=androidx.media3.demo.session/.PlayerActivity} from uid 10076
2023-08-18 11:58:50.747 507-4153 ActivityTaskManager system_server W Background activity start [callingPackage: androidx.media3.demo.session; callingUid: 10076; isCallingUidForeground: false; callingUidHasAnyVisibleWindow: false; callingUidProcState: FOREGROUND_SERVICE; isCallingUidPersistentSystemProcess: false; realCallingUid: 10049; isRealCallingUidForeground: false; realCallingUidHasAnyVisibleWindow: false; realCallingUidProcState: BOUND_TOP; isRealCallingUidPersistentSystemProcess: false; originatingPendingIntent: PendingIntentRecord{449fa2b androidx.media3.demo.session startActivity (whitelist: db2a5c8:+30s0ms)}; isBgStartWhitelisted: true; intent: Intent { cmp=androidx.media3.demo.session/.PlayerActivity }; callerApp: ProcessRecord{ad76299 1272:com.google.android.tvrecommendations/u0a49}]
2023-08-18 11:58:50.748 507-4153 ActivityTaskManager system_server W startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { cmp=androidx.media3.demo.session/.PlayerActivity }
I'm not sure yet what the problem is. I need to investigate and talk with ATV folks.
From this and generally, I don't think the rejection from Play is based on a bug in the library. The service is posting notifications as expected and the Now playing
notification is displayed.
If you think it is a problem with the library, please narrow down your report a bit to what isn't working. Besides, I would say it's an app problem rather than a bug in the library.
Version
Media3 1.1.1
More version details
version 1.1.0 & 1.1.1
Devices that reproduce the issue
We have problem with Media3 MediaSession, Google always rejects the app because of :
** repeated rejection from GOOGLE ***
During review, we detected the following eligibility issues and were unable to accept your app for Android TV:
Your app does not display a “Now Playing” notification card. If an app continues to play sound/video after the user has returned to the home screen or switched to another app, the app must provide a “Now Playing” card on the home screen recommendation row so users can return to the app to control playback. For example, in your app (version code 185) the “Now Playing” notification card does not function as expected, disappearing when pressing pause. You can refer to the Displaying a Now Playing Card page for additional guidance on this requirement.
** repeated rejection from GOOGLE ***
We need functionality to keep notification card showing when stream is paused, not stopped.
Also setSessionActivity is not working anymore, it only works when you keep it null. We was trying to find some solution , but no luck.
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
No
Reproduction steps
Play any stream with Media3 and MediaSession implemented on Android TV or Android TV box. When pressed HOME notification is showing fine while stream is playing in background.
When PAUSE is called , notification will completely dissapear.
Cannot OPTIN to Android TV because of that issue.
Expected result
Should show MediaSession notification on Android TV when playback is paused or add option to allow it.
Actual result
MediaSession notification on Android TV automatically dissapear when stream is PAUSED
Media
no media to reproduce,, you can use any media
Bug Report
adb bugreport
to android-media-github@google.com after filing this issue.