다음을 통해 공유


PlayToReceiver.StopAsync 메서드

정의

재생 명령 수신을 중지합니다.

public:
 virtual IAsyncAction ^ StopAsync() = StopAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction StopAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction StopAsync();
function stopAsync()
Public Function StopAsync () As IAsyncAction

반환

중지 작업이 완료되면 호출되는 비동기 처리기입니다.

특성

설명

소프트웨어 Play To 수신기를 만드는 예제는 미디어 캐스팅을 참조하세요.

if (receiver != null)
{
    await receiver.StopAsync();

    if (display != null)
        display.RequestRelease();

    // Remove Play To Receiver events
    receiver.CurrentTimeChangeRequested -= receiver_CurrentTimeChangeRequested;
    receiver.MuteChangeRequested -= receiver_MuteChangeRequested;
    receiver.PauseRequested -= receiver_PauseRequested;
    receiver.PlaybackRateChangeRequested -= receiver_PlaybackRateChangeRequested;
    receiver.PlayRequested -= receiver_PlayRequested;
    receiver.SourceChangeRequested -= receiver_SourceChangeRequested;
    receiver.StopRequested -= receiver_StopRequested;
    receiver.TimeUpdateRequested -= receiver_TimeUpdateRequested;
    receiver.VolumeChangeRequested -= receiver_VolumeChangeRequested;

    //  Remove MediaElement events
    VideoPlayer.Pause();

    VideoPlayer.CurrentStateChanged -= VideoPlayer_CurrentStateChanged;
    VideoPlayer.MediaEnded -= VideoPlayer_MediaEnded;
    VideoPlayer.MediaFailed -= VideoPlayer_MediaFailed;
    VideoPlayer.MediaOpened -= VideoPlayer_MediaOpened;
    VideoPlayer.RateChanged -= VideoPlayer_RateChanged;
    VideoPlayer.SeekCompleted -= VideoPlayer_SeekCompleted;
    VideoPlayer.VolumeChanged -= VideoPlayer_VolumeChanged;

    StatusTextBlock.Text = "Stopped '" + receiver.FriendlyName + "'.";
}
If receiver IsNot Nothing Then
    Await receiver.StopAsync()

    If display IsNot Nothing Then display.RequestRelease()

    ' Remove Play To Receiver events
    RemoveHandler receiver.CurrentTimeChangeRequested, AddressOf receiver_CurrentTimeChangeRequested
    RemoveHandler receiver.MuteChangeRequested, AddressOf receiver_MuteChangeRequested
    RemoveHandler receiver.PauseRequested, AddressOf receiver_PauseRequested
    RemoveHandler receiver.PlaybackRateChangeRequested, AddressOf receiver_PlaybackRateChangeRequested
    RemoveHandler receiver.PlayRequested, AddressOf receiver_PlayRequested
    RemoveHandler receiver.SourceChangeRequested, AddressOf receiver_SourceChangeRequested
    RemoveHandler receiver.StopRequested, AddressOf receiver_StopRequested
    RemoveHandler receiver.TimeUpdateRequested, AddressOf receiver_TimeUpdateRequested
    RemoveHandler receiver.VolumeChangeRequested, AddressOf receiver_VolumeChangeRequested

    '  Remove MediaElement events
    VideoPlayer.Pause()

    RemoveHandler VideoPlayer.CurrentStateChanged, AddressOf VideoPlayer_CurrentStateChanged
    RemoveHandler VideoPlayer.MediaEnded, AddressOf VideoPlayer_MediaEnded
    RemoveHandler VideoPlayer.MediaFailed, AddressOf VideoPlayer_MediaFailed
    RemoveHandler VideoPlayer.MediaOpened, AddressOf VideoPlayer_MediaOpened
    RemoveHandler VideoPlayer.RateChanged, AddressOf VideoPlayer_RateChanged
    RemoveHandler VideoPlayer.SeekCompleted, AddressOf VideoPlayer_SeekCompleted
    RemoveHandler VideoPlayer.VolumeChanged, AddressOf VideoPlayer_VolumeChanged

    StatusTextBlock.Text = "Stopped '" & receiver.FriendlyName & "'."
End If

적용 대상

추가 정보