Jaa


MediaCapture.CaptureDeviceExclusiveControlStatusChanged Event

Definition

Occurs when the exclusive control status of the capture device changes.

// Register
event_token CaptureDeviceExclusiveControlStatusChanged(TypedEventHandler<MediaCapture, MediaCaptureDeviceExclusiveControlStatusChangedEventArgs const&> const& handler) const;

// Revoke with event_token
void CaptureDeviceExclusiveControlStatusChanged(event_token const* cookie) const;

// Revoke with event_revoker
MediaCapture::CaptureDeviceExclusiveControlStatusChanged_revoker CaptureDeviceExclusiveControlStatusChanged(auto_revoke_t, TypedEventHandler<MediaCapture, MediaCaptureDeviceExclusiveControlStatusChangedEventArgs const&> const& handler) const;
public event TypedEventHandler<MediaCapture,MediaCaptureDeviceExclusiveControlStatusChangedEventArgs> CaptureDeviceExclusiveControlStatusChanged;
function onCaptureDeviceExclusiveControlStatusChanged(eventArgs) { /* Your code */ }
mediaCapture.addEventListener("capturedeviceexclusivecontrolstatuschanged", onCaptureDeviceExclusiveControlStatusChanged);
mediaCapture.removeEventListener("capturedeviceexclusivecontrolstatuschanged", onCaptureDeviceExclusiveControlStatusChanged);
- or -
mediaCapture.oncapturedeviceexclusivecontrolstatuschanged = onCaptureDeviceExclusiveControlStatusChanged;
Public Custom Event CaptureDeviceExclusiveControlStatusChanged As TypedEventHandler(Of MediaCapture, MediaCaptureDeviceExclusiveControlStatusChangedEventArgs) 

Event Type

Windows requirements

Device family
Windows 10 Creators Update (introduced in 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v4.0)
App capabilities
backgroundMediaRecording

Remarks

When an app has exclusive control of the capture device, it can modify the settings of the device. An app that does not have exclusive control of the capture device can still capture media, but it can't change the capture settings. Request exclusive control by setting the MediaCaptureInitializationSettings.SharingMode property to ExclusiveControl before passing the structure into InitializeAsync. The call to InitializeAsync will fail if you request exclusive control when another app already has exclusive access to the device. In this case, you can listen for CaptureDeviceExclusiveControlStatusChanged, and if the value of MediaCaptureDeviceExclusiveControlStatusChangedEventArgs.Status is ExclusiveControlAvailable, then you can attempt to reinitialize the MediaCapture with exclusive control.

If the CaptureDeviceExclusiveControlStatusChanged event is raised and the value of MediaCaptureDeviceExclusiveControlStatusChangedEventArgs.Status is SharedReadOnlyAvailable, then another app has acquired exclusive control of the device. In this case, you may want to update your UI to alert the user that another app may adjust the capture device settings.

Applies to