Windows (phone) emulator 8.1/10 stuck at loading the OS

I've been trying to get the emulator to work for days. Previously I tried the Windows Phone 8.1 Emulator as well as the Windows 8.1 Simulator and both were stuck at loading the OS.
Earlier today I installed the new Windows 10 Tools and thought I should give it another try with the new Windows 10 Emulator... And no, still the same result.
What's strange is that, the Hyper-V Manager seems to be doing OK. I can see the app displays correctly on the little Preview window (see the box on the left side of the picture below).
Also, breakpoints are hit, the project seems to be running OK.
As many answers have already suggested, I tried letting
it running for an hour, but still nothing came up.
Things that I've also tried include uninstalling all the Virtual Machines as well as repairing the WP 8.1 Emulator, nothing has worked so far.
Please help, this has driven me completely insane. :(
Justin L

Hello,
We have heard about a report of this problem, and with the OS build you have, you can use the following workaround to get around this problem.
1.) Open Hyper-V
2.) Shutdown any existing configured Phone emulators.
3.) Click on "Virtual Switch Manager"
4.) Click on the "Windows Phone Emulator Internal Switch"
5.) Remember what the settings are displayed there (because you will delete it and recreate it)
6.) Delete the existing "Windows Phone Emulator Internal Switch" by clicking "Remove"
7.) Click "Apply" and "OK"
8.) Re-create the "Windows Phone Emulator Internal Switch" by clicking the "New virtual network switch" and use the same settings you remembered in Step 5.
9.) Then try to F5 from Visual Studio - which should configure a new emulator on the right virtual switch.
Let me know the results.
Thx.
Windows Store Developer Solutions, follow us on Twitter:
@WSDevSol|| Want more solutions? See our blog

