Media Element doesn't work after installing Mango developer tools - windows-phone-7

I'm downloading a voice file from the internet and save it in isolated storage. The I pass this file to a media element on the page and then I call the Play() method. The app was working fine until I installed Mango developer tools. Since then the media element doesn't play the file.
private void DownloadCompleted(System.IO.IsolatedStorage.IsolatedStorageFileStream _Result)
{
if (_Result.CanRead && (bool)chkSpeak.IsChecked)
{
mediaElement1.SetSource(_Result);
mediaElement1.Play();
}
}
<MediaElement Height="111" HorizontalAlignment="Left" Name="mediaElement1" VerticalAlignment="Top" Width="100" Volume="1" AutoPlay="True" IsHitTestVisible="True" />
Do I need to make any changes in my code?

According to the Release Notes (I assume you mean beta 2), these two are known issues:
When Windows Phone Emulator is running
on Windows Vista, some audio problems
may occur. This issue is caused by
lost audio packets when playing audio
such as media files or alarms.
Setting the source of a MediaElement
object fails every other time.
Might be related. (Are you using Vista/does SetSource work intermittently?)

Related

Xamarin Live Player crashes when loading a bitmap, but it runs fine via USB connection

I've been following the examples for using SkiaSharp with Xamarin Forms, particularly the section on using bitmaps. I'm doing this in Microsoft Visual Studio 2017 version 15.9.11. I'm only targeting Android currently.
This page https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/basics/bitmaps has a section on Loading a Bitmap Resource, where the bitmap is an embedded image resource in the project.
So, we add the image and make it type 'embedded resource'
and then run the example code to simply display the image on the canvas.
string resourceID = "SkiaTest.Media.monkey.png";
Assembly assembly = GetType().GetTypeInfo().Assembly;
using (Stream stream = assembly.GetManifestResourceStream(resourceID))
{
resourceBitmap = SKBitmap.Decode(stream);
}
All pretty simple, and it works fine if I run the code on my phone if it is connected via USB in the standard way (a Sony Z5) so the second in the list here, not the Player:
Here it is working via USB:
But if I try and use Xamarin Live Player (the first in the list above) then it crashes on this line:
using (Stream stream = assembly.GetManifestResourceStream(resourceID))
Note that the app runs fine in Live Player if I don't try and load the bitmap, it's only that line that triggers the crash, and only in Live Player.
So I wonder if anyone has any ideas what could be causing Live Player to fail over this issue? Is the resource not being copied to the phone? Does Live Player just not support this type of activity?
The reason you are facing this issue is that Embedded Resources are not yet supported by Xamarin Live player which is causing this exception.
More details can be found in the Troubleshooting Xamarin Live Player document.

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!

Reflection failure when attempting to access Microsoft.Phone.Media.Extended

