Resume spotify after playing own audio - c#

I am coding a WP7 & WP8 sports tracking app that gives the user feedback through voice coaching. If a user is playing music, it needs to be paused, the voice coach needs to speak and finally the music must be resumed again. For the standard music player, i based my coding on the information given on this website, and it works for the standard music player, but not for Spotify.
I've been looking into it and the mediaplayer seems to lose track of Spotify when i pause their music, and Spotify seems to crash. There is no music in the MediaPlayer.Queue when Spotify is playing so i can't save and restore that. It's also not possible to simply try a MediaPlayer.Resume(); after pausing Spotify because the music player does not know what to play anymore due to the empty playlist.
Is it possible to create a windows phone app that is compitable with Spotify?
Thanks.

This isn't possible as 3rd party media applications such as Spotify don't use the MediaPlayer and so MediaPlayer.Resume() won't work for them.
You could request Microsoft to implement this in a future version the OS via the uservoice site.

Related

How to detect if another application's audio is playing in background? (UWP, Windows 10)

I am writing a C# SDK (to be used by UWP Publishers) and would like to detect if another application (Pandora, Spotify, Amazon Music, etc.) is playing music in the background, so that I can mute my SDK's sounds.
This comment to this question seems to indicate that I can use BackgroundMediaPlayer.IsMediaPlaying(), but when I play Pandora in a web browser, or the Amazon Music App, this method seems to always return false when music is playing in another app.
This answer to this question seems to indicate that we used to be able to use Microsoft.Xna.Framework.Media.MediaPlayer.State to detect if another app was playing background music, but I don't believe this call is not available in UWP (please let me know if I'm wrong -- I mainly care about this working on Desktop and XBox One).
So my question is, how can I determine if another app (on desktop or in web browser or on Windows phone) is playing music?
I believe the BackgroundMediaPlayer.IsMediaPlaying detects audio playing from WinRT/UWP apps only and not Win32 apps. This API was important for apps on Mobile because you were only allowed to have one app with background audio at any given time. I don't think there is a way to detect this for Win32 apps at this time.
The BackgroundMediaPlayer.IsMediaPlaying method is now obsolete. I've noticed that if background music is playing in UWP, calls to Microsoft.Xna.Framework.Media.MediaPlayer.Play succeed but do not actually play any music, so it seems the check is not necessary in some cases.

Windows Phone, Navigate to MusicPlayer

I'm developing WP application, part of which is to play/stream audio files.
I didn't wanted to create my own page to display info of current playing track, so I decided to use Built-in Music's player, using Microsoft.Xna.Framework.Media.MediaPlayer class I created playlists and queued playback. It all works fine, but now I need to navigate to MusicPlayer, when user taps on track in my app, and that's the part I've no idea what to do.
I've tried to navigate to MusicPlayer using Microsoft.Phone.Tasks.MediaPlayerLauncher, but it's not an option, because it...
Needs to receive media location in IsolatedStorage, which means
streaming is impossible
Gets one media at a time, so no playlists
I guess I can't navigate without changing track(or starting over)
Is there any way to navigate to Built-in Music Player's Now Playing page, without interrupting playback?
I think these questions might be helpful/related to what you're looking for:
Detecting and launching an external application from within a Windows Phone 7.1/7.5 application
Launching other applications in Windows phone 7 Programatically
In short, it doesn't seem like third-party apps have permission to access other apps on the phone, probably for security reasons.

How to record the running music Windows 8 metro app

I am making a music based app. The app has the functionality of playing a music from the music library of the user and the user has a chance to play different type of instruments i.e. Drums parallel to the music being played.
What I want to do is, start a recording session and record both the sounds being getting out of the music app i.e. The background song together with the drum sounds that the user is making.
How do I do that in C#/xaml?
I have googled about it and didn't find anything useful :(
Thanks

Resuming spotify/radio after MediaPlayerLauncher's media is finished - WP7

This question is related to another question i have asked:
MediaPlayerLauncher on WP7 - how to resume previously playing media?
Quick overview: Users can view movietrailers in my WP7-app, using MediaPlayerLauncher.
I am able to resume "normal music" when my trailer is done, like you can see on my other asked question. However, neither radio nor spotify-music resumes. When navigating to the spotify application after a movietrailer is finished, the song that was playing has the pause-icon active (e.g it looks like it's playing), but the timer has stopped. Tapping the pause-icon has no effect (it doesnt switch to the play-icon at all). To start listening again i have to select a different song.
Do i have to resume radio/spotify-music after a trailer is done, or the user quits it, to get my app accepted in the Windows Phone Marketplace?
Independent of what the answer of #1 is, id like to know how to achieve this, if its possible
Section 6.5 (6.5.1 and 6.5.3) in the Additional Certification Guidelines gives the answers: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184838(v=vs.92).
Normally you have to ask explicitly to play media if music is already playing (6.5.1). However, there is an exception which applies to you for 'non-interactive full motion video' (6.5.3), with extra the requirement that yes, you do have to resume the music afterwards.
Here are a couple of links that might help with resuming the original music after the video plays: http://www.governor.co.uk/news-plus-views/2011/2/16/resuming-background-music-in-wp7-applications and http://gdwp7dev.wordpress.com/2010/10/19/resume-the-users-music-after-mediaplay/

Playing audio file using itunes SDK

I am developing a windows form C# application that should be able to interface with iTunes. Basically, I now am able to use the iTunes COM to play music. However, when I do this, iTunes should be running since the music plays through iTunes. I was wondering if there is a way I can play music without iTunes running. Is it possible to just use the iTunes SDK to play music without starting iTunes?
No you can't. iTunesLib COM Object is just a way to control the player engine implemented in the iTunes application, and to manage the media library.
Even if you would like to implement your own player, you couldn't avoid iTunes showing up, because it's showing up when iTunes object is instanciated.
The only way is to implement your own (background) player and to parse the iTunes media library file with some XML process.

Categories