Windows Phone 8.1 Windows.Media.Capture API and Preview Frames

The Featured Discussion Board Post this week is Windows Phone 8.1 Windows.Media.Capture API and Preview Frames started by Oliver Ulm

Oliver finds it quite easy to access preview frames from the camera using the APIs from Windows Phone 8.0. On Windows Phone 8.1, he observes that it cannot be done the same way as in the previous version. He wants to know if there is any way to do this other than the only reference that he has been able to find.

Lee McPherson shares his experience of how he has gone about this by modifying one of the Media Foundation Transforms that exists in the Media Extensions sample for Universal Apps. He reiterates that he wants to share it on the Wiki. Yan Verdavaine refers to the Real Time Filter Demo code sample, which Lee finds to be a good solution.

We featured this discussion because it highlights ways to preview frames in Windows Phone 8.1.

See About Featured Discussion Board Posts for more information.

Keep those interesting questions coming!


Image view undesirably cropped

The Featured Discussion Board Post this week is Image view undesirably cropped started by m.findlay93

m.findlay93 is trying to implement an Image View within a page for a Windows Phone application, but when it is deployed, the image gets cropped. He states his problem and provides a screen grab of the issue faced.

Ratish Philip admits to facing the same problem. When he removes CacheMode=”BitmapCache”, the cropping goes away but the zoom and pan performance is affected. He suspects a size limit to the image and recommends taking a look at the PhotoPage.xaml in the FilterExplorer project on the Nokia Developer Github repository.

Lee McPherson confirms that the size limit does exist. In WP7 it is 2048x2048 and 4096x4096 in WP8. He suggests loading the image using DecodePixenHeight or DecodePixelWidth to reduce the resolution. The drawback of this approach is that one would lose some resolution on zooming. The alternate and cleaner solution would be to use the Nokia Imaging SDK and follow articles in the Wiki that explain how to display high resolution images.

This discussion was selected for featuring because it highlights how it is possible to work around API limitations by using Nokia Imaging SDK for high resolution pictures.

Keep those interesting questions coming!

Virtualizing + FlipView recycling issue

The Featured Discussion Board Post this week is Virtualizing +FlipView recycling problem started by Lee McPherson

Lee is trying to get a preview of a list of images from a zip or rar archive that contains jpeg files from a Windows Phone application. He is facing a problem with the virtualization from the VirtualizingStackPanel inside the FlipView. The pictures show fine the first times but on repeated flips, they seem to show up out of order.

With further investigations, Lee is able to narrow the problem to the internal scrollviewer snapping in the VirtualizingStackPanel. Even replacing the FlipView with an ItemsControl does not help. Lee works around this issue which shows only in WP8, while it works fine in WinRT and 8.1.

Lee credits this workaround to countering some memory management issues. Oliver Ulm expresses curiosity regarding this, to which Lee explains that it was an issue in WP8 with disposing of BitmapImage. This memory was not set free immediately, even when set to null or when GC.Collect was called, which resulted in memory issues when several large images were loaded and unloaded in quick succession. Lee used the workaround to set the source of an already opened BitmapImage with a 1×1 pixel png file to force the major chunk of memory release.

This discussion was selected for featuring because it highlights how innovative ideas lead to overcoming difficult situations when developing apps.

Keep those interesting questions coming!

Handling animated gif files

The Featured Discussion Board Post this week is GifRenderer ArgumentException: Value does not fall within the expected range started by Mr Wolf PST.

Mr Wolf PST is trying to generate and share an animated GIF, using a list of PNG images stored in the local storage of a Windows Phone 8.0 app. He is getting an exception: GifRenderer ArgumentException: Value does not fall within the expected range.

A lengthy discussion follows between him and Nokia Developer Champion Oliver Ulm. Mr Wolf PST realizes that Nuget had linked the WinRT version of the library to his project. But the second part of the problem remained: Mr Wolf PST wanted to save these files in the MediaLibrary, which is possible in Windows Phone 8.1. Oliver suggests a workaround where he could save one frame to the library while saving the GIF to local storage (IsolatedStorage). When the user opens the image through the Rich Media Extensibility, it would open a page that contains the WebView, which links to the local image. This is an acceptable solution for Mr Wolf PST.

We decided to feature this discussion because it affirms how a good discussion leads to a good workable solution within the given boundaries.

Keep those interesting questions coming!


Link to Nokia X App (Featured Discussion)

The Featured Discussion Board Post this week is Link to Nokia X app started by Wall-E.  This discussion was posted on Stack Overflow, which is the official support forum for Nokia X related queries.

Wall-E is porting their Android app to Nokia X and would like to link to the apps that they have in the store.  They were not able to find guidance on how to do this. Wall-E is looking for an equivalent of amzn://apps/android, which works for the Amazon store.

Tasomaniac confirms that such deep linking to the store is provided on the Nokia X platform, and provides him additional resources on the Nokia Developer Wiki. Tasomaniac also cautions that the solution might not work on the Emulator but it certainly would work on a real device.

Note that if one does not possess a device to test features that do not work on emulators, one could always test them on using Remote Device access: a service that allows developers to test their mobile applications and services remotely on various Nokia devices including Windows Phone, Nokia X, Asha, Series 40 and more.

Keep those interesting questions coming!

See About Featured Discussion Board Posts for more information.

Acquire IMEI for Nokia X

The Featured Discussion Board Post this week is Acquire IMEI for Nokia X started by myrth.

Myrth has a query regarding the Nokia X, which is a dual SIM card device. He wants to know if it would have two different International Mobile Station Equipment Identity (IMEI) as a result of the TelephonyManager.getDeviceId call. myrth also wants to know if the Nokia X platform offers a way to retrieve both device IMEIs.

Symbianyucca confirms that Nokia X is like two separate ‘phones’, and thus there are indeed two IMEI numbers, one for each ‘phone’.  He adds that Nokia X does not offer any specific APIs for retrieving both the IMEIs. Myrth, after some tests, concludes that Nokia X indeed has two different IMEI numbers which can be accessed through TelephonyManager::getDeviceId. He finds that this call is available via reflection, and that the result does change depending on which SIM slot is currently active.

Keep those interesting questions coming!

See About Featured Discussion Board Posts for more information.

Creating CustomEffects in C++

The Featured Discussion Board Post this week is Creating CustomEffects in C++ started by leemcpherson.

Lee is attempting to convert one of his custom effects from a Managed language like C# to a more native language C++ for the Nokia Imaging SDK by following a Wiki article by SB Dev. While Lee’s C# version works fine, the C++ version throws a NullReferenceException.

In the course of discussion Lee and SBDev confirm that the original code in the wiki throws the same exception. Yan_ feels that since Lee gives CustomFilter directly to DelegateFiltering, there might be some unmanaged resources creating de-allocation issues. The allocated buffer is de-allocated when the garbage collector frees it, but that is not happening in this case. Hence manually freeing the resources might help. This suggestion worked for Lee.

This discussion was featured to highlight tricks for memory management when a large amount of memory is instantiated.

Keep those interesting questions coming!

See About Featured Discussion Board Posts for more information.