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

Notification disappears on Android for HLS tracks #2356

Open
watadarkstar opened this issue Aug 19, 2024 · 1 comment
Open

Notification disappears on Android for HLS tracks #2356

watadarkstar opened this issue Aug 19, 2024 · 1 comment
Labels

Comments

@watadarkstar
Copy link

watadarkstar commented Aug 19, 2024

Describe the Bug
When I play something the media notification will show up but then it quickly gets removed.

Steps To Reproduce
Play audio/video with the following code
And make sure to add an HLS track

Code To Reproduce

await TrackPlayer.setupPlayer({
        // Important:  CarPlay works with IOSCategory.Playback.
        iosCategory: IOSCategory.Playback,
        // We must set this to the empty array, otherwise the player will
        // only play audio in airplane mode. AND it breaks lock screen controls if its not
        // the empty array.
        // https://react-native-track-player.js.org/docs/api/constants/ios-category-options#allowairplay
        iosCategoryOptions: [],
        // We must set this to SpokenAudio for lock screen controls to work with
        // IOSCategory.Playback.
        iosCategoryMode: IOSCategoryMode.SpokenAudio,
      })
      // We mute the track player because the video player will be the one
      // playing the audio. This is to prevent the audio from playing twice.
      await TrackPlayer.setVolume(0)
...
await TrackPlayer.updateOptions({
        android: {
          appKilledPlaybackBehavior:
            AppKilledPlaybackBehavior.StopPlaybackAndRemoveNotification,
        },
        // stoppingAppPausesPlayback is deprecated but we still use it just in
        // case it's needed.
        stoppingAppPausesPlayback: true,
        capabilities: [
          Capability.Play,
          Capability.Stop,
          Capability.Pause,
          Capability.JumpBackward,
          Capability.JumpForward,
          Capability.SeekTo,
        ],
        compactCapabilities: [
          Capability.Play,
          Capability.Pause,
          Capability.JumpForward,
          Capability.JumpBackward,
          Capability.SeekTo,
          Capability.Stop,
        ],
        progressUpdateEventInterval: 1,
      })

Replicable on Example App?
Can you replicate this bug in the React Native Track Player Example App?

Environment Info:

info Fetching system and libraries information...
System:
  OS: macOS 14.4
  CPU: (8) arm64 Apple M1
  Memory: 100.73 MB / 16.00 GB
  Shell:
    version: 3.2.2
    path: /usr/local/bin/fish
Binaries:
  Node:
    version: 18.16.0
    path: ~/.nvm/versions/node/v18.16.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v18.16.0/bin/yarn
  npm:
    version: 9.5.1
    path: ~/.nvm/versions/node/v18.16.0/bin/npm
  Watchman:
    version: 2024.03.18.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "29"
      - "30"
      - "33"
      - "34"
    Build Tools:
      - 29.0.2
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-29 | Intel x86 Atom
      - android-29 | Intel x86 Atom_64
      - android-30 | Google APIs Intel x86 Atom
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.10
    wanted: 0.72.10
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

I tried both 4.1.1 and 4.0.1

    "react-native-track-player": "4.1.1",

Real device? Android Samsung Tab S6 Lite

What OS are you running? Android 14

How I can Help

Android adb logs:

