RredCat
RredCat

Reputation: 5421

Wp7: works with camera in time of call

I want to create an application that will be using the phone's camera. The camera should run for a long time without interruption.
In which way can I manage phone calls?

For example, can I continue recording a video during a call, or should I just disable the possibility to make a call while filming?
If the second one is the correct solution, how can I do this?

Upvotes: 0

Views: 282

Answers (2)

vlad.strugaru
vlad.strugaru

Reputation: 86

I would stop recording during the call, as this would be a bad user experience and will uselessly drain the device battery.

Attach to the Obscured/UnObscured root frame events. When you will receive a phone call the app will be obscured (the call message box being in the foreground). Now is the time to dispose the camera and detach from the camera events.

When the UnObscured event is raised once the call is finished then you can restart the camera like this:

        VideoBrush videoBrush = new VideoBrush();

        // Check to see if the camera is available on the device.
        if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true))
        {

            // Otherwise, use standard camera on back of device.
            PhotoCamera camera = new Microsoft.Devices.PhotoCamera(CameraType.Primary);

            // Event is fired when the PhotoCamera object has been initialized.
            m_camera .Initialized += new EventHandler<Microsoft.Devices.CameraOperationCompletedEventArgs>(camera_Initialized);

            //Set the VideoBrush source to the camera.
            camera .SetSource(m_camera);
        }

And the event:

    void camera_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
    {
        if (e.Succeeded)
        {
                this.Dispatcher.BeginInvoke(delegate()
                {
                   //this makes sure that you can use the camera after tombstone
                });


            Debug.Writeline("The camera_Initialized" + e.Succeeded.ToString());
        }
    }

Also you need to attach yourself to other capture events: See below http://msdn.microsoft.com/en-us/library/hh202956%28v=VS.92%29.aspx

Upvotes: 1

RredCat
RredCat

Reputation: 5421

Unfortunately, there no way to work with camera in call time.
Moreover I can't to turn on fly mode by code.
Everything that I can do - it ask user to do it manually.
Looking for new update..

Upvotes: 0

Related Questions