PlayToReceiver.NotifyError 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
通知播放收件者顯示或播放媒體時發生錯誤。
public:
virtual void NotifyError() = NotifyError;
void NotifyError();
public void NotifyError();
function notifyError()
Public Sub NotifyError ()
備註
如需建立軟體播放收件者的範例,請參閱 媒體傳播。
void VideoPlayer_CurrentStateChanged(object sender, RoutedEventArgs e)
{
if (receiver != null)
{
switch (VideoPlayer.CurrentState)
{
case MediaElementState.Playing:
receiver.NotifyPlaying();
break;
case MediaElementState.Paused:
receiver.NotifyPaused();
break;
case MediaElementState.Stopped:
receiver.NotifyStopped();
break;
}
}
}
void VideoPlayer_MediaFailed(object sender, ExceptionRoutedEventArgs e)
{
if (receiver != null) { receiver.NotifyError(); }
}
Sub VideoPlayer_CurrentStateChanged()
If receiver IsNot Nothing Then
Select Case VideoPlayer.CurrentState
Case MediaElementState.Playing
receiver.NotifyPlaying()
Case MediaElementState.Paused
receiver.NotifyPaused()
Case MediaElementState.Stopped
receiver.NotifyStopped()
End Select
End If
End Sub
Sub VideoPlayer_MediaFailed()
If receiver IsNot Nothing Then receiver.NotifyError()
End Sub