Wp7:在通话时配合摄像头工作



我想创建一个应用程序,将使用手机的相机。相机应长时间不间断运行。
我怎样才能管理电话呢?

例如,我可以在通话期间继续录制视频,还是应该在拍摄时禁用打电话?
如果第二个是正确的解,我怎么做呢?

我会在通话过程中停止录音,因为这将是一个糟糕的用户体验,并且会无用地消耗设备电池。

附加到遮挡/未遮挡根帧事件。当你接到电话时,应用程序将被遮挡(呼叫信息框在前台)。现在是处理相机和从相机事件分离的时候了。

当调用结束后引发unscered事件时,您可以像这样重新启动相机:

        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);
        }

和事件:

    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());
        }
    }

还需要将自己附加到其他捕获事件:见下文http://msdn.microsoft.com/en-us/library/hh202956%28v=VS.92%29.aspx

不幸的是,没有办法在通话时间使用相机。
而且我不能通过代码打开飞行模式。
我所能做的一切都要求用户手动完成。
寻找新的更新…

最新更新