Camera on windows phone in unity take screenshot stuck

0

When I want to take a screenshot I create in Start once a new camera WebCamTexture wct=new WebCamTexture(requestedWidth, requestedHeight, requestedFPS) and play wct.Play();. Next step in my application I create a method where call a courutine and take screenshot. In this method I take screen size ( width and height ), texture2D. After I encode image to png/jpg used a plugin to open internal storage on windows phone and save my screenshot in Pictures . After we save image UI storage will closing and my app returns from memory but stuck, freeze my application why?

I try some trick to stop camera after encode image wct.Stop(); and after five seconds starts again my webcam but when I go to another view and return to X view where I made screenshot I receive some error :

Error: Operation failed has failed with error 0x8007000e. Not enought storage is available to complete this operation.

I think this error came because from GPU or memory but I'm not sure.

Any advice how to do that without problems: take screenshot->save internal storage(windows phone with unity) returns in my application.

Save file, in my case an imagebyte[] bytes = image.EncodeToPNG();, image is a Texture2D.

 WSANativeFilePicker.PickSaveFile("Save", ".png", fileName, WSAPickerLocationId.PicturesLibrary, new List<KeyValuePair<string, IList<string>>>() { new KeyValuePair<string, IList<string>>("Image Files", new List<string>() { ".png" }) }, (response) =>
        {
            if (response != null)
            {
                response.WriteBytes(bytes);
            }
        });

Plugin use to save to internal storage from Unity3d to windows phone. Link

c#
memory
unity3d
camera
windows-phone
asked on Stack Overflow Sep 21, 2016 by Ciprian Jijie • edited Sep 22, 2016 by Ciprian Jijie

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0