@javascriptcommon/react-native-track-player 4.1.25 → 4.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/doublesymmetry/trackplayer/model/Track.kt +1 -1
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/models/AudioItem.kt +2 -3
- package/android/src/main/java/com/lovegaoshi/kotlinaudio/player/AudioPlayer.kt +4 -0
- package/package.json +1 -1
- package/android/src/main/res/raw/silent_5_seconds.mp3 +0 -0
|
@@ -62,7 +62,7 @@ class Track
|
|
|
62
62
|
headers!![header] = httpHeaders.getString(header)!!
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
notPlayable = bundle.getBoolean("notPlayable", false)
|
|
65
|
+
notPlayable = bundle.getBoolean("notPlayable", false)
|
|
66
66
|
setMetadata(context, bundle, ratingType)
|
|
67
67
|
queueId = System.currentTimeMillis()
|
|
68
68
|
originalItem = bundle
|
|
@@ -8,8 +8,6 @@ import androidx.media3.common.MediaItem
|
|
|
8
8
|
import androidx.media3.common.MediaMetadata
|
|
9
9
|
import com.lovegaoshi.kotlinaudio.utils.getEmbeddedBitmapArray
|
|
10
10
|
import com.lovegaoshi.kotlinaudio.utils.saveMediaCoverToPng
|
|
11
|
-
import androidx.media3.datasource.RawResourceDataSource
|
|
12
|
-
import com.doublesymmetry.trackplayer.R
|
|
13
11
|
import java.util.UUID
|
|
14
12
|
|
|
15
13
|
|
|
@@ -85,7 +83,8 @@ fun audioItem2MediaItem(audioItem: AudioItem, context: Context? = null): MediaIt
|
|
|
85
83
|
|
|
86
84
|
return MediaItem.Builder()
|
|
87
85
|
.setMediaId(audioItem.mediaId ?: UUID.randomUUID().toString())
|
|
88
|
-
|
|
86
|
+
// Always set URI (even empty string) so ExoPlayer adds item to timeline
|
|
87
|
+
.setUri(audioItem.audioUrl)
|
|
89
88
|
.setMediaMetadata(
|
|
90
89
|
MediaMetadata.Builder()
|
|
91
90
|
.setTitle(audioItem.title)
|
|
@@ -234,6 +234,10 @@ abstract class AudioPlayer internal constructor(
|
|
|
234
234
|
.setContentType(options.audioContentType)
|
|
235
235
|
.build()
|
|
236
236
|
mPlayer.setAudioAttributes(audioAttributes, options.handleAudioFocus)
|
|
237
|
+
// Prevent ExoPlayer from auto-advancing to the next queue item when a track ends.
|
|
238
|
+
// All track transitions are handled by the JS side via playNext() -> load().
|
|
239
|
+
// This avoids ExoPlayer trying to load queue items that don't have a URL yet.
|
|
240
|
+
mPlayer.pauseAtEndOfMediaItems = true
|
|
237
241
|
nameHolder[0] = mPlayer.toString()
|
|
238
242
|
// https://github.com/androidx/media/issues/2319
|
|
239
243
|
mPlayer.addAnalyticsListener(AudioFxInitListener())
|
package/package.json
CHANGED
|
Binary file
|