CastingConnection Class

Definition

Represents a connection with a casting device.

public ref class CastingConnection sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class CastingConnection final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class CastingConnection : System.IDisposable
Public NotInheritable Class CastingConnection
Implements IDisposable
Inheritance
Object Platform::Object IInspectable CastingConnection
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Get an instance of this class by calling CreateCastingConnection.

Properties

Device

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

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.

State

Gets the current state of the connection.

Methods

Close()

Closes the casting connection.

DisconnectAsync()

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

Dispose()

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

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.

Events

ErrorOccurred

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

StateChanged

Indicates a change in the State property.

Applies to

See also