Skip to content

Commit

Permalink
Merge pull request #811 from cmenkemeller/ios_stop_fix
Browse files Browse the repository at this point in the history
iOS stop status fix
  • Loading branch information
kalismeras61 authored Dec 7, 2023
2 parents 5c3e628 + 61478b4 commit 22a5a19
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions darwin/Classes/Music.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ public class Player : NSObject, AVAudioPlayerDelegate {
self.channel.invokeMethod(Music.METHOD_PLAY_OR_PAUSE, arguments: [])
}

func invokeListenerStop(){
self.channel.invokeMethod(Music.METHOD_CURRENT, arguments: nil)
}

func setupMediaPlayerNotificationView(notificationSettings: NotificationSettings, audioMetas: AudioMetas, isPlaying: Bool) {
self.notificationSettings = notificationSettings
self.audioMetas = audioMetas
Expand Down Expand Up @@ -810,11 +814,13 @@ public class Player : NSObject, AVAudioPlayerDelegate {
func stop(){
self.player?.pause()
self.player?.rate = 0.0

self.playing = false

self.invokeListenerStop()

self.updateNotifStatus(playing: self.playing, stopped: true, rate: self.player?.rate)

self.player?.seek(to: CMTime.zero)
self.playing = false
self.currentTimeTimer?.invalidate()
#if os(iOS)
self._deinit()
Expand Down

0 comments on commit 22a5a19

Please sign in to comment.