react-native-audio-browser 0.2.0-next.79 → 0.2.0-next.80
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/ios/AVPlayerEngine.swift
CHANGED
|
@@ -236,6 +236,10 @@ final class AVPlayerEngine: PlayerEngine {
|
|
|
236
236
|
nowPlayingUpdater.receivedTimedMetadata(metadata)
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
func clearTimedMetadata() {
|
|
240
|
+
nowPlayingUpdater.clearTimedMetadata()
|
|
241
|
+
}
|
|
242
|
+
|
|
239
243
|
func updateRemoteRepeatMode(_ mode: RepeatMode) {
|
|
240
244
|
remoteCommandController.updateRepeatMode(mode)
|
|
241
245
|
}
|
package/ios/Player/Player.swift
CHANGED
|
@@ -91,6 +91,8 @@ enum EngineEvent {
|
|
|
91
91
|
/// render.
|
|
92
92
|
func nowPlayingTrackChanged()
|
|
93
93
|
func applyTimedMetadata(_ metadata: TimedMetadata)
|
|
94
|
+
/// Drops the stream's title, so the next render shows the track's own lines.
|
|
95
|
+
func clearTimedMetadata()
|
|
94
96
|
func updateRemoteRepeatMode(_ mode: RepeatMode)
|
|
95
97
|
func updateRemoteShuffleMode(_ enabled: Bool)
|
|
96
98
|
func updateSkipAvailability(canNext: Bool, canPrevious: Bool)
|
|
@@ -1624,6 +1624,57 @@ struct MediaStackEffectTests {
|
|
|
1624
1624
|
#expect(cb.timedMetadata == [metadata])
|
|
1625
1625
|
#expect(eh.appliedTimedMetadata == [metadata])
|
|
1626
1626
|
}
|
|
1627
|
+
|
|
1628
|
+
@Test @MainActor
|
|
1629
|
+
func stop_clearsTheStreamTitleBeforeRendering() throws {
|
|
1630
|
+
let (c, eh, cb) = makeTraced()
|
|
1631
|
+
try startPlaying(c, eh)
|
|
1632
|
+
cb.publishOrder.removeAll()
|
|
1633
|
+
|
|
1634
|
+
c.stop()
|
|
1635
|
+
|
|
1636
|
+
let cleared = try #require(cb.publishOrder.firstIndex(of: "clearTimedMetadata"))
|
|
1637
|
+
#expect(try cleared < #require(cb.publishOrder.firstIndex(of: "renderNowPlaying")))
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
@Test @MainActor
|
|
1641
|
+
func pause_keepsTheStreamTitle() throws {
|
|
1642
|
+
let (c, eh, cb) = makeTraced()
|
|
1643
|
+
try startPlaying(c, eh)
|
|
1644
|
+
cb.publishOrder.removeAll()
|
|
1645
|
+
|
|
1646
|
+
c.pause()
|
|
1647
|
+
|
|
1648
|
+
#expect(!cb.publishOrder.contains("clearTimedMetadata"))
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
@Test @MainActor
|
|
1652
|
+
func trackEnd_keepsTheStreamTitle() throws {
|
|
1653
|
+
let (c, eh, cb) = makeTraced()
|
|
1654
|
+
try startPlaying(c, eh)
|
|
1655
|
+
cb.publishOrder.removeAll()
|
|
1656
|
+
|
|
1657
|
+
eh.emit(.playedToEnd)
|
|
1658
|
+
|
|
1659
|
+
#expect(c.state == .ended)
|
|
1660
|
+
#expect(!cb.publishOrder.contains("clearTimedMetadata"))
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
/// The stream resends its current title after the reload; nothing may drop it as unchanged.
|
|
1664
|
+
@Test @MainActor
|
|
1665
|
+
func stopThenPlay_appliesTheSameTitleAgain() throws {
|
|
1666
|
+
let (c, eh, cb) = makeTraced()
|
|
1667
|
+
let metadata = TimedMetadata(title: "Song", artist: "Artist")
|
|
1668
|
+
try startPlaying(c, eh)
|
|
1669
|
+
eh.emit(.timedMetadata(metadata))
|
|
1670
|
+
|
|
1671
|
+
c.stop()
|
|
1672
|
+
c.play()
|
|
1673
|
+
eh.emit(.timedMetadata(metadata))
|
|
1674
|
+
|
|
1675
|
+
#expect(eh.appliedTimedMetadata == [metadata, metadata])
|
|
1676
|
+
#expect(cb.timedMetadata == [metadata, metadata])
|
|
1677
|
+
}
|
|
1627
1678
|
}
|
|
1628
1679
|
|
|
1629
1680
|
@Suite("Player - now-playing preview")
|
|
@@ -136,6 +136,10 @@ final class MockPlayerEngine: PlayerEngine {
|
|
|
136
136
|
onSeamCall?("applyTimedMetadata")
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
func clearTimedMetadata() {
|
|
140
|
+
onSeamCall?("clearTimedMetadata")
|
|
141
|
+
}
|
|
142
|
+
|
|
139
143
|
func activateAudioSession() {
|
|
140
144
|
activateAudioSessionCount += 1
|
|
141
145
|
onSeamCall?("activateAudioSession")
|