Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spotify track is not playing after I stopped MPMusicPlayerController.systemMusicPlayer track #44

Closed
Ilesh opened this issue Oct 11, 2018 · 1 comment

Comments

@Ilesh
Copy link

Ilesh commented Oct 11, 2018

In my application, I am using MPMusicPlayerController.systemMusicPlayer for the playing song of Apple music, it's working fine. But when I play back Spotify track using playSpotifyURI it's not working. I have checked logs but not showing error anywhere.

Scenario
Step 1. Play track using playSpotifyURI. It is playing fine

SPTAudioStreamingController.sharedInstance().playSpotifyURI(itemID, startingWith: 0, startingWithPosition: 0) { error in
            if error != nil {
                print("*** failed to play: \(String(describing: error))")
                return
            }else{
                print("Playing!!")
            }
        }

Step 2. stop track using.

SPTAudioStreamingController.sharedInstance().setIsPlaying(false, callback: { (error) in
                                
                            })

Step 3. play apple music song using theMPMusicPlayerController.systemMusicPlayer

func beginPlayback(itemID: String) {
        if musicPlayerController.playbackState == .playing {
            musicPlayerController.stop()
        }
        //musicPlayerController.setQueue(with: [itemID]) //1324456545
        musicPlayerController.setQueue(with: [itemID])
        musicPlayerController.prepareToPlay { (error) in
            print("prepareToPlay----------------")
        }
        musicPlayerController.play()
    }

Step 4. Stop Apple music song using.

if musicPlayerController.playbackState == .playing {
            musicPlayerController.stop()
        }

Step 5. Play track using playSpotifyURI using below code but it's not playing, I couldn't find any error.

SPTAudioStreamingController.sharedInstance().playSpotifyURI(itemID, startingWith: 0, startingWithPosition: 0) { error in
            if error != nil {
                print("*** failed to play: \(String(describing: error))")
                return
            }else{
                print("Playing!!")
            }
        }

Is there any issue of the above code? Please help me to solve an issue. Any help will be appreciated

@Ilesh Ilesh changed the title track not playing after I played stoped MPMusicPlayerController.systemMusicPlayer spotify track is not playing after I stopped MPMusicPlayerController.systemMusicPlayer track Oct 11, 2018
@jackfreeman
Copy link
Contributor

Please note these issues relate to the streaming SDK which can be found here https://github.com/spotify/ios-streaming-sdk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants