I'm creating a windows app , windows 8.1 app, using visual studio 2013.
i want to add a background music to it.
how to add it?
Do you mean music while the app is playing or music running when the app is in the background?
For both you'll set up a MediaElement running the music file you want to play.
Since the MediaElement will only play while it's in the visual tree you need to play a small trick to keep it running through all of the app's pages: instead of running the app out of a top-level page, create a root page with the MediaElement and a child frame, then run the app's pages out of the child frame. See my blog entry Frame of reference: keeping the music playing across pages for more details.
To play music when the app is in the background you'll need to declare the background audio task, set the MediaElement to BackgroundCapableMedia, and wire up SystemMediaTransportControls. See the How to play audio in the background documentation on MSDN for details.
Related
I have a big issue with BackgroundMediaPlayer on Windows 10 mobile but I think that is very similar as API on Windows Phone 8.1. My app works similar as windows 10 sample. But I decided to add small user interface on mainpage where user can easily stop actual music. Problem is that when I am trying access BackgroundMediaPlayer.Current with events my music player don't play any music but when I delete events from main page It start works again. I manage my music player from other page. Is some way how to find out if my BackgroundMediaPlayer actualy playing some music with name of music ? Because I do not know how to continue with my project... Thanks for help
How to put a video in a splash screen in Windows Phone 8 Application development. I am using visual Studio 2012. I am new in Windows development. If possible give me the coding. Thanx in advance
Also you can keep an image in your project by name SplashScreenImage.jpg. It will directly show this particular image on starting and you can also extend the time to show that image.
I have been trying to play a simple smooth streaming video following the steps under
http://smf.codeplex.com/documentation "Building a Windows Phone Player". I have followed the steps exactly and am even using the Big Buck Bunny example. I'm using Visual Studio 2010, the libraries in microsoft-smf-binwp7-2.2012.0605.0.zip from smf.codeplex.com, and Microsoft.Web.Media.SmoothStreaming v1.1.837.146. I'm debugging on a windows 7 phone (and I have tried release as well), but the video never plays. The view loads, the player controls are visible, no time is set on the player and the play button is visible. I never get a MediaOpened or MediaPluginRegistered event. I have even tried setting AutoLoad and AutoPlay to true and clicking on the play button.
The only exception I get after the Loaded event is the following:
FileNotFoundException
File or assembly name 'System.Windows.debug.resources, Version=2.0.5.0, Culture=en-US, PublicKeyToken=7cec85d7bea7798e', or one of its dependencies, was not found.
As a side note, I have tried exactly the same thing on a Windows 8 Phone build to debug on a Windows 8 phone and it works just fine. Please help!
I'm developing a windows phone app with a background player based on the windows phone 7.1 project template(so i have 2 projects). My question is how i dynamically set the list of tracks for the background player to play? I tried static fields but didn't work and my guess is that i have to define a resource in the app.xaml but how it is done exactly? I need to share a List and an integer.
Thanks for the help!
The audio agent won't be able to read any resources in the App object (app.xaml).
As far as I can see the only way to communicate between your app and the background audio is via the BackgroundAudioPlayer.Instance object, the AudioTrack (see especially the Tag property) and using files stored in Isolated Storage.
This is described on MSDN here.
Also check out the Background Audio player in the MSDN code samples.
I was wondering if the format is really supported. I am developing a simple WP7 application which contains a MediaElement such as the one shown bellow:
For the sake of testing, I subscribed for the MediaFailed event and it fires always.
If I try to open the file in the browser, it opens successfully. If I put the same MediaElement in a regular SL application - it runs. If I give some .wmv file to the MediaElement in the WP7 app - it runs. (http://files.ch9.ms/ch9/5baa/ea2aeba2-9dcc-4565-942a-9e6101655baa/DevKid_ch9.wmv).
Got any ideas?
One thing to watch is that video won't play if you're connected using USB to the Zune software.
I just tried your video using this IronRuby script - it plays fine.
For more help, you can check out the Channel9 application on codeplex - that works well.
Windows Phone 7 supports the MP4 container, but only supports a certain set of codecs. I believe this list is a pretty accurate list of what's supported.
It seems that you can't play mp4 files when Zune is running. However, you can still debug your application by connecting to your phone using WPConnect.exe which by default is installed to C:\Program Files\Microsoft SDKs\Windows Phone\v7.0\Tools\WPConnect. You'll need to close Zune before running WPConnect, but after you have run it, you should be able to F5 in Visual Studio and the the debugger running your code on the phone.
One other thing to keep in mind is that Windows Phone 7 requires the file (or URL) extension to match with the codec, so for mp4 files you need to have file name ending with .mp4, otherwise it won't play.