Crash app windows phone 8 512mb ram

hi, my app have a problem. when i go to the page where i have an iframe/webview with a video, if i have a phone with 512 mb ram the app crash,  if i have 1gb or more the app work...where is the problem?

Hello,
What is the resolution and bitrate of the video? It is possible that the frame size of the video is greater than the available video memory causing the problem.
Also, do you know the exact hex error code that you are getting? The hex error code should look something like: 0x80004005. The hex error code can give us much more information about why the underlying crash is occurring.
Thanks,
James
Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

Similar Messages

  • Why hub sample app windows phone comment characters ò è à cause error ?

    why hub sample app windows phone comment characters ò è à  cause error in
    global::System.Diagnostics.Debugger.Break(); ?

    Hi Orgest,
    Do you add these characters "ò è à" in the SampleData.json file? If so as far as I known the SampleData.json is initially a simple ASCII text file, so if we want to use these special characters, we need to do something with the encoding,
    for the detailed information, please try to refer to the following similar thread:
    https://social.msdn.microsoft.com/Forums/windowsapps/en-US/4d829e96-29dc-4029-911b-f32a40ac01a3/polish-characters-in-sampledatajson-file?forum=wpdevelop
    If I have misunderstood you, please try to post a simple reproduce project in here.
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How do you add Silverlight to an exiating "Blank App (WIndows Phone)" project?

    I created a new Windows Phone project in VS, and I specified a template of "Blank App (Windows Phone)".
    I then added the following to App.xaml.cs:
    using System.IO.IsolatedStorage;
    I get an error with the squiggly red line underneath "IsolatedStorage" that says:
    The type or namespace named 'IsolatedStorage' does not exist in the namespace 'System.IO' (Are you missing an assembly reference?)
    If I create the project using the "Blank App (Windows Phone Silverlight)" then I do not get the error.
    This makes sense, as IsolatedSTorage is a Silverlight function.
    What I would like to know is how to "add" Silverlight to the first project so that the IsolatedStorage reference is valid.
    I assume I need to add a reference?

    You cannot. You can write a Windows Phone app as either a Silverlight app or a Runtime app, but you cannot add Silverlight to a Runtime app.
    To access app data in a Runtime app (and in a modern Silverlight apps: IsolatedStorage is a legacy API) you can use the Application Data and StorageFile API. See
    Accessing app data with the Windows Runtime and Managing app data for details.

  • Problem with SQLite in Universal App (Windows Phone part)

    Hello,
    I am using Universal Apps project because I want to move myself from Silverlight.
    In Silverlight type of Windows Phone project, it is very easy to work with SQLite either on 8.0 or 8.1.
    But I can't find a way to work with SQLite in Universal project. There is no IsolatedStorage to check if database exist, and if it does not exist, Application will put it in the IsolatedStorage.
    I always get message "No such table: kategorije" where "kategorije" is the name of one table in my database.
    I guess that Application can't find the database.
    Is there any tutorial (I have tried to find it) on how to use SQLite in Universal Apps with custom written querys?
    Development Technician, Microsoft Certified Professional

    Here's a link you can refer to : Using SQLite as local database with Universal Apps
    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

  • BT Wifi App Windows Phone

    The Wifi app is fine for use when I'm out and about but when I'm home it automatically connects to BT WiFi instead of my hub, I have to disconnect from BT WiFi and reconnect to the hub every time I pick up my phone. Is there any way of automatically connecting to the hub. I've uninstalled the app at the moment until this can be sorted out.

    Hi seagroaa,
    I'm glad you got that sorted, I've moved your other post on to this thread to keep it all in the one place.
    Cheers
    Neil
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • How to make backward compatibility of windows phone 8.1 app for windows phone 7?

    I developed windows phone 8.1 app which is in windows phone store. Now, i want to make this app compatible for windows 7 also. Is it possible, if yes then how?

    It may be that you are using non-backward compatible capabilities in your Windows Phone 8.1 app(s).
    Developers that want to develop for different OS's usually have platforms with the different OS's on them for developing applications so they work on each platform.
    I suppose you developed for Windows phone 8.1 rather than Windows phone 7. Therefore your app runs on a different framework than a Windows phone 7 has as well as probably newer hardware with greater capabilities.
    So you will probably need to purchase an older phone that came with Windows phone 7 in order to develop for. I couldn't find documentation like the last link below (App capabilities and hardware requirements for Windows Phone 8) for Windows phone 7
    from Microsoft but maybe you can.
    Windows Phone OS 7.1 - Developing a Windows Phone Application from Start to Finish
    Types of Applications
    The Windows Phone application platform provides two frameworks for developing applications:
    Silverlight
    The Silverlight framework supports event-driven, XAML-based application development.
    XNA
    The XNA Framework supports loop-based games.
    Silverlight and XNA can also be combined in a single application.
    The following table lists some of the criteria that you can use to determine whether you should use Silverlight or the XNA Framework for your Windows Phone application. With Windows Phone OS 7.1, you can combine Silverlight and XNA into one application. 
    For more information about Silverlight and XNA, see
    The Silverlight and XNA Frameworks for Windows Phone. For more information about the application platform, see
    Application Platform Overview for Windows Phone.
    What's New in Windows Phone 8.1
    Platform convergence with Windows Store apps
    Windows Phone 8.1 introduces an important change in the Windows Phone developer ecosystem. In this release, Windows Phone converges with the Windows Store apps platform into a single developer platform that runs the same types of apps—Windows Runtime apps.
    Platform convergence began in Windows Phone 8, which supports a small subset of Windows Runtime APIs, but which differs from Windows in many core areas. In Windows Phone 8.1, there’s so much more in common—a much larger API set, a similar app model
    and life cycle, a shared toolset, a common UI framework—Windows Phone and Windows Store app developer platforms truly have become one, single development platform.
    Of course there are still some small differences in behavior and supported features between Windows Phone and Windows Store apps. Some of these are the result of timing of the different product cycles, and they may not appear in future releases. Some differences
    are the result of the different natures of phones and computers, their sizes, and the way people use them. We encourage developers to think in terms of Windows app development—developing for a single Windows Runtime, but targeting two different platforms on
    phones and computers.
    Required Tools for Windows Phone Development
    App capabilities and hardware requirements for Windows Phone
    8
    La vida loca

  • VS2013 - I cannot deploy and debug windows phone 8.1 store app to windows phone device

    Hello, I create a project from C#-> Store Apps -> Windows Phone Apps, but  I cannot deploy my apps to my blue device. There was a error message show "Element not found". I can run the app from Blend, and found Blend package the app to Appx
    file. Is any method that we can deploy store app into windows phone blue device directly and how to debug it on VS 2013?

    Hi,
    Welcome to MSDN.
    I am afraid that this is not the proper forum for this issue, since this forum is to discuss and ask questions about the Visual Studio Debugging tools, Visual Studio Profiler tools, and Visual Studio Ultimate IntelliTrace.
    Since your issue needs professional windows phone knowledge, and there is dedicated forums for windows phone development issues
    Windows Phone Development forums, you could choose one of its sub forums depends on your issue like  Tools
    for Windows Phone development or  
    Developing for Windows Phone .
    In addition, I did a research, you could check whether the following links help.
    http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402565(v=vs.105).aspx
    http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402523(v=vs.105).aspx#BKMK_Runanddebug
    Thanks for your understanding.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I recently purchased a Nokia Lumia 1020 and I am unable to instal the Windows phone App.

    I keep getting this error message when I try to install the Windows App: Windows phone can't be installed on Mac HD becasue Mac OS X Version 10.7 or later is required. Under the About this Mac section it says it is: MAC OS X 10.6.8 but there there are no updates available. Any assisitance would be greatly appreciated. Thank you.

    10.6.8 is Snow Leopard. 10.7.x is Lion. You need to upgrade, at least, to Lion (or the current release, Mountain Lion) in order to use the software.
    You can purchase Lion (10.7.x) by calling Apple and getting a redemption code for the Mac App Store. If you want to upgrade to Mountain Lion, make sure that your MacBook Pro meets the minimum requirements -> http://support.apple.com/kb/ht5444 and, if so, you can purchase and download it directly from the Mac App Store.
    Good luck,
    Clinton

  • Windows Phone App for Mac,

    Want to sync my Nokia Lumia phone to my imac. Heard there is an app. can’t find in App Store though.

    https://itunes.apple.com/us/app/windows-phone/id415571499?mt=12

  • Crash app with link href

    app Windows phone 8.1 java script model hub
    if i insert a link href
    <a href "/page1.html">example</a>
    i go to the page1.html but if i insert a link href with an img or h1, h2,h3 ecc 
    <a href="/page2.html"><h1>cis</h1></a>
    tha app crash! why?
    http://1drv.ms/1Gqkeuq this is the app
    this is my home.js
    (function () {
    "use strict";
    var nav = WinJS.Navigation;
    var session = WinJS.Application.sessionState;
    var util = WinJS.Utilities;
    // Ottenere i gruppi utilizzati dalle sezioni associate a dati dell'hub.
    var section3Group = Data.resolveGroupReference("group4");
    var section3Items = Data.getItemsFromGroup(section3Group);
    WinJS.UI.Pages.define("/pages/hub/hub.html", {
    processed: function (element) {
    return WinJS.Resources.processAll(element);
    // La funzione viene chiamata quando un utente passa a questa pagina. Popola
    // gli elementi della pagina con i dati dell'applicazione.
    ready: function (element, options) {
    var hub = element.querySelector(".hub").winControl;
    hub.onheaderinvoked = function (args) {
    args.detail.section.onheaderinvoked(args);
    hub.onloadingstatechanged = function (args) {
    if (args.srcElement === hub.element && args.detail.loadingState === "complete") {
    hub.onloadingstatechanged = null;
    hub.element.focus();
    // TODO: inizializzare la pagina qui.
    WinJS.Utilities.query("a").listen("click", linkClickEventHandler, false); //Intersect the href and call the linkClickEventHandler function
    section3DataSource: section3Items.dataSource,
    section3ItemNavigate: util.markSupportedForProcessing(function (args) {
    var item = Data.getItemReference(section3Items.getAt(args.detail.itemIndex));
    nav.navigate("/pages/item/item.html", { item: item });
    unload: function () {
    // TODO: rispondere alle navigazioni all'esterno di questa pagina.
    updateLayout: function (element) {
    /// <param name="element" domElement="true" />
    // TODO: rispondere alle modifiche nel layout.
    function linkClickEventHandler(eventInfo) {
    // Prevent the navigation
    eventInfo.preventDefault();
    // Get the target page link
    var link = eventInfo.target;
    // Call the navigation function instead
    WinJS.Navigation.navigate(link.href);

    app Windows phone 8.1 java script model hub
    if i insert a link href (<a href "/page1.html">example</a> i go to the page1.html but if i insert a link href with an img or h1, h2,h3 ecc (<ahref="/page2.html"><h1>cis</h1></a>)
    tha app crash! why?
    this is my home.js
    (function () {
    "use strict";
    WinJS.UI.Pages.define("/pages/home/home.html", {
    // La funzione viene chiamata quando un utente passa a questa pagina. Popola
    // gli elementi della pagina con i dati dell'applicazione.
    ready: function (element, options) {
    WinJS.Utilities.query("a").listen("click", linkClickEventHandler, false); //Intersect the href and call the linkClickEventHandler function
    function linkClickEventHandler(eventInfo) {
    // Prevent the navigation
    eventInfo.preventDefault();
    // Get the target page link
    var link = eventInfo.target;
    // Call the navigation function instead
    WinJS.Navigation.navigate(link.href);

  • Voip application for windows phone 8.1 fails store submission

    A voip application with the new 8.1 architecture based on a separate process for the voip server is not accepted by the store.
    Voip architecture is based on 8.1 sample: https://code.msdn.microsoft.com/windowsapps/ChatterBox-VoIP-WP81-64921ad4
    Errors during submission:
    3011: The package is missing RpalManifest.xml. Update it and then try again.
    1028: The native API api-ms-win-core-processthreads-l1-1-2.dll:ExitProcess() isn’t allowed in assembly doubango.BackEndServerHost.exe. Update it and then try again.

    Update.  I am currently working with the sample team to update the sample.   We found the problem to be in the way the BackEndServerHost VIsual studio 
    project was created.   While we work on re-creating that from scratch, testing, and re-publishing I wanted to post what we have done so far in case anyone 
    wants to move forward.
    First there are a couple bugs in the sample, maybe you worked around those already in your development but in case not here they are.
    In the backendaudio.cpp BackEndCapture::InitCapture I changed the code:
    if (SUCCEEDED(hr))
    WAVEFORMATEX format = {};
    if (SUCCEEDED(hr))
    FillPcmFormat(format, m_pwfx->nChannels, m_pwfx->nSamplesPerSec, m_pwfx->wBitsPerSample);
    m_sourceFrameSizeInBytes = (format.wBitsPerSample / 8) * format.nChannels;
    hr = m_pDefaultCaptureDevice->Initialize(AUDCLNT_SHAREMODE_SHARED, 0x88140000, 1000 * 10000, 0, &format, NULL);
    The m_pwfx was already retrieved via GetMixFormat earlier, just use that.  Don’t create a custom one.
    In the BackEndAudio::Stop routine change the order of cleanup:
    if (m_pDefaultRenderDevice)
    m_pDefaultRenderDevice->Release();
    m_pDefaultRenderDevice = NULL;
    if (m_pDefaultCaptureDevice)
    m_pDefaultCaptureDevice->Release();
    m_pDefaultCaptureDevice = NULL;
    if (m_pCaptureClient)
    m_pCaptureClient->Release();
    m_pCaptureClient = NULL;
    The next step is to basically delete the BackEndServerHost project and create a new one with the following steps.
    1)  Add a new C++ Dirext X App (Windows Phone) to the solution and name it VoipBackendServerHost  NOTE: using "." in the name causes problems, so don't use the same name as the original sample.
    2)  Remove the Common and Content Folders
    3)  Remove App1Main.cpp and App1Main.h
    4)  Contents of app.cpp should be:
    #include "pch.h"
    #include "App.h"
    #include <windows.applicationmodel.core.h>
    #include <wrl.h>
    #include <string>
    #include <stdexcept>
    using namespace ABI::Windows::ApplicationModel::Core;
    using namespace ABI::Windows::Foundation;
    using namespace Microsoft::WRL;
    using namespace Wrappers;
    HRESULT __cdecl MyGetActivationFactory(_In_ HSTRING activatableClassId, _COM_Outptr_ IInspectable **factory);
    class GetCustomClass : public RuntimeClass<RuntimeClassFlags<RuntimeClassType::WinRtClassicComMix>,
    IGetActivationFactory,
    CloakedIid<IAgileObject >>
    public:
    IFACEMETHODIMP GetActivationFactory(_In_ HSTRING activatableClassId, _COM_Outptr_ IInspectable **factory)
    return MyGetActivationFactory(activatableClassId, factory);
    private:
    HMODULE m_hMod;
    [Platform::MTAThread]
    int main(Platform::Array<Platform::String^>^)
    HRESULT hr = Initialize(RO_INIT_MULTITHREADED);
    if (FAILED(hr))
    throw std::runtime_error(std::string("Failed to Initialize(RO_INIT_MULTITHREADED), HRESULT: ").append(std::to_string(hr)));
    // Scoping for smart pointers
    ComPtr<ICoreApplication> spApplicationFactory;
    hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), &spApplicationFactory);
    if (FAILED(hr))
    throw std::runtime_error(std::string("Failed to GetActivationFactory(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication), HRESULT: ").append(std::to_string(hr)));
    ComPtr<IGetActivationFactory> spGetActivationFactory = Make<GetCustomClass>();
    spApplicationFactory->RunWithActivationFactories(spGetActivationFactory.Get());
    Uninitialize();
     5) Right click and bring up Project properties.  go To Linker->Input.
     6) Set the Configuration and Platform dropdowns to change all configurations all platforms at the same time
     7) Choose Edit for Additional Dependencies and set to this:
    $(SolutionDir)$(PlatformTarget)\$(Configuration)\BackEnd\PhoneVoIPApp.BackEnd.lib
    WindowsPhoneCore.lib
    RuntimeObject.lib
     8) Under Cofniguration Properties->General Set the Target Name to PhoneVoIP.BackEnd.HostServer and Output directory to $(SolutionDir)UI
     9) APply the settings. Then click OK
    10) Build the Proxy Stub
    11) Build the Agents
    12) Build the new Project
    13) Expand the UI (Windows Phone Silverlight 8.1) Project and find the PhoneVoIP.BackEnd.HOstServer.exe and remove it.
    14) Right click UI and Choose Add Existing and add the PhoneVoIP.BackEnd.HostServer
    This should hopefully get you moving forward.  Please test and make sure your application is working. The end result should pass WACK now.  Please let me know if there are any issues.  It is a lot of steps and I hope I didn't miss any.
    Bret Bentzinger (MSFT) @awehellyeah

  • [WP8.1][C#]Why when I try to upload an Image with Windows Phone it uploads a random thing?

    I'm trying to upload an image from my Windows Store App (Windows Phone 8.1) to hosting (using PHP) but always when I "uploaded" the image, and I check its result the "image" it's a corrupted file. I think it's related to the byte array
    conversion but I haven't found another way to do it. This is my code:
    C# Code:
    byte[] ConvertBitmapToByteArray()
    WriteableBitmap bmp = bitmap;
    using (Stream stream = bmp.PixelBuffer.AsStream())
    MemoryStream memoryStream = new MemoryStream();
    stream.CopyTo(memoryStream);
    return memoryStream.ToArray();
    public async Task<string> Upload()
    try
    using (var client = new HttpClient())
    using (var content =
    new MultipartFormDataContent())
    byte[] data = ConvertBitmapToByteArray();
    content.Add(new StreamContent(new MemoryStream(data)), "userfile", fileNewImage);
    using (
    var message =
    await client.PostAsync("http://xplace.com/uploadtest.php", content))
    var input = await message.Content.ReadAsStringAsync();
    return input;
    catch (Exception ex)
    return null;
    PHP code:
    <?php
    header('Content-Type: application/json');
    $uploaddir = getcwd();
    $uploadfile = $uploaddir . "/" . basename($_FILES['userfile']['name']);
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo '{"result": "sucessfull"}';
    } else {
    echo '{"result": "-1"}';
    }?>
    I wish someone could give me an idea about what I my mistake and how to fix it. Thanks in advance for your worthy knowledge.
    Federico Navarrete

    This is the answer to the problem someone gave me an idea that I have missed to translate to BMP.
    byte[] ConvertBitmapToByteArray()
    WriteableBitmap bmp = bitmap;
    using (Stream stream = bmp.PixelBuffer.AsStream())
    MemoryStream memoryStream = new MemoryStream();
    stream.CopyTo(memoryStream);
    return memoryStream.ToArray();
    public async Task<string> Upload()
    try
    using (var client = new HttpClient())
    using (var content =
    new MultipartFormDataContent())
    byte[] data = ConvertBitmapToByteArray();
    using (var stream = new InMemoryRandomAccessStream())
    // encoder *outputs* to stream
    var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.BmpEncoderId, stream);
    // encoder's input is the bitmap's pixel data
    encoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Straight,
    (uint)bitmap.PixelWidth, (uint)bitmap.PixelHeight, 96, 96, data);
    await encoder.FlushAsync();
    content.Add(new StreamContent(stream.AsStream()), "userfile", fileNewImage);
    using (
    var message =
    await client.PostAsync("http://xplace.com/uploadtest.php", content))
    var input = await message.Content.ReadAsStringAsync();
    return input;
    catch (Exception ex)
    return null;
    Now I have a different problem that after I uploaded the Image to Azure, I cannot execute the PHP code this one:
    $uploaddir = getcwd();
    $uploadfile = $uploaddir . "/" . basename($_FILES['userfile']['name']);
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    chmod($uploadfile, 0755);
    $Test = new Display($_FILES['userfile']['name']);
    echo '{"result": "' . $Test->getNumber($_REQUEST['color'], false) . '"}';
    //unlink($uploadfile);
    } else {
    echo '{"result": "-1"}';
    I'd like to know what could be my bug because I don't understand why I can access from the URL, too to bit I cannot use it, maybe it's how I assigned the permissions but with or without the chmod, it
    doesn't change at all. I have even tried other hostings and the problem is the same when I enter to the File Manager, there are only my PHP files and it doesn't allow me to manage the image.
    Thanks for your worthy knowledge and experience.
    Federico Navarrete

  • Windows Phone camera App crash when switching to another page

    I am creating a Simple Face Detection App for Windows Phone in C#. I turn on my camera , everything works perfect and FaceDetector works too, but when I try to navigate to other page my App always crashes and I do not why. I tried to test my App in Windows
    Phone Emulator and here the navigation works. I also tried debug my App in real device, but there the method OnNavigatedFrom is never hit.
    FaceDetection.xaml.cs
    public partial class FaceDetection : PhoneApplicationPage
    #region member variables
    const string MODEL_FILE = "models/haarcascade_frontalface_alt.xml";
    FaceDetector.Detector _detector;
    int _downsampleFactor = 2;
    private byte[] _pixelDataGray;
    private byte[] _pixelDataDownsampled;
    private int[] _pixelDataGrayInt;
    private WriteableBitmap _wb;
    private DateTime _lastUpdate;
    public static int pocet = 5;
    double point1;
    double point2;
    double heightRectangle;
    double widthRectangle;
    #endregion
    public FaceDetection()
    InitializeComponent();
    _detector = new FaceDetector.Detector(XDocument.Load(MODEL_FILE));
    private void NewCameraFrame(object sender, CameraFrameEventArgs cameraFrameEventArgs)
    PageOrientation orientaciaObrazovky = ((PhoneApplicationFrame)Application.Current.RootVisual).Orientation;
    cameraViewer.UpdateOrientation(orientaciaObrazovky);
    var w = cameraViewer.CameraWidth;
    var h = cameraViewer.CameraHeight;
    if (_pixelDataGray == null || _pixelDataGray.Length != h * w)
    _pixelDataGray = new byte[w / _downsampleFactor * h / _downsampleFactor];
    _pixelDataDownsampled =
    new byte[w / _downsampleFactor * h / _downsampleFactor];
    _pixelDataGrayInt = new int[w / _downsampleFactor * h / _downsampleFactor];
    _wb = new WriteableBitmap(w / _downsampleFactor, w / _downsampleFactor);
    _lastUpdate = DateTime.Now;
    Utils.DownSample(cameraFrameEventArgs.ARGBData, w, h, ref _pixelDataGrayInt, _downsampleFactor);
    Utils.ARGBToGreyScale(_pixelDataGrayInt, ref _pixelDataGray);
    Utils.HistogramEqualization(ref _pixelDataGray);
    Utils.GrayToARGB(_pixelDataGray, ref _pixelDataGrayInt);
    List<FaceDetector.Rectangle> faces = new List<FaceDetector.Rectangle>();
    if (orientaciaObrazovky == PageOrientation.PortraitUp || orientaciaObrazovky == PageOrientation.PortraitDown)
    int scalw = w / _downsampleFactor;
    int scalh = h / _downsampleFactor;
    int[] _pixelDataGrayIntRotated = new int[scalw * scalh];
    for (int x = 0; x < scalw; x++)
    for (int y = 0; y < scalh; y++)
    _pixelDataGrayIntRotated[y + x * scalh] = _pixelDataGrayInt[x + y * scalw];
    faces = _detector.getFaces(
    _pixelDataGrayIntRotated,
    h / _downsampleFactor,
    w / _downsampleFactor,
    2f, 1.25f, 0.1f, 1, false, false); // height-width swapped
    else
    faces = _detector.getFaces(
    _pixelDataGrayInt,
    w / _downsampleFactor,
    h / _downsampleFactor,
    2f, 1.25f, 0.1f, 1, false, false);
    var elapsed = (DateTime.Now - _lastUpdate).TotalMilliseconds;
    _pixelDataGrayInt.CopyTo(_wb.Pixels, 0);
    _wb.Invalidate();
    Dispatcher.BeginInvoke(delegate()
    cnvsFaceRegions.Children.Clear();
    foreach (var r in faces)
    System.Windows.Shapes.Rectangle toAdd = new System.Windows.Shapes.Rectangle();
    TranslateTransform loc = new TranslateTransform();
    if (orientaciaObrazovky == PageOrientation.PortraitUp)
    loc.X = r.X * _downsampleFactor / (double)w * cnvsFaceRegions.ActualWidth;
    loc.Y = r.Y * _downsampleFactor / (double)w * cnvsFaceRegions.ActualHeight;
    point1 = r.X;
    point2 = r.Y;
    else if (orientaciaObrazovky == PageOrientation.PortraitDown)
    loc.X = r.X * _downsampleFactor / (double)w * cnvsFaceRegions.ActualWidth;
    loc.Y = r.Y * _downsampleFactor / (double)w * cnvsFaceRegions.ActualHeight;
    point1 = r.X;
    point2 = r.Y;
    else if (orientaciaObrazovky == PageOrientation.LandscapeLeft)
    loc.X = r.X * _downsampleFactor / (double)w * cnvsFaceRegions.ActualWidth - 50;
    loc.Y = r.Y * _downsampleFactor / (double)w * cnvsFaceRegions.ActualHeight + 90;
    point1 = r.X;
    point2 = r.Y;
    else if (orientaciaObrazovky == PageOrientation.LandscapeRight)
    loc.X = r.X * _downsampleFactor / (double)w * cnvsFaceRegions.ActualWidth+50 ;
    loc.Y = r.Y * _downsampleFactor / (double)w * cnvsFaceRegions.ActualHeight -90;
    point1 = r.X;
    point2 = r.Y;
    toAdd.RenderTransform = loc;
    toAdd.Width = r.Width * _downsampleFactor + 50;
    toAdd.Height = r.Height * _downsampleFactor + 50;
    toAdd.Stroke = new SolidColorBrush(Colors.Red);
    cnvsFaceRegions.Children.Add(toAdd);
    widthRectangle = toAdd.Width;
    heightRectangle = toAdd.Height;
    point1 = (loc.X);
    point2 = (loc.Y);
    protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
    base.OnNavigatedTo(e);
    cameraViewer.SaveToCameraRoll = true;
    cameraViewer.NewCameraFrame += NewCameraFrame;
    cameraViewer.StartPumpingFrames();
    CameraButtons.ShutterKeyHalfPressed += OnButtonHalfPress;
    CameraButtons.ShutterKeyPressed += OnButtonFullPress;
    CameraButtons.ShutterKeyReleased += OnButtonRelease;
    protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
    base.OnNavigatedFrom(e);
    cameraViewer.StopPumpingFrames();
    CameraButtons.ShutterKeyHalfPressed -= OnButtonHalfPress;
    CameraButtons.ShutterKeyPressed -= OnButtonFullPress;
    CameraButtons.ShutterKeyReleased -= OnButtonRelease;
    private void OnButtonHalfPress(object sender, EventArgs e)
    cameraViewer.NewCameraFrame -= NewCameraFrame;
    private void OnButtonFullPress(object sender, EventArgs e)
    SaveScreenShots();
    private void OnButtonRelease(object sender, EventArgs e)
    cameraViewer.NewCameraFrame += NewCameraFrame;
    private static WriteableBitmap CropImage(WriteableBitmap source, int xOffset, int yOffset, int width, int height)
    var sourceWidth = source.PixelWidth;
    var result = new WriteableBitmap(width, height);
    for (var x = 0; x <= height - 1; x++)
    var sourceIndex = xOffset + (yOffset + x) * sourceWidth;
    var destinationIndex = x * width;
    Array.Copy(source.Pixels, sourceIndex, result.Pixels, destinationIndex, width);
    return result;
    private void SaveScreenShots()
    string namePerson = PhoneApplicationService.Current.State["TextBoxValue"] as String;
    bool b = cnvsFaceRegions.Children.Any();
    cnvsFaceRegions.Children.Clear();
    if (!b)
    MessageBox.Show("No face detected ");
    else
    for (int j = 1; j <= pocet; j++)
    using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication())
    var bmp = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
    bmp.Render(this, null);
    byte[] bb = EncodeToJpeg(bmp);
    bmp.Invalidate();
    WriteableBitmap bmp2 = CropImage(bmp, (int)point1, (int)point2, (int)widthRectangle, (int)heightRectangle);
    using (var isoFileStream = isoStore.CreateFile(namePerson + j))
    System.Windows.Media.Imaging.Extensions.SaveJpeg(bmp2, isoFileStream, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
    isoFileStream.Close();
    MessageBox.Show("Saved successfully " + pocet + " images");
    cameraViewer.NewCameraFrame += NewCameraFrame;
    public byte[] EncodeToJpeg(WriteableBitmap wb)
    using (MemoryStream stream = new MemoryStream())
    wb.SaveJpeg(
    stream,
    wb.PixelWidth,
    wb.PixelHeight,
    0,
    85);
    return stream.ToArray();
    private void cameraViewer_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
    cameraViewer.NewCameraFrame -= NewCameraFrame;
    private void cameraViewer_MouseLeftButtonUp_1(object sender, MouseButtonEventArgs e)
    SaveScreenShots();
    private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
    NavigationService.Navigate(new Uri("/PersonAndGallery;component/Gallery.xaml", UriKind.Relative));
    CameraViewer.cs
    public class CameraFrameEventArgs : RoutedEventArgs
    public int[] ARGBData { get; set; }
    public static class AppGlobal
    public static bool isPortrait = true;
    public class CameraViewer : Grid
    #region Events
    public EventHandler<CameraFrameEventArgs> NewCameraFrame { get; set; }
    public EventHandler<ContentReadyEventArgs> NewCameraCaptureImage { get; set; }
    public EventHandler<CameraOperationCompletedEventArgs> CamInitialized { get; set; }
    #endregion
    #region Properties
    public int CameraWidth
    get { return _cameraWidth; }
    set { _cameraWidth = value; }
    public int CameraHeight
    get { return _cameraHeight; }
    set { _cameraHeight = value; }
    public bool PhotoOnPress
    get { return _photoOnPress; }
    set
    _photoOnPress = value;
    // CameraButtons.ShutterKeyPressed -= CameraButtonsOnShutterKeyPressed;
    if (_photoOnPress)
    // CameraButtons.ShutterKeyPressed += CameraButtonsOnShutterKeyPressed;
    public bool SaveToCameraRoll { get; set; }
    public PhotoCamera Camera
    get { return _camera; }
    public bool TakingPhoto
    get { return _takingPhoto; }
    #endregion
    #region Member Variables
    private PhotoCamera _camera; // the windows phone camera that takes the photos
    private int _cameraWidth = -1;
    private int _cameraHeight = -1;
    private Thread _pumpFramesThread;
    private static ManualResetEvent _pauseFramesEvent = new ManualResetEvent(true);
    private bool _takingPhoto;
    VideoBrush viewfinderBrush;
    private bool _photoOnPress;
    private SoundEffect _cameraShutterSound;
    private static ManualResetEvent _cameraCaptureEvent = new ManualResetEvent(true);
    private static ManualResetEvent _cameraInitializedEvent = new ManualResetEvent(false);
    private bool _pumpFrames;
    #endregion
    #region Constructor
    public CameraViewer()
    Unloaded += new RoutedEventHandler(OnUnloaded);
    PhotoOnPress = true;
    public override void OnApplyTemplate()
    base.OnApplyTemplate();
    #endregion
    #region Public methods
    public void StartPumpingFrames()
    _pauseFramesEvent = new ManualResetEvent(true);
    _cameraCaptureEvent = new ManualResetEvent(true);
    _cameraInitializedEvent = new ManualResetEvent(false);
    InitializeCamera();
    _pumpFrames = true;
    if (_pumpFramesThread == null)
    _pumpFramesThread = new Thread(PumpFrames);
    if (!_pumpFramesThread.IsAlive)
    _pumpFramesThread.Start();
    public void StopPumpingFrames()
    _pumpFrames = false;
    _pumpFramesThread = null;
    Camera.Dispose();
    public void TakePhoto()
    if (TakingPhoto)
    return;
    _cameraCaptureEvent.Reset();
    FrameworkDispatcher.Update();
    _cameraShutterSound.Play();
    _takingPhoto = true;
    Camera.CaptureImage();
    #endregion
    private void CameraButtonsOnShutterKeyPressed(object sender, EventArgs eventArgs)
    if (_photoOnPress && !TakingPhoto)
    _cameraCaptureEvent.WaitOne();
    TakePhoto();
    private void OnUnloaded(object sender, RoutedEventArgs e)
    _cameraInitializedEvent.Reset();
    public void InitializeCamera()
    _cameraInitializedEvent.Reset();
    // Check to see if the camera is available on the device.
    if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) ||
    (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true))
    // Initialize the default camera.
    _camera = new Microsoft.Devices.PhotoCamera();
    //Event is fired when the PhotoCamera object has been initialized
    Camera.Initialized +=
    new EventHandler<Microsoft.Devices.CameraOperationCompletedEventArgs>(CameraInitialized);
    Camera.CaptureImageAvailable += CameraOnCaptureImageAvailable;
    Camera.CaptureCompleted += CameraOnCaptureCompleted;
    //Set the VideoBrush source to the camera
    // var viewfinderBrush = new VideoBrush();
    viewfinderBrush = new VideoBrush();
    viewfinderBrush.Stretch = Stretch.Fill;
    viewfinderBrush.RelativeTransform = new CompositeTransform { CenterX = 0.5, CenterY = 0.5 };
    viewfinderBrush.SetSource(Camera);
    System.Windows.Shapes.Rectangle rect = new System.Windows.Shapes.Rectangle();
    rect.Fill = viewfinderBrush;
    this.Children.Add(rect);
    Stream stream = TitleContainer.OpenStream("models/shutter.wav");
    _cameraShutterSound = SoundEffect.FromStream(stream);
    // CameraButtons.ShutterKeyPressed -= CameraButtonsOnShutterKeyPressed;
    if (_photoOnPress)
    // CameraButtons.ShutterKeyPressed += CameraButtonsOnShutterKeyPressed;
    else
    // The camera is not supported on the device.
    MessageBox.Show(
    "Sorry, this sample requires a phone camera and no camera is detected. This application will not show any camera output.");
    private void CameraOnCaptureCompleted(object sender, CameraOperationCompletedEventArgs cameraOperationCompletedEventArgs)
    _cameraCaptureEvent.Set();
    _takingPhoto = false;
    private void CameraOnCaptureImageAvailable(object sender, ContentReadyEventArgs contentReadyEventArgs)
    if (SaveToCameraRoll)
    Dispatcher.BeginInvoke(() =>
    WriteableBitmap bitmap =
    CreateWriteableBitmap(contentReadyEventArgs.ImageStream,
    (int)Camera.Resolution.Width,
    (int)Camera.Resolution.Height);
    // SaveCapturedImage(bitmap);
    //TakeScreenShots();
    if (NewCameraCaptureImage != null)
    NewCameraCaptureImage.Invoke(this, contentReadyEventArgs);
    // Helper for CameraOnCaptureImageAvailable
    private void SaveCapturedImage(WriteableBitmap imageToSave)
    var stream = new MemoryStream();
    imageToSave.SaveJpeg(stream, imageToSave.PixelWidth, imageToSave.PixelHeight, 0, 100);
    //Take the stream back to its beginning because it will be read again
    //when saving to the library
    stream.Position = 0;
    var library = new MediaLibrary();
    string fileName = string.Format("{0:yyyy-MM-dd-HH-mm-ss}.jpg", DateTime.Now);
    library.SavePictureToCameraRoll(fileName, stream);
    //save to Save Photo
    Picture pic;
    private void TakeScreenShots()
    WriteableBitmap bmp = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
    bmp.Render(this, null);
    byte[] bb = EncodeToJpeg(bmp);
    bmp.Invalidate();
    MemoryStream mem = new MemoryStream();
    bmp.SaveJpeg(mem, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
    mem.Seek(0, System.IO.SeekOrigin.Begin);
    if (mem != null)
    MediaLibrary library = new MediaLibrary();
    try
    pic = library.SavePicture("Mask_" + Guid.NewGuid().ToString(), mem);
    MessageBox.Show("Your picture is now accessible through the Saved Picture album.", "Saved successfully.", MessageBoxButton.OK);
    catch (Exception ex)
    MessageBox.Show("Unable to save the photo." + ex);
    public byte[] EncodeToJpeg(WriteableBitmap wb)
    using (MemoryStream stream = new MemoryStream())
    wb.SaveJpeg(
    stream,
    wb.PixelWidth,
    wb.PixelHeight,
    0,
    85);
    return stream.ToArray();
    // Creates a WriteableBitmap from an imageStream
    private WriteableBitmap CreateWriteableBitmap(Stream imageStream, int width, int height)
    var bitmap = new WriteableBitmap(width, height);
    imageStream.Position = 0;
    bitmap.LoadJpeg(imageStream);
    return bitmap;
    private void CameraInitialized(object sender, CameraOperationCompletedEventArgs e)
    if (e.Succeeded)
    try
    // available resolutions are ordered based on number of pixels in each resolution
    CameraWidth = (int)Camera.PreviewResolution.Width;
    CameraHeight = (int)Camera.PreviewResolution.Height;
    if (CamInitialized != null)
    CamInitialized.Invoke(this, e);
    _cameraInitializedEvent.Set();
    _pauseFramesEvent.Set();
    catch (ObjectDisposedException)
    // If the camera was disposed, try initializing again
    private void PumpFrames()
    _cameraInitializedEvent.WaitOne();
    int[] pixels = new int[CameraWidth * CameraHeight];
    int numExceptions = 0;
    while (_pumpFrames)
    _pauseFramesEvent.WaitOne();
    _cameraCaptureEvent.WaitOne();
    _cameraInitializedEvent.WaitOne();
    try
    Camera.GetPreviewBufferArgb32(pixels);
    catch (Exception e)
    // If we get an exception try capturing again, do this up to 10 times
    if (numExceptions >= 10)
    throw e;
    numExceptions++;
    continue;
    numExceptions = 0;
    _pauseFramesEvent.Reset();
    Deployment.Current.Dispatcher.BeginInvoke(
    () =>
    if (NewCameraFrame != null && _pumpFrames)
    NewCameraFrame(this, new CameraFrameEventArgs { ARGBData = pixels });
    _pauseFramesEvent.Set();
    //na zmenu orientacie
    public void UpdateOrientation(PageOrientation orientation)
    if (orientation == PageOrientation.PortraitDown)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation = 270 };
    /* else if (orientation == PageOrientation.PortraitDown && cameraType == 2)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
    else if (orientation == PageOrientation.PortraitUp && cameraType == 2)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation = -90 };
    else if (orientation == PageOrientation.PortraitUp)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation =90 };
    else if (orientation == PageOrientation.LandscapeLeft)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation = 0 };
    else if (orientation == PageOrientation.LandscapeRight)
    viewfinderBrush.RelativeTransform =
    new CompositeTransform { CenterX = 0.5, CenterY = 0.5, Rotation = -180 };
    Thanks for reply.

    Hi Facko,
    Thanks for posting at the forum, however it could be really difficult for us to copy/paste your code and try to repro the issue, I would suggest you to provide a repro sample for us so that we can debug for you.
    And base on your description, looks like your app only crashes on the real device, but not on the emulator. I have question here, how the app works on the emulator?
    As I know if we open the camera on emulator, the only thing we can see is kind of small color blocks instead of the real images.
    You could also try to close the camera and then dispose the object to see if it works.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to stop Windows phone 8.1 app from crashing?

    Hi All,
    I have developed an app in Windows Phone 8.1 environment (WinRT). When i tested the app in my local testing device, it worked fine but when i hosted the app on app store, it sometimes crashes. Please help me, how do i stop my app from crashing?

    Sometimes crashes or always crashes when deployed through the store?
    If you want to rely on data instead of magic then check the crash reports as Abdul suggests. If you want magic then my crystal ball says that if it always crashes the app is trying to write to its install directory.
    The install directory is writable for test deployed apps but not for apps deployed from the store.

  • Spotify on Windows Phone - Crap App!

    Hey! Please update your spotify app on Windows Phone!!!It is almost not possible to use spotify on a Windows Phone... The lists are so slowly (also if the playlist is offline!!) !! Crashs all the time!!! This is not called Premium!! Give me the source code and i fix that crap app! Really angry about that!   

    Hello, You can check this post  https://community.spotify.com/t5/Help-Other-Partners-Windows/Spotify-on-Windows-Phone-8-1-has-become-practically-unusable/td-p/1178569 And see if it's your case, you will have more information on the Spotify support reaction.  Best regards

Maybe you are looking for

  • When I connect imac to network via airport all devices on the network lose internet connectivity

    Every device stays connected to the network but the internet stops working. Usually the network will continue to function normally for about five minutes when the imac connects, but then every device loses internet access via the network, NOT just th

  • I'm still screwed...

    I can't seem to do much at the moment with Linux. I have installed the full version of the OS, and logged into it using the root. I have already asked for help on this forum but as I really don't have a clue about Linux, I can't use the help I'm bein

  • Backup profile for Ecc 6.0

    Hi, How to take backup profile for Ecc 6.0 as i'm using Oracle Database 10g and windows server 2003 as my OS. Kindly help me out. Thnx in advance. Regards Promod

  • Recipe Management: Formula: Allocation of substance to a material

    Hi folks, I'm working with the recipe management. If I try to maintain the formula register "input and output" with a substance without a material allocation I'm getting an error that I have to allocate the substance to a material. How can I maintain

  • Lost my histogram edit screen in Aperture

    For some strange reason I no longer have the ability to edit the historgram in any of my photos in aperture and I have no idea why. I can't seem to find any command on the menu that I may have inadvertently turned off. Can anyone help getting back th