|
In this article I will share my another experience of my app submission in marketplace. The app was using MediaLibrary.
Let's see how it all happened.
Step 1: Create a silverlight for Windows Phone project.
Step 2: Add a xyz.mp3 file in the project. Go to properties of the .mp3 file and change the Build Action from Resource to Content.
Step 3: Add a MediaElement inside Grid of MainPage.xaml like below.
<MediaElement x:Name="PlayMusic" Source="xyz.mp3" AutoPlay="True" />
Step 4: Submit the app in the Marketplace and it won't be certified.
The requirement is below:
When the user is already playing music on the phone when the application is launched, the application must not pause, resume, or stop the active music in the phone MediaQueue by calling the Microsoft.Xna.Framework.Media.MediaPlayer class.
If the application plays its own background music or adjusts background music volume, it must ask the user for consent to stop playing/adjust the background music (e.g. message dialog or settings menu). This prompt must occur each time the application launches, unless there is an opt-in setting provided to the user and the user has used this setting to opt-in.
The test process of app is below:
1. Play a music file. 2. Launch the application. 3. Verify that while the application loads, it does not pause, resume or stop the actively playing music.
Step 5: Rework on the app, start the zune player and play any music. Go back to your app list in your device and start the app. You will notice that Zune player stopped. Let's fix the problem.
Step 6: Add reference of Microsoft.Xna.Framework and Microsoft.Xna.Framework.Game.
Step 7: Add below using directive in MainPage.xaml.cs
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Media;
Step 8: Check the state of MediaPlayer whether it is playing or not or Game has control over the MediaPlayer or not.
If Zune or Game has control over media player show a message with OK and Cancel option.
If cancel is clicked close the app and if OK is clicked proceed with Start app.
if (MediaPlayer.State == MediaState.Playing && !MediaPlayer.GameHasControl) { string msg = String.Format("Zune is currently playing music. ServiceBell needs to stop music.\nPlease click Ok to continue or Cancel to close the ServiceBell."); MessageBoxResult res = MessageBox.Show(msg, "Zune", MessageBoxButton.OKCancel); if (res == MessageBoxResult.Cancel) { Microsoft.Xna.Framework.Game game = new Microsoft.Xna.Framework.Game(); game.Exit(); } else { //StartApp(); } } else { //StartApp(); }
This ends the article of Marketplace and MediaPlayer in Windows Phone.
|