Similar Messages

  • Windows phone 8.1 spotify gets stuck when loading the app.

    When i open the app it satys in the loading page... it never loads.. i tried to reinstall and works but again i am back to the same problem. is very anoying since i cannot even play any music.. i am paying for nothing :S 

    Spotify's Windows Phone app is embarrasing. I received "support" from them a couple of weeks ago regarding this issue on Twitter. While they were resposive, they simply suggested the "uninstall, reboot & reinstall" trick. That worked for about 24 hours, then nothing but dots for the songs in my playlists - after they take forever to load up. Those same playlists load instantly on my iPad. Spotify - Sure, the Windows Phone market isn't huge compared to your iOS and Android customer base. However, by releasing an app that gives the user - paid users (like me) - a horrible experience, you will lose those customers to an alternate service. Because of this lack of support and caring, I will likely move my paid subscription (and my two family memebers) to a different service that works properly on ALL devices. Maybe I will revisit this service once you have a good universal Windows 10 and Windows 10 Mobile app (see my other rant: https://community.spotify.com/t5/Live-Ideas/Windows-8-Metro-App/idc-p/1141848#M37322 ). Lumia 830 - WP 8.1 (Denim) Update 2 - US / T-Mobile

  • Known issue: Geofencing is malfunctioning in the background on devices and is completely nonfunctional in the Windows Phone Emulator (Windows 10 Insider Preview SDK and tools, April 2015 release)

    On physical devices, geofences that have been triggered are not causing their associated background task to fire.  The device may also incorrectly stop tracking geofences
    in connected standby, causing the geofencing trigger to be missed.  Within the Windows Phone Emulator, geofences are not triggering in either the foreground or background.

    Workaround: test the geofencing logic in your app while the app is running in the foreground on a physical device.  

  • Windows Phone Emulator is unable to connect to the Windows Phone operating system: The phone did not respond to the connect request. Some functionality might be disabled

    We are receiving following error, while trying to deploy the application on Win Phone emulator. “Windows Phone Emulator is unable to connect to the Windows Phone operating system: The phone did not respond to the connect
    request. Some functionality might be disabled.”
    I have tried all possible ways that we found on blogs. We are still not able to solve this issue

    I have had a lot of issues with the emulator in the past.
    Check out this troubleshooting guide. It might help:
    https://msdn.microsoft.com/en-us/library/windows/apps/jj681694(v=vs.105).aspx
    Also, I find that if I cancel my build/deploy while it is stuck on booting the OS and then wait a short while the phone OS will complete booting, and from that point I can deploy to the emulator. It's a workaround, but it works well for me.
    I need to do that on Windows 10 tech preview, which may or may not be simply an incompatibility with the beta OS.
    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.

  • Windows phone emulator not working with windows 10 technical preview 9926

    I recently updated my computer to technical preview 9926 and now when I launch the windows phone emulator in 2013 visual studio for windows. It says "Starting windows phone OS" for like 10 minutes. Then it gives me an error message:
    windows phone emulator is unable to connect to the windows phone operating system: The phone did not respond to the connect request. Some functionality might be disabled. And then it will boot up for a little and the home search and back
    button wont work and it will never deploy my app then it will crash and bring me back to visual studio. My hyper v is turned on I have checked all the network switches. The emulator used to work with the technical preview but ever since the newest update
    it stopped working. 
    Any help would be appreciated.
     

    Hi mavese,
    >>I recently updated my computer to technical preview 9926 and now when I launch the windows phone emulator in 2013 visual studio for windows
    Currently, Windows 10 is still in the Technical Preview stage, it is not official supported in this forum, and I would suggest you sending feedback using build-in way, please refer to this link:
    http://windows.microsoft.com/en-us/windows/preview-how-to#how-to=tab7
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Testing using Windows Phone Emulator on Hyper-V from Windows 8.1?...

    Hi,
    I have Windows Server R2 DataCenter w/Hyper-V running, installed the SDK's and able to run the VHD Windows Phone Emulator 8.1.  My next step is to learn how to connect to it from my Windows 8.1 running Visual Studio 2013 Community.
    Can any one help or link me to some tutorials on how to do this?  As of now I have not made any settings changes on the server yet.  So everything is at its default install settings.  I connect to the server using RDC.
    Additional: How do I add the Server Hyper-V Emulator 8.1 to my existing project?
    Thanks!...
    Code is like a box of chocolates!...

    This is not a Hyper-V question, need to know if anyone is testing there phone from there development system from a server.  And, if so how.
    Code is like a box of chocolates!...

  • Known issue: BackgroundTransfer sample fails with 0x80070002 error when using Windows Phone Emulator (Windows 10 Insider Preview SDK and tools, April 2015 release)

    When running the Universal Windows Platform (UWP) BackgroundTansfer sample (C# or C++) in a phone emulator (i.e., Debug Target is Emulator 10.0.1.0) the sample builds and deploys successfully, but clicking any button in "Scenario 1 File Download",
    "Scenario 3 Completion Notifications" or "Scenario 4 Completion Groups" will result in the following exception:
    An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll but was not handled in user code. Additional information: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
    This posting is provided "AS IS" with no warranties, and confers no rights.

    I am getting the same error even with the references recommended here. This is my code
       using (var stream = await Windows.Storage.ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync(
                        JSONFILENAME,
                         CreationCollisionOption.OpenIfExists ))           
                serializer.WriteObject(stream, myCars);
    I can read it back as long as I don't stop the app/emulator. When I run the emulator again the file is gone. I tried loading the app to my Windows Phone and the same thing still happens.

  • Windows 10 10041 - Windows Phone Emulator is loading the OS forever

    hello, Before I update my windows 10 to 10041 I was on 9926 and I have Visual studio 2015 ctp6 with windows phone 8.1 emulators working great. But now I update to 10041 (and installed windows 10 sdk tools too) my emulator is always loading OS...
    I uninstalled sdk tools, but it doesn't change. How could I continue to develop please ? thanks.

    Hi,
    In my opinion, this is probably compatibility problem, however, it would be better to post this question at Windows Phone Development Forum for further assistance.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Its not actually a question. im requesting adobe to make adobe flash player for windows phones. im hoping that we get it with the final release of windows 10 on phones

    im requesting adobe. plzz do it somehow

    @Chris: That's odd.  I too installed Windows 8 Pro x64 since launch and have been receiving/installing all windows updates including "Patch Tuesday" of every month. In fact I just checked my update history and they all show success -- none failed.  Can you find any specific KB # of any update that Microsoft had issued which included updates to Flash?  Also, I just checked with a friend and they too have the factory-shipped version of Flash still installed while being fully-updated.
    I do see the following installed as well however the actual Flash player version was still the old one:

  • Blackberry Z10 got stuck while loading the OS

    Few days before my blackberry Z10 got stuck while i was typing a new, so i have rebooted the device. While restarting it hangs at startup logo. i have left it for couple of works still it is the same stage. unable to get the Home screen.
    from the internet i found that if i can wipe the device, but i have some data in the Internal storage
    can someone advise how can i retrive the data.
    your help is much appreciated.
    Thanks
    santosh

    Hi and Welcome to the Community!
    Access to the data on the device requires that the device be functioning, which is exactly what it cannot do. This simply proves out that backups, like insurance, are neither a reactive nor an optional activity.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • I just purchased PSE 8 for my windows 7 and it will not let me load the "content" cd,

    I just tried my new PSE 8 for the first time and it will not let me load the "content" dvd, it states that PSE is already running (it is not) and to close program and start again.  Any ideas?  This is my first time using any kind of video editing software also.

    Photoshop Elements (PSE) doesn't ship with a Content DVD.
    I think you're probably referring to the PRE Content DVD that comes with Premiere Elements (PRE)
    The PRE User to User Forum (http://forums.adobe.com/community/premiere/premiere_elements) may be a better place to post this question.
    If you bought the Bundle of PSE and PRE it would have come with the PRE Content Disk, but the PRE Forum is still where you might find some help.
    Cheers
    Bob

  • Lenovo should give BIOS update to C 540 to run windows phone 8 emulator

    I bought a new Lenovo C540 yesterday, The main reason to purchase this system was to develop games for windows phone 8 and windows 8. However due to some hidden reason from Microsoft as well as Lenovo,  they don't provide Windows 8 Pro version to the user. It was not mention in the purchase items that what kind of Windows 8 user is going to purchase. However I come to know that it was Windows 8 home edition. Thankfully I purchased one license windows 8 Pro so I just upgraded and hyper-v which is essential to run the emulator is found.
    But I could not start it. Every time I am going to start it says "The windows phone " emulator could not start because the hypervisor is not running. with error code  0x80131500. After a hell lot of googling I found that in event log
    "Hypervisor launch failed; Processor does not provide the features necessary to run the hypervisor (leaf 0x80000001, register 0x3: features needed 0x28100800, features supported 0x28000800)." 
    I found this problem but the solution is from Lenovo side. Can I get a BIOS update so that I can run emulator in the desktop.  It will be great help and definitely my frustration since last 30 hours will end. Why there is so much restriction to the user.

    Will there be any reaction from Lenovo? I have tried to contact the support, but they just say, Windows 8 PRO is not supported by the normal Support. I should contact the premium support for 1.99 €/min. I think they can´t help me either, because the only sollution is a bios update. I found an entry at Microsoft where the whole case is discussed. MS Forum
    Microsoft consists in the support of SLAT and the Bios from the C540 seems to not give the right infomations to the operation system.
    So no one is responsable??!!!!
    It would be great to hear a statement from lenovo to this case.
    greetings Maik

  • Windows Phone camera App crash when switching to another page

    I am creating a Simple Face Detection App for Windows Phone in C#. I turn on my camera , everything works perfect and FaceDetector works too, but when I try to navigate to other page my App always crashes and I do not why. I tried to test my App in Windows
    Phone Emulator and here the navigation works. I also tried debug my App in real device, but there the method OnNavigatedFrom is never hit.
    FaceDetection.xaml.cs
    public partial class FaceDetection : PhoneApplicationPage
    #region member variables
    const string MODEL_FILE = "models/haarcascade_frontalface_alt.xml";
    FaceDetector.Detector _detector;
    int _downsampleFactor = 2;
    private byte[] _pixelDataGray;
    private byte[] _pixelDataDownsampled;
    private int[] _pixelDataGrayInt;
    private WriteableBitmap _wb;
    private DateTime _lastUpdate;
    public static int pocet = 5;
    double point1;
    double point2;
    double heightRectangle;
    double widthRectangle;
    #endregion
    public FaceDetection()
    InitializeComponent();
    _detector = new FaceDetector.Detector(XDocument.Load(MODEL_FILE));
    private void NewCameraFrame(object sender, CameraFrameEventArgs cameraFrameEventArgs)
    PageOrientation orientaciaObrazovky = ((PhoneApplicationFrame)Application.Current.RootVisual).Orientation;
    cameraViewer.UpdateOrientation(orientaciaObrazovky);
    var w = cameraViewer.CameraWidth;
    var h = cameraViewer.CameraHeight;
    if (_pixelDataGray == null || _pixelDataGray.Length != h * w)
    _pixelDataGray = new byte[w / _downsampleFactor * h / _downsampleFactor];
    _pixelDataDownsampled =
    new byte[w / _downsampleFactor * h / _downsampleFactor];
    _pixelDataGrayInt = new int[w / _downsampleFactor * h / _downsampleFactor];
    _wb = new WriteableBitmap(w / _downsampleFactor, w / _downsampleFactor);
    _lastUpdate = DateTime.Now;
    Utils.DownSample(cameraFrameEventArgs.ARGBData, w, h, ref _pixelDataGrayInt, _downsampleFactor);
    Utils.ARGBToGreyScale(_pixelDataGrayInt, ref _pixelDataGray);
    Utils.HistogramEqualization(ref _pixelDataGray);
    Utils.GrayToARGB(_pixelDataGray, ref _pixelDataGrayInt);
    List<FaceDetector.Rectangle> faces = new List<FaceDetector.Rectangle>();
    if (orientaciaObrazovky == PageOrientation.PortraitUp || orientaciaObrazovky == PageOrientation.PortraitDown)
    int scalw = w / _downsampleFactor;
    int scalh = h / _downsampleFactor;
    int[] _pixelDataGrayIntRotated = new int[scalw * scalh];
    for (int x = 0; x < scalw; x++)
    for (int y = 0; y < scalh; y++)
    _pixelDataGrayIntRotated[y + x * scalh] = _pixelDataGrayInt[x + y * scalw];
    faces = _detector.getFaces(
    _pixelDataGrayIntRotated,
    h / _downsampleFactor,
    w / _downsampleFactor,
    2f, 1.25f, 0.1f, 1, false, false); // height-width swapped
    else
    faces = _detector.getFaces(
    _pixelDataGrayInt,
    w / _downsampleFactor,
    h / _downsampleFactor,
    2f, 1.25f, 0.1f, 1, false, false);
    var elapsed = (DateTime.Now - _lastUpdate).TotalMilliseconds;
    _pixelDataGrayInt.CopyTo(_wb.Pixels, 0);
    _wb.Invalidate();
    Dispatcher.BeginInvoke(delegate()
    cnvsFaceRegions.Children.Clear();
    foreach (var r in faces)
    System.Windows.Shapes.Rectangle toAdd = new System.Windows.Shapes.Rectangle();
    TranslateTransform loc = new TranslateTransform();
    if (orientaciaObrazovky == PageOrientation.PortraitUp)
    loc.X = r.X * _downsampleFactor / (double)w * cnvsFaceRegions.ActualWidth;
    loc.Y = r.Y * _downsampleFactor / (double)w * cnvsFaceRegions.ActualHeight;
    point1 = r.X;
    point2 = r.Y;
    else if (orientaciaObrazovky == PageOrientation.PortraitDown)
    loc.X = r.X * _downsampleFactor / (double)w * cnvsFaceRegions.ActualWidth;
    loc.Y = r.Y * _downsampleFactor / (double)w * cnvsFaceRegions.ActualHeight;
    point1 = r.X;
    point2 = r.Y;
    else if (orientaciaObrazovky == PageOrientation.LandscapeLeft)
    loc.X = r.X * _downsampleFactor / (double)w * cnvsFaceRegions.ActualWidth - 50;
    loc.Y = r.Y * _downsampleFactor / (double)w * cnvsFaceRegions.ActualHeight + 90;
    point1 = r.X;
    point2 = r.Y;
    else if (orientaciaObrazovky == PageOrientation.LandscapeRight)
    loc.X = r.X * _downsampleFactor / (double)w * cnvsFaceRegions.ActualWidth+50 ;
    loc.Y = r.Y * _downsampleFactor / (double)w * cnvsFaceRegions.ActualHeight -90;
    point1 = r.X;
    point2 = r.Y;
    toAdd.RenderTransform = loc;
    toAdd.Width = r.Width * _downsampleFactor + 50;
    toAdd.Height = r.Height * _downsampleFactor + 50;
    toAdd.Stroke = new SolidColorBrush(Colors.Red);
    cnvsFaceRegions.Children.Add(toAdd);
    widthRectangle = toAdd.Width;
    heightRectangle = toAdd.Height;
    point1 = (loc.X);
    point2 = (loc.Y);
    protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
    base.OnNavigatedTo(e);
    cameraViewer.SaveToCameraRoll = true;
    cameraViewer.NewCameraFrame += NewCameraFrame;
    cameraViewer.StartPumpingFrames();
    CameraButtons.ShutterKeyHalfPressed += OnButtonHalfPress;
    CameraButtons.ShutterKeyPressed += OnButtonFullPress;
    CameraButtons.ShutterKeyReleased += OnButtonRelease;
    protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
    base.OnNavigatedFrom(e);
    cameraViewer.StopPumpingFrames();
    CameraButtons.ShutterKeyHalfPressed -= OnButtonHalfPress;
    CameraButtons.ShutterKeyPressed -= OnButtonFullPress;
    CameraButtons.ShutterKeyReleased -= OnButtonRelease;
    private void OnButtonHalfPress(object sender, EventArgs e)
    cameraViewer.NewCameraFrame -= NewCameraFrame;
    private void OnButtonFullPress(object sender, EventArgs e)
    SaveScreenShots();
    private void OnButtonRelease(object sender, EventArgs e)
    cameraViewer.NewCameraFrame += NewCameraFrame;
    private static WriteableBitmap CropImage(WriteableBitmap source, int xOffset, int yOffset, int width, int height)
    var sourceWidth = source.PixelWidth;
    var result = new WriteableBitmap(width, height);
    for (var x = 0; x <= height - 1; x++)
    var sourceIndex = xOffset + (yOffset + x) * sourceWidth;
    var destinationIndex = x * width;
    Array.Copy(source.Pixels, sourceIndex, result.Pixels, destinationIndex, width);
    return result;
    private void SaveScreenShots()
    string namePerson = PhoneApplicationService.Current.State["TextBoxValue"] as String;
    bool b = cnvsFaceRegions.Children.Any();
    cnvsFaceRegions.Children.Clear();
    if (!b)
    MessageBox.Show("No face detected ");
    else
    for (int j = 1; j <= pocet; j++)
    using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication())
    var bmp = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
    bmp.Render(this, null);
    byte[] bb = EncodeToJpeg(bmp);
    bmp.Invalidate();
    WriteableBitmap bmp2 = CropImage(bmp, (int)point1, (int)point2, (int)widthRectangle, (int)heightRectangle);
    using (var isoFileStream = isoStore.CreateFile(namePerson + j))
    System.Windows.Media.Imaging.Extensions.SaveJpeg(bmp2, isoFileStream, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
    isoFileStream.Close();
    MessageBox.Show("Saved successfully " + pocet + " images");
    cameraViewer.NewCameraFrame += NewCameraFrame;
    public byte[] EncodeToJpeg(WriteableBitmap wb)
    using (MemoryStream stream = new MemoryStream())
    wb.SaveJpeg(
    stream,
    wb.PixelWidth,
    wb.PixelHeight,
    0,
    85);
    return stream.ToArray();
    private void cameraViewer_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
    cameraViewer.NewCameraFrame -= NewCameraFrame;
    private void cameraViewer_MouseLeftButtonUp_1(object sender, MouseButtonEventArgs e)
    SaveScreenShots();
    private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
    NavigationService.Navigate(new Uri("/PersonAndGallery;component/Gallery.xaml", UriKind.Relative));
    CameraViewer.cs
    public class CameraFrameEventArgs : RoutedEventArgs
    public int[] ARGBData { get; set; }
    public static class AppGlobal
    public static bool isPortrait = true;
    public class CameraViewer : Grid
    #region Events
    public EventHandler<CameraFrameEventArgs> NewCameraFrame { get; set; }
    public EventHandler<ContentReadyEventArgs> NewCameraCaptureImage { get; set; }
    public EventHandler<CameraOperationCompletedEventArgs> CamInitialized { get; set; }
    #endregion
    #region Properties
    public int CameraWidth
    get { return _cameraWidth; }
    set { _cameraWidth = value; }
    public int CameraHeight
    get { return _cameraHeight; }
    set { _cameraHeight = value; }
    public bool PhotoOnPress
    get { return _photoOnPress; }
    set
    _photoOnPress = value;
    // CameraButtons.ShutterKeyPressed -= CameraButtonsOnShutterKeyPressed;
    if (_photoOnPress)
    // CameraButtons.ShutterKeyPressed += CameraButtonsOnShutterKeyPressed;
    public bool SaveToCameraRoll { get; set; }
    public PhotoCamera Camera
    get { return _camera; }
    public bool TakingPhoto
    get { return _takingPhoto; }
    #endregion
    #region Member Variables
    private PhotoCamera _camera; // the windows phone camera that takes the photos
    private int _cameraWidth = -1;
    private int _cameraHeight = -1;
    private Thread _pumpFramesThread;
    private static ManualResetEvent _pauseFramesEvent = new ManualResetEvent(true);
    private bool _takingPhoto;
    VideoBrush viewfinderBrush;
    private bool _photoOnPress;
    private SoundEffect _cameraShutterSound;
    private static ManualResetEvent _cameraCaptureEvent = new ManualResetEvent(true);
    private static ManualResetEvent _cameraInitializedEvent = new ManualResetEvent(false);
    private bool _pumpFrames;
    #endregion
    #region Constructor
    public CameraViewer()
    Unloaded += new RoutedEventHandler(OnUnloaded);
    PhotoOnPress = true;
    public override void OnApplyTemplate()
    base.OnApplyTemplate();
    #endregion
    #region Public methods
    public void StartPumpingFrames()
    _pauseFramesEvent = new ManualResetEvent(true);
    _cameraCaptureEvent = new ManualResetEvent(true);
    _cameraInitializedEvent = new ManualResetEvent(false);
    InitializeCamera();
    _pumpFrames = true;
    if (_pumpFramesThread == null)
    _pumpFramesThread = new Thread(PumpFrames);
    if (!_pumpFramesThread.IsAlive)
    _pumpFramesThread.Start();
    public void StopPumpingFrames()
    _pumpFrames = false;
    _pumpFramesThread = null;
    Camera.Dispose();
    public void TakePhoto()
    if (TakingPhoto)
    return;
    _cameraCaptureEvent.Reset();
    FrameworkDispatcher.Update();
    _cameraShutterSound.Play();
    _takingPhoto = true;
    Camera.CaptureImage();
    #endregion
    private void CameraButtonsOnShutterKeyPressed(object sender, EventArgs eventArgs)
    if (_photoOnPress && !TakingPhoto)
    _cameraCaptureEvent.WaitOne();
    TakePhoto();
    private void OnUnloaded(object sender, RoutedEventArgs e)
    _cameraInitializedEvent.Reset();
    public void InitializeCamera()
    _cameraInitializedEvent.Reset();
    // Check to see if the camera is available on the device.
    if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) ||
    (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true))
    // Initialize the default camera.
    _camera = new Microsoft.Devices.PhotoCamera();
    //Event is fired when the PhotoCamera object has been initialized
    Camera.Initialized +=
    new EventHandler<Microsoft.Devices.CameraOperationCompletedEventArgs>(CameraInitialized);
    Camera.CaptureImageAvailable += CameraOnCaptureImageAvailable;
    Camera.CaptureCompleted += CameraOnCaptureCompleted;
    //Set the VideoBrush source to the camera
    // var viewfinderBrush = new VideoBrush();
    viewfinderBrush = new VideoBrush();
    viewfinderBrush.Stretch = Stretch.Fill;
    viewfinderBrush.RelativeTransform = new CompositeTransform { CenterX = 0.5, CenterY = 0.5 };
    viewfinderBrush.SetSource(Camera);
    System.Windows.Shapes.Rectangle rect = new System.Windows.Shapes.Rectangle();
    rect.Fill = viewfinderBrush;
    this.Children.Add(rect);
    Stream stream = TitleContainer.OpenStream("models/shutter.wav");
    _cameraShutterSound = SoundEffect.FromStream(stream);
    // CameraButtons.ShutterKeyPressed -= CameraButtonsOnShutterKeyPressed;
    if (_photoOnPress)
    // CameraButtons.ShutterKeyPressed += CameraButtonsOnShutterKeyPressed;
    else
    // The camera is not supported on the device.
    MessageBox.Show(
    "Sorry, this sample requires a phone camera and no camera is detected. This application will not show any camera output.");
    private void CameraOnCaptureCompleted(object sender, CameraOperationCompletedEventArgs cameraOperationCompletedEventArgs)
    _cameraCaptureEvent.Set();
    _takingPhoto = false;
    private void CameraOnCaptureImageAvailable(object sender, ContentReadyEventArgs contentReadyEventArgs)
    if (SaveToCameraRoll)
    Dispatcher.BeginInvoke(() =>
    WriteableBitmap bitmap =
    CreateWriteableBitmap(contentReadyEventArgs.ImageStream,
    (int)Camera.Resolution.Width,
    (int)Camera.Resolution.Height);
    // SaveCapturedImage(bitmap);
    //TakeScreenShots();
    if (NewCameraCaptureImage != null)
    NewCameraCaptureImage.Invoke(this, contentReadyEventArgs);
    // Helper for CameraOnCaptureImageAvailable
    private void SaveCapturedImage(WriteableBitmap imageToSave)
    var stream = new MemoryStream();
    imageToSave.SaveJpeg(stream, imageToSave.PixelWidth, imageToSave.PixelHeight, 0, 100);
    //Take the stream back to its beginning because it will be read again
    //when saving to the library
    stream.Position = 0;
    var library = new MediaLibrary();
    string fileName = string.Format("{0:yyyy-MM-dd-HH-mm-ss}.jpg", DateTime.Now);
    library.SavePictureToCameraRoll(fileName, stream);
    //save to Save Photo
    Picture pic;
    private void TakeScreenShots()
    WriteableBitmap bmp = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
    bmp.Render(this, null);
    byte[] bb = EncodeToJpeg(bmp);
    bmp.Invalidate();
    MemoryStream mem = new MemoryStream();
    bmp.SaveJpeg(mem, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
    mem.Seek(0, System.IO.SeekOrigin.Begin);
    if (mem != null)
    MediaLibrary library = new MediaLibrary();
    try
    pic = library.SavePicture("Mask_" + Guid.NewGuid().ToString(), mem);
    MessageBox.Show("Your picture is now accessible through the Saved Picture album.", "Saved successfully.", MessageBoxButton.OK);
    catch (Exception ex)
    MessageBox.Show("Unable to save the photo." + ex);
    public byte[] EncodeToJpeg(WriteableBitmap wb)
    using (MemoryStream stream = new MemoryStream())
    wb.SaveJpeg(
    stream,
    wb.PixelWidth,
    wb.PixelHeight,
    0,
    85);
    return stream.ToArray();
    // Creates a WriteableBitmap from an imageStream
    private WriteableBitmap CreateWriteableBitmap(Stream imageStream, int width, int height)
    var bitmap = new WriteableBitmap(width, height);
    imageStream.Position = 0;
    bitmap.LoadJpeg(imageStream);
    return bitmap;
    private void CameraInitialized(object sender, CameraOperationCompletedEventArgs e)
    if (e.Succeeded)
    try
    // available resolutions are ordered based on number of pixels in each resolution
    CameraWidth = (int)Camera.PreviewResolution.Width;
    CameraHeight = (int)Camera.PreviewResolution.Height;
    if (CamInitialized != null)
    CamInitialized.Invoke(this, e);
    _cameraInitializedEvent.Set();
    _pauseFramesEvent.Set();
    catch (ObjectDisposedException)
    // If the camera was disposed, try initializing again
    private void PumpFrames()
    _cameraInitializedEvent.WaitOne();
    int[] pixels = new int[CameraWidth * CameraHeight];
    int numExceptions = 0;
    while (_pumpFrames)
    _pauseFramesEvent.WaitOne();
    _cameraCaptureEvent.WaitOne();
    _cameraInitializedEvent.WaitOne();
    try
    Camera.GetPreviewBufferArgb32(pixels);
    catch (Exception e)
    // If we get an exception try capturing again, do this up to 10 times
    if (numExceptions >= 10)
    throw e;
    numExceptions++;
    continue;
    numExceptions = 0;
    _pauseFramesEvent.Reset();
    Deployment.Current.Dispatcher.BeginInvoke(
    () =>
    if (NewCameraFrame != null && _pumpFrames)
    NewCameraFrame(this, new CameraFrameEventArgs { ARGBData = pixels });
    _pauseFramesEvent.Set();
    //na zmenu orientacie
    public void UpdateOrientation(PageOrientation orientation)
    if (orientation == PageOrientation.PortraitDown)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation = 270 };
    /* else if (orientation == PageOrientation.PortraitDown && cameraType == 2)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
    else if (orientation == PageOrientation.PortraitUp && cameraType == 2)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation = -90 };
    else if (orientation == PageOrientation.PortraitUp)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation =90 };
    else if (orientation == PageOrientation.LandscapeLeft)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation = 0 };
    else if (orientation == PageOrientation.LandscapeRight)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation = -180 };
    Thanks for reply.

    Hi Facko,
    Thanks for posting at the forum, however it could be really difficult for us to copy/paste your code and try to repro the issue, I would suggest you to provide a repro sample for us so that we can debug for you.
    And base on your description, looks like your app only crashes on the real device, but not on the emulator. I have question here, how the app works on the emulator?
    As I know if we open the camera on emulator, the only thing we can see is kind of small color blocks instead of the real images.
    You could also try to close the camera and then dispose the object to see if it works.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Why I left Windows Phone

    So yesterday I got my Samsung Galaxy S3. It is a great phone, but I felt kind of bummed out because the device I replaced was my HTC Trophy, a Windows phone. This ended my 1 year plus use of the Windows Phone OS and sent me back to Android once again. Why? There were a few reasons for this, I just wanted to name a few.
    1. Hardware - Anyone who jumped in on Windows Phone's only offering to Verizon customers at the time knew that the hardware was below par of most Android devices offered at the time. Lack of SD card and display made it a mediocre choice, but the new OS was intriguing enough to draw me in. I had an Xperia Play (another disappointing phone Sony)  and decided to trade it for my Trophy. Though the screen and camera were not on par with Sony's offering, I really wanted to give it a try. Being a Zune HD user made the transition pretty easy & the interface was beautiful. Again, hardware was lacking, but driven by an innovating OS. New hardware specs are pretty much on par with recent Android devices, but that cannot make up for....
    2. Software - I found my Trophy had a few hiccups once in a while. Nothing too bad, but apps would sometimes force close or not even open at all. There was a single upgrade that could not be done OTA, but had to be hooked up to Zune to download and install. This was not too much of a issue at first, but why no OTA over at least WiFi? It would come to be a non issue since the Trophy was the ******* child of Verizon, put in a room somewhere; forgotten about and left to just sit there with no updates whatsoever. After a while, I got frustrated and turned to XDA for custom builds. One was a 7.8 build which made the OS slightly more appealing, but still had OS issues with apps. Speaking of.....
    3. Apps & Marketplace - This was the major flaw with WP. No apps. Sure there were a few offerings, but nothing compared to iOS or Android. I know WP is newer to the market and had claimed a huge increase in apps, but from what I could see, nothing worth bragging about. One example was Draw Something. This game had come and gone, gone even further, and then was given life on WP, well sort of given life. It was buggy, crashed constantly, and finding someone to play with was hardly worth the effort. Other games like Mini Squadron and Final Fantasy ran perfect and provided a lot of entertainment. Oh, Physibricks was also a great one! Other apps were nothing more than web page conversions. The entire time I used my phone I only had good experiences with the Engadget app (when using 3G, WiFi was slower for some reason) and the Zune software, which was the best integrated music software ever imo. Songs loaded fast and the huge marketplace made it easy to get any song you wanted. This is the one feature I really loved about WP. I could be somewhere, hear a song, hit the search button and select music. Not only would it find the song, it would take me to the market to download it though my ZunePass. Spotify, Pandora, IHeartRadio, none of these services could hold a match to Zune Pass on WP. This is the only thing I will miss on Android, well, until Xbox music has it App up and running, and if it is as nice as its WP counterpart.
    Microsoft, you want to sell devices, then invest in the developers like you did with Xbox. You got Nokia which was an awesome start, but you knew the market you were getting into and knew what your competitors had out there. You should have gone in stronger than this. Offer developers 100% of their profits, 1 year of  Xbox music free with new device, $0.99 app submit fee, free development software, big incentives for developers to bring apps over from other OS's, $2.99 for Angry Birds?, bring more of your Xbox live titles to mobile,  and tap your home developers (XDA!) to see what you could do to bring customers. Start off big and work with handset developers and get their involvement. Its not too late to get things fixed, but to get me to come back to Windows phone and some others to leave iOS and Android, you need to get better fast or go the route of Kin.

    You are right, to each their own.
    I agree, the UI and the OS are good, but lacking in what is offered by the other two major OS's. Each one has their good and bad, but some more than others. You are right about low end options. I do like the 8X a lot, but after using other hardware besides HTC, I decided to give Samsung a try. The new WP8 hardware has started to look a lot more appealing, even in more ways than the normal Android offerings, but performance is still on par with what handset creators have been pushing on Android 6 months earlier.Dual Core processor, good GPU, MicroSD card slot, 4G, HD display. These are stats you could find in most Android devices a year ago. Now, does Windows phone need to surpass these stats? Not really, but its nice to have a somewhat future proof device that won't be obsolete 3-6 months after you get it with no chances of updating (WP7 users feel me on this). Microsoft set a standard HW requirement for WP7 and guess what, hardware manufactures stuck with it. Why? Because MS didn't allow a lot of the features that other phones had, weak strategy. Don't release behind the curve software if its not on par with your competition because you get behind the curve hardware to run it.
    Weak apps is a definite description I still stand by. MS made a huge deal about app requirements and efforts to get developers to create apps that fit well into the WP7 environment. I saw very little of this if any. Even top name apps are buggy at best (ESPN, CNN, LinkedIn). I've used these apps on iOS and Android and the quality far exceeds those on WP. I don't need a lot of apps, just ones that are useful and functional for my everyday personal and professional use. If I can't depend of developers of major apps to provide high quality apps for a high quality OS, then what is the use? I can tell you there were many productive apps on my Android phones that I could not find on WP. Now, this could be because of WP7/8 app compatibility, but could not be sure.
    Again, I wish I could had been more excited about WP8, but from my WP7 use, I could not trust entering into a 2 year contract with another unproven OS. I hope WP8 has majorly improved over its predecessor so I will be able to go back to a MS product, but until then, I'd feel better investing in a proven OS.

  • How to stream audio in Windows Phone 8.1?

    I have a Windows Phone Silverlight 8.0 app I want to update to 8.1 using WinRT. It streams audio in the background.  In Silverlight, I used
    BackgroundAudioPlayer to set the Track to a Uri.  It's not clear how to do this with
    MediaPlayer in WinRT.  I don't think I can just use a Uri.  Instead, I wonder if I have to use
    MediaPlayer.SetStreamSource(IRandomAccessStream
    stream).  If so, I don't know how to get an IRandomAccessStream from a
    Uri.  I want to stream from a Uri on the internet over HTTP, not from a local file. Any help?

    Refer following links to stream audio in background in Windows Phone 8.1 Runtime app.
    https://code.msdn.microsoft.com/windowsapps/Background-Audio-in-WinRT-344bcf4d
    http://blogs.msdn.com/b/johnkenn/archive/2013/12/31/supporting-background-audio-in-your-windows-8-1-app.aspx
    Thank you for thinking about my problem. I may be mistaken, but I think the above links refer to Windows 8 apps, not Windows
    Phone 8.1 apps. I'm under the impression that background audio is done differently in Windows Phone 8.1 from Windows 8. The
    Background Audio Overview for Windows Phone Store apps explains more. 
    It's a good overview, but does not explain how to play audio from a stream rather than a file.  That's what I'm stuck on.

Maybe you are looking for