CastingConnection CastingConnection CastingConnection CastingConnection Class

Definition

Represents a connection with a casting device.

public : sealed class CastingConnection : IClosable, ICastingConnectionpublic sealed class CastingConnection : IDisposable, ICastingConnectionPublic NotInheritable Class CastingConnection Implements IDisposable, ICastingConnection// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Get an instance of this class by calling CreateCastingConnection.

Properties

Device Device Device Device

Gets the casting device with which a connection has been made.

public : CastingDevice Device { get; }public CastingDevice Device { get; }Public ReadOnly Property Device As CastingDevice// You can use this property in JavaScript.

Source Source Source Source

Gets and sets the content source that is being casted through the connection to the casting device. The content can be set and changed at any time and doing so does not disconnect the connection.

public : CastingSource Source { get; set; }public CastingSource Source { get; set; }Public ReadWrite Property Source As CastingSource// You can use this property in JavaScript.
Value
CastingSource CastingSource CastingSource CastingSource

The content source that is being casted to the casting device.

State State State State

Gets the current state of the connection.

public : CastingConnectionState State { get; }public CastingConnectionState State { get; }Public ReadOnly Property State As CastingConnectionState// You can use this property in JavaScript.

Methods

Close() Close() Close() Close()

Closes the casting connection.

public : void Close()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.

DisconnectAsync() DisconnectAsync() DisconnectAsync() DisconnectAsync()

Terminates a casting connection. The content that was rendering remotely returns to the local element that you retrieved the casting source from.

public : IAsyncOperation<CastingConnectionErrorStatus> DisconnectAsync()public IAsyncOperation<CastingConnectionErrorStatus> DisconnectAsync()Public Function DisconnectAsync() As IAsyncOperation( Of CastingConnectionErrorStatus )// You can use this method in JavaScript.
Returns

Dispose() Dispose() Dispose() Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

This member is not implemented in C++void Dispose()Sub Disposevoid Dispose()

RequestStartCastingAsync(CastingSource) RequestStartCastingAsync(CastingSource) RequestStartCastingAsync(CastingSource) RequestStartCastingAsync(CastingSource)

Starts the process of casting to a casting device. When called, this method pairs the c sting device, if necessary, and verifies access to the casting device with the user. If the user denies the app access to the device, casting fails. Otherwise, a connection is established, and content is sent to the device. During this time, the connection state changes to connecting, then to connected. If a casting source is set, the state changes to rendering once playback begins.

public : IAsyncOperation<CastingConnectionErrorStatus> RequestStartCastingAsync(CastingSource value)public IAsyncOperation<CastingConnectionErrorStatus> RequestStartCastingAsync(CastingSource value)Public Function RequestStartCastingAsync(value As CastingSource) As IAsyncOperation( Of CastingConnectionErrorStatus )// You can use this method in JavaScript.
Parameters
value
CastingSource CastingSource CastingSource CastingSource

The content to be casted.

Returns

Remarks

This method must be called from the UI thread or an exception will be thrown. To dispatch the call to the UI thread from another thread, you can use CoreDispatcher.RunAsync.

Events

ErrorOccurred ErrorOccurred ErrorOccurred ErrorOccurred

Indicates an error occurred while attempting to make a casting connection.

public : event TypedEventHandler ErrorOccurred<CastingConnection,  CastingConnectionErrorOccurredEventArgs>public event TypedEventHandler ErrorOccurred<CastingConnection,  CastingConnectionErrorOccurredEventArgs>Public Event ErrorOccurred<CastingConnection,  CastingConnectionErrorOccurredEventArgs>// You can use this event in JavaScript.

StateChanged StateChanged StateChanged StateChanged

Indicates a change in the State property.

public : event TypedEventHandler StateChanged<CastingConnection,  object>public event TypedEventHandler StateChanged<CastingConnection,  object>Public Event StateChanged<CastingConnection,  object>// You can use this event in JavaScript.

See Also