MediaCapture.CaptureDeviceExclusiveControlStatusChanged 事件

定義

發生于擷取裝置的獨佔控制狀態變更時。

// 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) 

事件類型

Windows 需求

裝置系列
Windows 10 Creators Update (已於 10.0.15063.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v4.0 引進)
應用程式功能
backgroundMediaRecording

備註

當應用程式擁有擷取裝置的獨佔控制權時,它可以修改裝置的設定。 沒有擷取裝置獨佔控制權的應用程式仍然可以擷取媒體,但無法變更擷取設定。 將 MediaCaptureInitializationSettings.SharingMode 屬性設定為 ExclusiveControl ,再將結構傳遞至 InitializeAsync,以要求獨佔控制項。 如果您要求另一個應用程式具有裝置獨佔存取權時, InitializeAsync 的呼叫將會失敗。 在此情況下,您可以接聽 CaptureDeviceExclusiveControlStatusChanged,如果 MediaCaptureDeviceExclusiveControlStatusChangedEventArgs.StatusExclusiveControlAvailable,則可以嘗試使用獨佔控制項重新初始化 MediaCapture

如果 引發 CaptureDeviceExclusiveControlStatusChanged 事件,且 MediaCaptureDeviceExclusiveControlStatusChangedEventArgs.StatusSharedReadOnlyAvailable,則另一個應用程式已取得裝置的獨佔控制權。 在此情況下,您可能會想要更新 UI,以通知使用者另一個應用程式可能會調整擷取裝置設定。

適用於