-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Describe the bug
When recovering from a Source error on Android (e.g., due to network loss) by calling player.loadPlaylist()
, playback resumes correctly, but the lock-screen / notification media controls (MediaSession metadata) do not recover. The lock-screen controller disappears.
To Reproduce
- Start playback of a stream (audio or video).
- Disable network to trigger a Source error.
- In onPlayerError, call
player.loadPlaylist([playItem])
to reload the same stream.
onPlayerError={(e) => {
console.error('[JWWrapper] Native onError event received:', e?.nativeEvent)
try {
// Attempt recovery
if (isPlayingRef.current) {
// Android cannot recover from a fatal error, reload the player
retryTimeoutRef.current = BackgroundTimer.setTimeout(() => {
console.log('[JWWrapper] Attempting playback recovery after error at ', retryCountRef.current)
retryCountRef.current += 1
playerRef.current?.loadPlaylist?.(config.playlist)
}, RETRY_TIMEOUT)
}
} catch (err) {
console.error('[JWWrapper] Error in onError handler:', err)
}
}}
- Wait for onPlayerReady and call player.play().
- Observe that playback resumes, but the lock-screen/notification controller does not update.
Expected behavior
After recovery with loadPlaylist, the JWPlayer Android SDK should rebind/update the MediaService and MediaSession, so that the lock-screen controller:
Appears again if it was dismissed, and shows the correct metadata (title, description, artwork) for the reloaded playlist item.
Screenshots / Visual evidence
If applicable, add screenshots or recordings to help explain your problem. (Required if reproduction is not 100% reliable)
Desktop (please complete the following information):
If you are having a build issue, we would like to know about your machine.
- Result of
npx react-native info
Device(s) affected
- Device: Samsung S22+
- OS: Android 14
- Version: @jwplayer/[email protected]
Additional context
We've also tried to remounting the player by changing the playerKey
when retry:
<JWPlayer
key={playerKey}
ref={ref}
style={{ flex: 1 }}
config={config}
onPlayerError={onPlayerError}
/>
It would recover the MediaSession, but will face the following error and app crashed:
android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.mediaworks.therock.beta/com.jwplayer.pub.api.background.MediaService
JWP Ticketing
To expedite resolution and maintain confidentiality, submit a JWP request in addition to this new Issue
. A JWP request offers the following benefits:
- Associates the
Issue
with your company - Permits securely share sensitive information related to the bug, request, or question
- Enhances JWP's ability to track progress and provide timely updates
- Enables you to track and manage multiple issues through a single platform
ℹ️ While Issues are valuable for open-source collaboration, a JWP request ensures that you will receive clear timelines and efficient support. |
---|