Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ongoing Media Notification for Wear not working with certain media #29

Closed
yschimke opened this issue Jan 13, 2022 · 10 comments
Closed

Ongoing Media Notification for Wear not working with certain media #29

yschimke opened this issue Jan 13, 2022 · 10 comments
Assignees
Labels

Comments

@yschimke
Copy link
Contributor

yschimke commented Jan 13, 2022

Test is here testPlayCausesNotification.
yschimke@637b487

The test doesn't fail, the notification check succeeds, but the two media items in the test behave differently.

Podcast MP3 - Shows the ongoing notification and (with a real app not a test) the Media title in the recent app switcher.

    val milkJawn = Channel(
            "a",
            "Milk Jawn's ice cream pop-up to become a brick-and-mortar",
            "What's Cooking",
            "https://traffic.omny.fm/d/clips/4b5f9d6d-9214-48cb-8455-a73200038129/a76af74b-4211-43f1-8fa6-a78e00b5ae4b/acffa77d-5b31-499e-b38b-adf800e1778b/audio.mp3",
            "https://cdn.player.fm/images/14416069/series/stoRUvKcFOzInZ1X/512.jpg",
    )

image

Radio Stream - Doesn't show notification (or media title in app switcher)

    val BBCRadio1 = Channel(
            "1",
            "Radio 1",
            "BBC",
            "https://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/nonuk/sbr_vlow/ak/bbc_radio_one.m3u8",
            "https://sounds.files.bbci.co.uk/2.3.0/networks/bbc_radio_one/colour_default.svg",
    )

image

Can reproduce on Devices (Samsung GW4, Suunto7) and Emulator (API 30).

Androidx Media3 - 1.0.0-alpha01
API 30 Emulator

@yschimke
Copy link
Contributor Author

These examples are just a reproduction - I've been having consistent issues for months with this behaviour for different media apps (not open source). The podcast player app works reliably, but the radio streaming app and the music app don't work.

I have been assuming that it's something I've configured wrong/differently in these apps, but when I tried switching the media to test something else it started working. Hence this reproduction which only changes the media url.

The Radio Stream (not working) is MediaSource: androidx.media3.exoplayer.hls.HlsMediaSource
The podcast (working) is MediaSource: androidx.media3.exoplayer.source.ProgressiveMediaSource

@yschimke yschimke changed the title Ongoing Media Notifiaction for Wear not working with certain media Ongoing Media Notification for Wear not working with certain media Jan 13, 2022
@marcbaechinger marcbaechinger self-assigned this Jan 13, 2022
@yschimke
Copy link
Contributor Author

Some debug with adb shell dumpsys media_session | grep "Sessions Stack" -A 30

Not Working

  Sessions Stack - have 1 sessions:
    androidx.media3.session.id. androidx.media3.demo.session/androidx.media3.session.id. (userId=0)
      ownerPid=8552, ownerUid=10082, userId=0
      package=androidx.media3.demo.session
      launchIntent=PendingIntent{4481492: PendingIntentRecord{e5230bf androidx.media3.demo.session startActivity (whitelist: f5c389e:+30s0ms)}}
      mediaButtonReceiver=MBR {pi=PendingIntent{6dc02f4: PendingIntentRecord{14bca1d androidx.media3.demo.session startForegroundService}}, type=3}
      active=true
      flags=7
      rating type=0
      controllers: 2
      state=PlaybackState {state=3, position=17667, buffered position=32000, speed=1.0, updated=64128384, actions=3670015, custom actions=[], active item id=0, 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=8, description=Radio 1, null, null
      queueTitle=null, size=1
Audio playback (lastly played comes first)
  uid=10082 packages=androidx.media3.demo.session 

Working

  Sessions Stack - have 1 sessions:
    androidx.media3.session.id. androidx.media3.demo.session/androidx.media3.session.id. (userId=0)
      ownerPid=8829, ownerUid=10082, userId=0
      package=androidx.media3.demo.session
      launchIntent=PendingIntent{17bf75f: PendingIntentRecord{e5230bf androidx.media3.demo.session startActivity (whitelist: f5c389e:+30s0ms)}}
      mediaButtonReceiver=MBR {pi=PendingIntent{55493b9: PendingIntentRecord{41b73fe androidx.media3.demo.session startForegroundService}}, type=3}
      active=true
      flags=7
      rating type=0
      controllers: 3
      state=PlaybackState {state=3, position=0, buffered position=9168, speed=1.0, updated=64186990, actions=3670015, custom actions=[], active item id=0, 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=8, description=Milk Jawn's ice cream pop-up to become a brick-and-mortar, null, null
      queueTitle=null, size=1
Audio playback (lastly played comes first)
  uid=10082 packages=androidx.media3.demo.session 

@yschimke
Copy link
Contributor Author

I'm also talking with someone on the Wear as it could definitely be on the side handling the notification.

@marcbaechinger
Copy link
Contributor

Sorry but I don't understand what you are trying to achieve and what the expected behaviour is.

What component of AndroidX Media3 are you using? What is the observed behaviour of this component and what is what you would expect.

I understand you want to make a notification being shown on Wear OS and this seems not to work. Are you using the session demo app for this as is?

Can you please make you issue actionable by giving me some reproduction steps that I could follow to look into the problem you are describing?

@yschimke
Copy link
Contributor Author

yschimke commented Jan 13, 2022

The reproduction is in the linked commit yschimke@637b487 or https://github.com/yschimke/media/tree/wear

Test is here testPlayCausesNotification.

There is a test you can run against a wear emulator, it uses the session demo. The test doesn't fail but you can visually see the difference in the ongoing notification from the screenshots I included.

I'm using Media3 ExoPlayer in a service, and connecting to it via Media3 MediaBrowser. I'd like Media Notification to work reliably, but I'm seeing different behaviour for different streams as described above.

Let me know what else I can do to make it actionable, I tried to get it to the point that you can reproduce within the sample apps you provided. What else would help here?

@yschimke
Copy link
Contributor Author

The two has the two streams you can switch between.

//                        milkJawn.toMediaItem(),
                        BBCRadio1.toMediaItem(),

That wasn't clear.

@google-oss-bot

This comment has been minimized.

@yschimke
Copy link
Contributor Author

@marcbaechinger I think Media3 alpha02 has fixed this, but I haven't confirmed 100%. I'll try to get it to fail again, but so far it looks good.

@yschimke
Copy link
Contributor Author

I've also observed that the notification isn't cleared once the playback finishes normally, I'll take a look and file a separate bug if I can confirm that.

@yschimke
Copy link
Contributor Author

Closing this as I haven't reproduced since alpha02

@androidx androidx locked and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants