         }
 
         player.enableRemoteCommands(remoteCommands)
-        
-        player.remoteCommandController.handleChangePlaybackPositionCommand = { [weak self] event in
-            if let event = event as? MPChangePlaybackPositionCommandEvent {
-                self?.sendEvent(withName: "remote-seek", body: ["position": event.positionTime])
-                return MPRemoteCommandHandlerStatus.success
-            }
-
-            return MPRemoteCommandHandlerStatus.commandFailed
-        }
-        
-        player.remoteCommandController.handleNextTrackCommand = { [weak self] _ in
-            self?.sendEvent(withName: "remote-next", body: nil)
-            return MPRemoteCommandHandlerStatus.success
-        }
-        
-        player.remoteCommandController.handlePauseCommand = { [weak self] _ in
-            self?.sendEvent(withName: "remote-pause", body: nil)
-            return MPRemoteCommandHandlerStatus.success
-        }
-        
-        player.remoteCommandController.handlePlayCommand = { [weak self] _ in
-            self?.sendEvent(withName: "remote-play", body: nil)
-            return MPRemoteCommandHandlerStatus.success
-        }
-        
-        player.remoteCommandController.handlePreviousTrackCommand = { [weak self] _ in
-            self?.sendEvent(withName: "remote-previous", body: nil)
-            return MPRemoteCommandHandlerStatus.success
-        }
-        
-        player.remoteCommandController.handleSkipBackwardCommand = { [weak self] event in
-            if let command = event.command as? MPSkipIntervalCommand,
-                let interval = command.preferredIntervals.first {
-                self?.sendEvent(withName: "remote-jump-backward", body: ["interval": interval])
-                return MPRemoteCommandHandlerStatus.success
-            }
-            
-            return MPRemoteCommandHandlerStatus.commandFailed
-        }
-        
-        player.remoteCommandController.handleSkipForwardCommand = { [weak self] event in
-            if let command = event.command as? MPSkipIntervalCommand,
-                let interval = command.preferredIntervals.first {
-                self?.sendEvent(withName: "remote-jump-forward", body: ["interval": interval])
-                return MPRemoteCommandHandlerStatus.success
-            }
-            
-            return MPRemoteCommandHandlerStatus.commandFailed
-        }
-        
-        player.remoteCommandController.handleStopCommand = { [weak self] _ in
-            self?.sendEvent(withName: "remote-stop", body: nil)
-            return MPRemoteCommandHandlerStatus.success
-        }
-        
-        player.remoteCommandController.handleTogglePlayPauseCommand = { [weak self] _ in
-            if self?.player.playerState == .paused {
-                self?.sendEvent(withName: "remote-play", body: nil)
-                return MPRemoteCommandHandlerStatus.success
-            }
-            
-            self?.sendEvent(withName: "remote-pause", body: nil)
-            return MPRemoteCommandHandlerStatus.success
-        }
-        
-        player.remoteCommandController.handleLikeCommand = { [weak self] _ in
-            self?.sendEvent(withName: "remote-like", body: nil)
-            return MPRemoteCommandHandlerStatus.success
-        }
-        
-        player.remoteCommandController.handleDislikeCommand = { [weak self] _ in
-            self?.sendEvent(withName: "remote-dislike", body: nil)
-            return MPRemoteCommandHandlerStatus.success
-        }
-        
-        player.remoteCommandController.handleBookmarkCommand = { [weak self] _ in
-            self?.sendEvent(withName: "remote-bookmark", body: nil)
-            return MPRemoteCommandHandlerStatus.success
-        }
         
         resolve(NSNull())
     }

public class RNTrackPlayer: RCTEventEmitter {
    
    // MARK: - Attributes

    private lazy var player: QueuedAudioPlayer = {
        let player = QueuedAudioPlayer()

            }
        }
        
        player.remoteCommandController.handleChangePlaybackPositionCommand = { [weak self] event in
            if let event = event as? MPChangePlaybackPositionCommandEvent {
                self?.sendEvent(withName: "remote-seek", body: ["position": event.positionTime])
                return MPRemoteCommandHandlerStatus.success
            }
            
            return MPRemoteCommandHandlerStatus.commandFailed
        }
        
        player.remoteCommandController.handleNextTrackCommand = { [weak self] _ in
            self?.sendEvent(withName: "remote-next", body: nil)
            return MPRemoteCommandHandlerStatus.success
        }
        
        player.remoteCommandController.handlePauseCommand = { [weak self] _ in
            self?.sendEvent(withName: "remote-pause", body: nil)
            return MPRemoteCommandHandlerStatus.success
        }
        
        player.remoteCommandController.handlePlayCommand = { [weak self] _ in
            self?.sendEvent(withName: "remote-play", body: nil)
            return MPRemoteCommandHandlerStatus.success
        }
        
        player.remoteCommandController.handlePreviousTrackCommand = { [weak self] _ in
            self?.sendEvent(withName: "remote-previous", body: nil)
            return MPRemoteCommandHandlerStatus.success
        }
        
        player.remoteCommandController.handleSkipBackwardCommand = { [weak self] event in
            if let command = event.command as? MPSkipIntervalCommand,
                let interval = command.preferredIntervals.first {
                self?.sendEvent(withName: "remote-jump-backward", body: ["interval": interval])
                return MPRemoteCommandHandlerStatus.success
            }
            
            return MPRemoteCommandHandlerStatus.commandFailed
        }
        
        player.remoteCommandController.handleSkipForwardCommand = { [weak self] event in
            if let command = event.command as? MPSkipIntervalCommand,
                let interval = command.preferredIntervals.first {
                self?.sendEvent(withName: "remote-jump-forward", body: ["interval": interval])
                return MPRemoteCommandHandlerStatus.success
            }
            
            return MPRemoteCommandHandlerStatus.commandFailed
        }
        
        player.remoteCommandController.handleStopCommand = { [weak self] _ in
            self?.sendEvent(withName: "remote-stop", body: nil)
            return MPRemoteCommandHandlerStatus.success
        }
        
        player.remoteCommandController.handleTogglePlayPauseCommand = { [weak self] _ in
            if self?.player.playerState == .paused {
                self?.sendEvent(withName: "remote-play", body: nil)
                return MPRemoteCommandHandlerStatus.success
            }
            
            self?.sendEvent(withName: "remote-pause", body: nil)
            return MPRemoteCommandHandlerStatus.success
        }
        
        player.remoteCommandController.handleLikeCommand = { [weak self] _ in
            self?.sendEvent(withName: "remote-like", body: nil)
            return MPRemoteCommandHandlerStatus.success
        }
        
        player.remoteCommandController.handleDislikeCommand = { [weak self] _ in
            self?.sendEvent(withName: "remote-dislike", body: nil)
            return MPRemoteCommandHandlerStatus.success
        }
        
        player.remoteCommandController.handleBookmarkCommand = { [weak self] _ in
            self?.sendEvent(withName: "remote-bookmark", body: nil)
            return MPRemoteCommandHandlerStatus.success
        }
        
        hasInitialized = true
        resolve(NSNull())
    }
    
