winrt xaml - MediaCapture.CapturePhotoToStreamAsync() and MediaCapture.CapturePhotoToStorageFileAsync() throw Argument exception -
winrt xaml - MediaCapture.CapturePhotoToStreamAsync() and MediaCapture.CapturePhotoToStorageFileAsync() throw Argument exception -
i'm trying create app can utilize photographic camera windows phone 8.1, using windows rt/xaml development model.
when seek phone call either of capture methods off of mediacapture class argumentexception message "the parameter incorrect." here code
private async task initialize() { if (!designmode.designmodeenabled) { await _mediacapturemgr.initializeasync(); viewfinder.source = _mediacapturemgr; await _mediacapturemgr.startpreviewasync(); } } private async void viewfinder_ontapped(object sender, tappedroutedeventargs e) { imageencodingproperties imageproperties = imageencodingproperties.createjpeg(); var stream = new inmemoryrandomaccessstream(); await _mediacapturemgr.capturephototostreamasync(imageproperties, stream); _bitmap = new writeablebitmap((int) viewfinder.actualwidth, (int) viewfinder.actualheight); stream.seek(0); await _bitmap.setsourceasync(stream); previewimage.source = _bitmap; previewelements.visibility = visibility.visible; viewfinder.visibility = visibility.collapsed; buttons.visibility = visibility.visible; message.visibility = visibility.collapsed; stream.seek(0); var buffer = new global::windows.storage.streams.buffer((uint) stream.size); stream.readasync(buffer, (uint) stream.size, inputstreamoptions.none); datacontext = buffer.toarray(); if (photocaptured != null) photocaptured(this, null); }
the initialize method called on page load, , viewfinder_ontapped called when tap captureelement have in xaml. error thrown on
await _mediacapturemgr.capturephototostreamasync(imageproperties, stream);
what's bizarre downloaded latest source winrt xaml toolkit http://winrtxamltoolkit.codeplex.com/ , tried sample photographic camera app, uses similar code. throws same error on mediacapture.capturephototostoragefileasync(). can help me identify why?
winrt-xaml windows-phone-8.1 winrt-xaml-toolkit
Comments
Post a Comment