I am developing one Flash Light application in Silverlight for windows phone 8. Currently
I am deeply stuck in one issue for the use of "Microsoft.Phone.Media.Extended" assembly. Flash Light Application for Windows phone 7 is already live in Windows Phone Marketplace and it is working very fine for Windows Phone 7 but it is not working for Windows Phone 8 because of "Microsoft.Phone.Media.Extended" dll.
After converting WP7 app into wp8 and run then I got this type of error message:
Could not load file or assembly 'Microsoft.Phone.Media.Extended,Version=7.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e' or one of its dependencies. The system can not find file specific."
According to following link for Windows Phone-specific features:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206947(v=vs.105).aspx
If you were using reflection to access the API in this assembly, because they were not publicly exposed, your app may fail on a Windows Phone 8 device. Remove the calls to this assembly and use the publicly exposed media API.
I an not understanding how to use publicly exposed media API. I used Microsoft.Phone.Media.Extended using reflaction in Windows Phone 7. Is there any direct method for accessing Microsoft.Phone.Media.Extended in Windows Phone 8 or other way to solve this?
Thanks.
==========================================================================
Edited Question:
Hi,
As per the thread, we used "VideoTorchMode" enumeration to make flashlight ON. As per that, I used AudioVideoCaptureDevice class using Windows.Phone.Media.Capture namespace with following code:
var objDevice = await AudioVideoCaptureDevice.OpenAsync(CameraSensorLocation.Back, AudioVideoCaptureDevice.GetAvailableCaptureResolution(CameraSensorLocation.Back).First());
objDevice .SetProperty(KnownCameraAudioVideoProperties.VideoTorchMode, VideoTorchMode.On);
I want to keep the flash light on but without capturing video. So, i have not initialized video capture code. The issue is, i don’t have WP8 yet and in simulator i am not able to test this.
Can any one confirm that once i put this code, my app will work as Flashlight-X where light will be on without blinking and also it will not get crashed in WP8.
Thanks
Microsoft.Phone.Media.Extended is a private API in WP7 that wasn't meant to be used by 3rd party developers. That API doesn't exist or works on WP8.
For WP8 flashlight use the AudioVideoCaptureDevice known property of VideoTorchMode=On. Also, make sure to handle failures like exceptions or devices that don't have a Camera Torch by showing a white screen.
Here's a code sample that turns on the camera flash on my Lumia 820 and Lumia 920:
var sensorLocation = CameraSensorLocation.Back;
try
{
// get the AudioViceoCaptureDevice
var avDevice = await AudioVideoCaptureDevice.OpenAsync(sensorLocation,
AudioVideoCaptureDevice.GetAvailableCaptureResolutions(sensorLocation).First());
// turn flashlight on
var supportedCameraModes = AudioVideoCaptureDevice
.GetSupportedPropertyValues(sensorLocation, KnownCameraAudioVideoProperties.VideoTorchMode);
if (supportedCameraModes.ToList().Contains((UInt32)VideoTorchMode.On))
{
avDevice.SetProperty(KnownCameraAudioVideoProperties.VideoTorchMode, VideoTorchMode.On);
// set flash power to maxinum
avDevice.SetProperty(KnownCameraAudioVideoProperties.VideoTorchPower,
AudioVideoCaptureDevice.GetSupportedPropertyRange(sensorLocation, KnownCameraAudioVideoProperties.VideoTorchPower).Max);
}
else
{
ShowWhiteScreenInsteadOfCameraTorch();
}
}
catch(Exception ex)
{
// Flashlight isn't supported on this device, instead show a White Screen as the flash light
ShowWhiteScreenInsteadOfCameraTorch();
}
Make sure to add the required capabilities and requirements to your WP8 app when using the camera torch (ISV_Camera, Microphone, and ID_REQ_BACK_Camera).
What about getting this assembly from somewhere and adding it to your XAP directly (try asking on XDA developers)? This might work, if it's signed and not requiring any special capabilities.
If you use the new API to "record" a video, then using the VideoTorchMode enumeration might do just want you want to create a "flashlight" effect.

AdControl SDK Version 6.1.320.0 is not serving test ads

I am having some issue with AdControl SDK(6.1.320.0) for Windows Phone, and wondering if anybody else is having the issue here. My problem is that AdControl is not displaying test ads in emulator and on device too. I tested on multiple machines, and even created a new test project to try it out.
This is my XAML code:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<my:AdControl AdUnitId="Image480_80" ApplicationId="test_client" Height="80" HorizontalAlignment="Left" Margin="-34,118,0,0" Name="adControl1" VerticalAlignment="Top" Width="540" />
</Grid>
This is what I did so far:
Added erroroccured event of the ad control, and printed the error. it showed "HTTP error status code: NotFound (404)"
I checked all capabilities in the manifest. it contains all capabilities because its the default test project.
then i tried the same on my work pc, which didnt have Windows Phone SDK and AD SDK before. Its not working there either.
then i decompiled Ad SDK for Silverlight assembly, and found the URL of production and testing server.
AdPlacement.ServerUrl = "https://mobileads.msn.com/v3/Delivery/Placement";
AdPlacement.TestServerUrl = "https://mobileads-test.msn.com/v3/Delivery/Placement";
The test server url is not connecting at all. I am using VS2010 ultimate on a Windows 7 x64 ultimate machine.
Any other idea? I contacted psupport AT microsoft DOT com as well, yet to get their reply
After couple of emails with MS Ad center support, they could reproduce the issue in-house when trying to connect from outside network. They fixed the issue this afternoon. Its working without any code change from my side. The problem was the ad server that serves test ads "https://mobileads-test.msn.com/v3/Delivery/Placement was not reachable from outside MS network!
I personally never understood the need for test mode. I never use test mode.. just set the correct config for application / ad unit and thats it.

WP7 emulator won't play mp4

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.

Resources