WP7 emulator won't play mp4 - windows-phone-7

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.

Related

Firefox HTML5 Audio: Media resource could not be decoded (OnMediaSinkAudioError)

This issue is related to playing media in Firefox. While trying to stream audio after moving workstations, I get the following error in the console:
Media resource [...] could not be decoded [...] NS_ERROR_DOM_MEDIA_MEDIASINK_ERR (0x806e000b) Details: OnMediaSinkAudioError
In this case, it's not down to the website setup or contents of the audio stream, as they were working before.
Searching online for OnMediaSinkAudioError or NS_ERROR_DOM_MEDIA_MEDIASINK_ERR only seem to turn up with code commits or repositories for Firefox itself, so this doesn't appear to be a common problem.
It turns out that in this scenario, the error is quite misleading, since it is caused by a misconfiguration of the Windows audio output device.
After swapping my headphones from the rear audio ports to the front and restarting the workstation, everything worked fine. Restarting Firefox may have also been sufficient.
I had the same problem more than once, this time after showing the Console (on Soundcloud) I saw the NS_ERROR_DOM_MEDIA_MEDIASINK_ERR error logged and googled it to find this SO question. What fixed this issue for me was the 1st solution at drivereasy (restarting the Windows Audio service), without even restarting Windows or Firefox.
Hold Down Windows logo and press R key. A Run dialog box will pop up.
Type services.msc in the run box and click OK button.
In right Services Window, find Windows Audio from the “Name” list and right-click on it. Click Restart in the pop-up menu. Then the audio service will restart.
A cmd oneliner would be net stop AudioSrv && net start AudioSrv, run as Administrator.
If you are using VS CODE Live Server extension, Javascript Audio() won't play sound. Try running the site without the extension.
I was receiving the similar error (Media Resource xxx could not be decoded.) in Firefox 46.0.1 and it turns out, the browser does not support .wav files, it worked fine with mp3 audio files.
I had to use embed element with type="application/x-mplayer2" which triggered vlc component to play the file. We were okay with this work around as we only use this website internally and had to stick to older version of Firefox for some reasons.
Though, the audio wav files worked fine in Google Chrome and Mozilla Firefox latest versions.

Add music to windows 8.1 app - Visual studio 2013

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.

Add songs/photos/videos to Windows Phone 8 Emulator

How can I add media files to library folders of WP emulator so that I can list them in my program?
The Windows Phone 8.1 SDK allows you to use a folder on your dev machine to simulate an SD card for the emulator. If you put a bunch of media files in that folder before "inserting" it into the emulator, they will get picked up and added to the appropriate libraries.
Note that it can take a few seconds for media indexer to wake up and go through the content but you can easily check on its progress in the appropriate built-in app (eg. Music or Photos).
You can find this feature in the emulator's Additional Tools window:
you need to use SaveSong from MediaLibrary
have a look at this
One of the new features of the Windows Phone 8 SDK is the ability to save(add) songs to the phone's MediaLibrary.
Try this out for Songs.
for photos
Try this

Microsoft Player Framework not playing local files

I am developing a windows 8 app in winjs and one of its features is to be able to play local video files. So far I am using:
Windows.System.Launcher.launchFileAsync
Which works fine but obviously suspends the app and opens the video with their default video program. I would rather keep the user in the app so I tried to implement it using the Microsoft Player Framework(http://playerframework.codeplex.com/). I know the framework is referenced correctly etc because it can play video files both in the 'app data' directory and online.
However when I try to play files within a folder that the user has picked (with the folder picker) or the videos library that the app has declared access to, the video fails to play. The app can however change the name, create new files in the directory and delete files so I struggle to see a permissions problem.
To get the path of the file I am using getFileAsync( and using the path property and simply using that to set the src property of the MediaPlayer control.
Do any windows 8 app gurus have any suggestions as to why it is not working?
Thanks in advance
p.s. let me know if any further info is required

How do you set up SMFPlayer on Windows Phone 7?

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!

Resources