Lucas
Lucas

Reputation: 3591

MediaElement (video with no sound) and Zune interruption

My team is working on a game on WP7 using Silverlight, that uses no ingame sounds or music, however the game has an intro (video) set on the start of the game. The intro is with no sound, and plays perfectly once the application starts, so no issue there.

We are using a MediaElement to play that intro, but whenever we do that with zune playing in background the music stops, and when we tried to publish the game we got 2 errors concerning this matter. First is that we do not ask to stop the Zune music when we start the application. Second, is that we do not have any settings concerning music/sound volume in the game.

Our question is, why do we have to ask the user to stop zune music if we do not use any sound/music at all throughout the whole game? Second, why do we have to use the sound/music settings if we do not use any sound/music at all? Along with these questions obviously is the question, how to resolve it, or bypass this problem by some hack-around if possible?

Our goal is to be able to play the game irrespectively of any sound/music activity that happens outside of the game, since the game is not using any sound/music, so it makes no sense to a) ask user to stop outside music and b) to put any sound/music level settings in the application.

Bear in mind that we have to play the intro with the video file we have, it can't be done with other tools, like some custom animation in xaml etc.

Any help/suggestion would be greatly appriciative.

Upvotes: 0

Views: 119

Answers (1)

Matt Lacey
Matt Lacey

Reputation: 65556

The requirement exists to stop apps or games from playing their own music when the person using the phone is already playing their own music.

The issue you're hitting is due to the mediaelement using the default media pipeline (that the native music player uses). Regardless of whether the video includes sound/audio or not, it uses the same media pipeline.

You're probably doing something quite unusual by playing a video with no sound and, unfortunately, Windows Phone doesn't make it easy to do something out of the ordinary.
In this situation you're going to have to add the prompt if the user is playing music and you want to play the video. Maybe consider adding audio (if appropriate) or add an option to skip playing the video.

Upvotes: 1

Related Questions