简体   繁体   中英

Windows Phone Universal App MediaCapture alternatives

I have a big problem with Universal App's MediaCapture . In this link I found that the problem might be the update installed on the phone which goes in conflict with this class.

I tryed some phones and all phones with Windows phone 8.1 Update crushes on MediaCapture initializing. No errors, just the phone quits the app.

In this article they said that it is due to a bug which closes the camera stopping the application.

Now, my problem is to find an alternative to MediaCapture , because half phones I need are with update 1 and half with update2 and I can't develop the app only for half customers.

Does any of you knows an alternative class?

PS: phones where app crushes have this update: 8.10.14219.341

Thanks all and sorry for my not perfect english.

Have you looked into using CameraCaptureTask instead? It can be as simple as this:

CameraCaptureTask cameraCaptureTask;
cameraCaptureTask = new CameraCaptureTask();
cameraCaptureTask.Completed += new EventHandler<PhotoResult>(cameraCaptureTask_Completed);

cameraCaptureTask.Show();

And then this is what you can do when the user is done capturing:

void cameraCaptureTask_Completed(object sender, PhotoResult e)
{
    if (e.TaskResult == TaskResult.OK)
    {
        MessageBox.Show(e.ChosenPhoto.Length.ToString());

        //Code to display the photo on the page in an image control named myImage.        
        System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
        bmp.SetSource(e.ChosenPhoto);
        myImage.Source = bmp;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM