locked
Is it possible to test Camra related event on simulator without having web cam with PC in metro style apps?

    General discussion

  • In windows phone 7 I was able to use camera on simulator without having webcam attached with my PC. But here in metro style apps I am unable to do it on simulator. I already allowed to use cam in manifest of project.  

    my code as follows.

     private void imgCapture_Tapped_1(object sender, TappedRoutedEventArgs e)
            {
    
                StackPanel stp = new StackPanel();
                stp.Margin = new Thickness(300, 300, 0, 0);
                SolidColorBrush bg = new SolidColorBrush();
                bg.Color = Colors.Beige;
                stp.Background = bg;
                stp.Height = 280;
                stp.Width = 200;
                Button btnTakePhote = new Button();
                btnTakePhote.Width = 100;
                btnTakePhote.Height = 60;
                btnTakePhote.Margin = new Thickness(10,210,0,0);
                btnTakePhote.Tapped+=btnTakePhote_Tapped;
                CaptureElement ce = new CaptureElement();
                ce.Width = 200;
                ce.Height = 200;
                stp.Children.Add(ce);
                stp.Children.Add(btnTakePhote);
                Image imgCapturedImage = new Image();
                imgCapturedImage.Width = 200;
                imgCapturedImage.Height = 200;
                imgCapturedImage.Margin = new Thickness(0, 0, 0, 0);
                InkCanvas.Children.Add(stp);
                MediaCaptureMethod(ce);
    
            }
    
    
    
     async private void MediaCaptureMethod(CaptureElement ce)
            {
                try
                {
    
                    mediaCaptureMgr = new Windows.Media.Capture.MediaCapture();
                    //MediaCaptureInitializationSettings settings = new MediaCaptureInitializationSettings();
                    //settings.PhotoCaptureSource=PhotoCaptureSource.Photo;
                    await mediaCaptureMgr.InitializeAsync( );  //this line gives exception
    
                    ce.Source = mediaCaptureMgr;
    
                    await mediaCaptureMgr.StartPreviewAsync();
    
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
    
            }

    line :
    mediaCaptureMgr.InitializeAsync given the exception: RESULT: 0xC00DABE0


    Wednesday, August 22, 2012 1:10 PM

All replies

  • In windows phone 7 I was able to use camera on simulator without having webcam attached with my PC. But here in metro style apps I am unable to do it on simulator. I already allowed to use cam in manifest of project.  

    my code as follows.

     private void imgCapture_Tapped_1(object sender, TappedRoutedEventArgs e)
            {
    
                StackPanel stp = new StackPanel();
                stp.Margin = new Thickness(300, 300, 0, 0);
                SolidColorBrush bg = new SolidColorBrush();
                bg.Color = Colors.Beige;
                stp.Background = bg;
                stp.Height = 280;
                stp.Width = 200;
                Button btnTakePhote = new Button();
                btnTakePhote.Width = 100;
                btnTakePhote.Height = 60;
                btnTakePhote.Margin = new Thickness(10,210,0,0);
                btnTakePhote.Tapped+=btnTakePhote_Tapped;
                CaptureElement ce = new CaptureElement();
                ce.Width = 200;
                ce.Height = 200;
                stp.Children.Add(ce);
                stp.Children.Add(btnTakePhote);
                Image imgCapturedImage = new Image();
                imgCapturedImage.Width = 200;
                imgCapturedImage.Height = 200;
                imgCapturedImage.Margin = new Thickness(0, 0, 0, 0);
                InkCanvas.Children.Add(stp);
                MediaCaptureMethod(ce);
    
            }
    
    
    
     async private void MediaCaptureMethod(CaptureElement ce)
            {
                try
                {
    
                    mediaCaptureMgr = new Windows.Media.Capture.MediaCapture();
                    //MediaCaptureInitializationSettings settings = new MediaCaptureInitializationSettings();
                    //settings.PhotoCaptureSource=PhotoCaptureSource.Photo;
                    await mediaCaptureMgr.InitializeAsync( );  //this line gives exception
    
                    ce.Source = mediaCaptureMgr;
    
                    await mediaCaptureMgr.StartPreviewAsync();
    
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
    
            }

    line : mediaCaptureMgr.InitializeAsync given the exception: RESULT: 0xC00DABE0

    If I need to do with only audio recorder and player, is it necessary to attach webcam and microphone both. I got solution somewhere that resolved the issues only by changing the constructor mediaCaptureMgr.InitializeAsync to mediaCaptureMgr.InitializeAsync (settings) but this also gives the same exception. I don't have webcam attached with PC I have only microphone.

    please help!



    Thursday, August 23, 2012 9:27 AM
  • Same problem. Please reply 
    Thursday, November 08, 2012 11:58 AM