08-19 14:09:10.012  5019  5019 I NotificationManager: com.subsplash.thechurchapp.ligonier: notify(1, null, Notification(channel=kotlin_audio_player shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0xa color=0x00000000 category=transport actions=1 vis=PUBLIC semFlags=0x0 semPriority=0 semMissedCount=0)) as user
08-19 14:09:10.036  4899  4899 I HoneySpace.NotificationListener: onNotificationPosted com.subsplash.thechurchapp.ligonier: 0|com.subsplash.thechurchapp.ligonier|1|null|10359: 0
08-19 14:09:10.036  4899  4899 I HoneySpace.NotificationListener: invalid notification: com.subsplash.thechurchapp.ligonier UserHandle{0}: canShowBadge is false
08-19 14:09:10.092  4647  4647 D FaceWidgetNotificationControllerWrapper: onMediaDataLoaded, 0|com.subsplash.thechurchapp.ligonier|1|null|10359, 0|com.subsplash.thechurchapp.ligonier|1|null|10359,  [ USERID : 0 ] [ INITIALIZED : true ] [ APP : Ligonier ] [ ARTIST : R.C. Sproul ] [ SONG : The Importance of Holiness ] [ ACTIONS : Connecting,  ] [ ACTIONSTOSHOWINCOMPACT : [0] ] [ PACKAGENAME : com.subsplash.thechurchapp.ligonier ] [ DEVICE : This tablet ] [ SECMEDIADEVICEDATA : 1 ] [ ACTIVE : true ] [ PLAYBACKLOCATION : 0 ] [ RESUMPTION : false ] [ NOTIFICATIONKEY : 0|com.subsplash.thechurchapp.ligonier|1|null|10359 ] [ HASCHECKFORRESUME : false ] [ ISPLAYING : false ] [ ISCLEARABLE : false ] [ LASTACTIVE : 1970-01-04 07:13:46.778 ] [ INSTANCEID : 441650 ] [ APPUID : 10359 ] [ CUSTOMMEDIADATA : -1 ]
08-19 14:09:10.094  4647  4647 I AODNotificationManager: updateNotification()
08-19 14:09:10.115  4899  4899 I HoneySpace.NotificationListener: onNotificationPosted com.subsplash.thechurchapp.ligonier: 0|com.subsplash.thechurchapp.ligonier|1|null|10359: 0
08-19 14:09:10.115  4899  4899 I HoneySpace.NotificationListener: invalid notification: com.subsplash.thechurchapp.ligonier UserHandle{0}: canShowBadge is false
08-19 14:09:10.183  4647  4647 I AODNotificationManager: updateNotification()
08-19 14:09:10.184  5019  5019 I NotificationManager: com.subsplash.thechurchapp.ligonier: notify(1, null, Notification(channel=kotlin_audio_player shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x8 color=0x00000000 category=transport actions=1 vis=PUBLIC semFlags=0x0 semPriority=0 semMissedCount=0)) as user
08-19 14:09:10.245  5019  5019 I NotificationManager: com.subsplash.thechurchapp.ligonier: notify(1, null, Notification(channel=kotlin_audio_player shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x8 color=0x00000000 category=transport actions=1 vis=PUBLIC semFlags=0x0 semPriority=0 semMissedCount=0)) as user
08-19 14:09:10.324  1792  1792 W Looper  : Slow dispatch took 128ms main h=com.android.server.notification.NotificationManagerService$WorkerHandler c=com.android.server.notification.NotificationManagerService$PostNotificationRunnable@d433d7c m=0
08-19 14:09:10.332  4899  4899 I HoneySpace.NotificationListener: onNotificationPosted com.subsplash.thechurchapp.ligonier: 0|com.subsplash.thechurchapp.ligonier|1|null|10359: 0
08-19 14:09:10.332  4899  4899 I HoneySpace.NotificationListener: invalid notification: com.subsplash.thechurchapp.ligonier UserHandle{0}: canShowBadge is false
08-19 14:09:10.368  4899  4899 I HoneySpace.NotificationListener: onNotificationPosted com.subsplash.thechurchapp.ligonier: 0|com.subsplash.thechurchapp.ligonier|1|null|10359: 0
08-19 14:09:10.368  4899  4899 I HoneySpace.NotificationListener: invalid notification: com.subsplash.thechurchapp.ligonier UserHandle{0}: canShowBadge is false
08-19 14:09:10.376  4647  4647 D FaceWidgetNotificationControllerWrapper: onMediaDataLoaded, 0|com.subsplash.thechurchapp.ligonier|1|null|10359, 0|com.subsplash.thechurchapp.ligonier|1|null|10359,  [ USERID : 0 ] [ INITIALIZED : true ] [ APP : Ligonier ] [ ARTIST : R.C. Sproul ] [ SONG : The Importance of Holiness ] [ ACTIONS : Play,  ] [ ACTIONSTOSHOWINCOMPACT : [0] ] [ PACKAGENAME : com.subsplash.thechurchapp.ligonier ] [ DEVICE : This tablet ] [ SECMEDIADEVICEDATA : 1 ] [ ACTIVE : true ] [ PLAYBACKLOCATION : 0 ] [ RESUMPTION : false ] [ NOTIFICATIONKEY : 0|com.subsplash.thechurchapp.ligonier|1|null|10359 ] [ HASCHECKFORRESUME : false ] [ ISPLAYING : false ] [ ISCLEARABLE : false ] [ LASTACTIVE : 1970-01-04 07:13:47.058 ] [ INSTANCEID : 441650 ] [ APPUID : 10359 ] [ CUSTOMMEDIADATA : -1 ]
08-19 14:09:10.430  4647  4647 I AODNotificationManager: updateNotification()
08-19 14:09:10.450  4647  4647 D FaceWidgetNotificationControllerWrapper: onMediaDataLoaded, 0|com.subsplash.thechurchapp.ligonier|1|null|10359, 0|com.subsplash.thechurchapp.ligonier|1|null|10359,  [ USERID : 0 ] [ INITIALIZED : true ] [ APP : Ligonier ] [ ARTIST : R.C. Sproul ] [ SONG : The Importance of Holiness ] [ ACTIONS : Play,  ] [ ACTIONSTOSHOWINCOMPACT : [0] ] [ PACKAGENAME : com.subsplash.thechurchapp.ligonier ] [ DEVICE : This tablet ] [ SECMEDIADEVICEDATA : 1 ] [ ACTIVE : true ] [ PLAYBACKLOCATION : 0 ] [ RESUMPTION : false ] [ NOTIFICATIONKEY : 0|com.subsplash.thechurchapp.ligonier|1|null|10359 ] [ HASCHECKFORRESUME : false ] [ ISPLAYING : false ] [ ISCLEARABLE : true ] [ LASTACTIVE : 1970-01-04 07:13:47.166 ] [ INSTANCEID : 441650 ] [ APPUID : 10359 ] [ CUSTOMMEDIADATA : -1 ]
08-19 14:09:10.465  4647  4647 D FaceWidgetNotificationControllerWrapper: onMediaDataLoaded, 0|com.subsplash.thechurchapp.ligonier|1|null|10359, 0|com.subsplash.thechurchapp.ligonier|1|null|10359,  [ USERID : 0 ] [ INITIALIZED : true ] [ APP : Ligonier ] [ ARTIST : R.C. Sproul ] [ SONG : The Importance of Holiness ] [ ACTIONS : Play,  ] [ ACTIONSTOSHOWINCOMPACT : [0] ] [ PACKAGENAME : com.subsplash.thechurchapp.ligonier ] [ DEVICE : This tablet ] [ SECMEDIADEVICEDATA : 1 ] [ ACTIVE : true ] [ PLAYBACKLOCATION : 0 ] [ RESUMPTION : false ] [ NOTIFICATIONKEY : 0|com.subsplash.thechurchapp.ligonier|1|null|10359 ] [ HASCHECKFORRESUME : false ] [ ISPLAYING : false ] [ ISCLEARABLE : true ] [ LASTACTIVE : 1970-01-04 07:13:47.169 ] [ INSTANCEID : 441650 ] [ APPUID : 10359 ] [ CUSTOMMEDIADATA : -1 ]
08-19 14:09:13.054  5019  5019 D MusicService$setupForegrounding: Notification has been stopped
08-19 14:09:13.055  1792  1792 D EdgeLightingManager: hideForNotification : packageName = com.subsplash.thechurchapp.ligonier
08-19 14:09:13.056  1792  1792 D EdgeLightingPolicyManager:NotificationGroup: remove : sbn : StatusBarNotification(pkg=com.subsplash.thechurchapp.ligonier user=UserHandle{0} id=1 tag=null key=0|com.subsplash.thechurchapp.ligonier|1|null|10359: Notification(channel=kotlin_audio_player shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x68 color=0x00000000 category=transport actions=1 vis=PUBLIC semFlags=0x0 semPriority=0 semMissedCount=0))
08-19 14:09:13.056  1792  1792 D EdgeLightingPolicyManager.NotificationGroup: group notification count : 0
08-19 14:09:13.056  1792  1792 D EdgeLightingManager: hideForNotification : isOngoing is false
08-19 14:09:13.058  1792  1792 D NotificationService: CancelNotificationRunnable end r = 0|com.subsplash.thechurchapp.ligonier|1|null|10359, reason = 8
08-19 14:09:13.060  1792  1792 D NotificationReminder: removeFromNotificationList record com.subsplash.thechurchapp.ligonier
08-19 14:09:13.065  4899  4899 I HoneySpace.NotificationListener: onNotificationRemoved com.subsplash.thechurchapp.ligonier: 0|com.subsplash.thechurchapp.ligonier|1|null|10359: 0
08-19 14:09:13.075  4647  4647 D FaceWidgetNotificationControllerWrapper: onMediaDataRemoved, 0|com.subsplash.thechurchapp.ligonier|1|null|10359
08-19 14:09:13.100  4647  4647 D FaceWidgetNotificationManager: updateFaceWidgetMusicNotificationPkg() pkgName = null
08-19 14:09:13.100  4647  4647 D FaceWidgetNotificationManager: updateFaceWidgetMusicNotificationKey() return : mFaceWidgetMusicNotificationKey is empty
08-19 14:09:13.102  4647  4647 I AODNotificationManager: updateNotification()
08-19 14:09:13.261  5019  5019 D MusicService$setupForegrounding: Notification has been stopped
08-19 14:09:13.361  5019  5019 D MusicService$setupForegrounding: Notification has been stopped
@watadarkstar watadarkstar changed the title Notification disappears on Android Notification disappears on Android for HLS tracks Aug 19, 2024
@yemreeke
Copy link

yemreeke commented Oct 2, 2024

same issue
MusicService$setupForegrounding: Notification has been stopped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants