PlayToReceiver.SourceChangeRequested 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当“播放到”接收器的源媒体发生更改时发生。
// Register
event_token SourceChangeRequested(TypedEventHandler<PlayToReceiver, SourceChangeRequestedEventArgs const&> const& handler) const;
// Revoke with event_token
void SourceChangeRequested(event_token const* cookie) const;
// Revoke with event_revoker
PlayToReceiver::SourceChangeRequested_revoker SourceChangeRequested(auto_revoke_t, TypedEventHandler<PlayToReceiver, SourceChangeRequestedEventArgs const&> const& handler) const;
public event TypedEventHandler<PlayToReceiver,SourceChangeRequestedEventArgs> SourceChangeRequested;
function onSourceChangeRequested(eventArgs) { /* Your code */ }
playToReceiver.addEventListener("sourcechangerequested", onSourceChangeRequested);
playToReceiver.removeEventListener("sourcechangerequested", onSourceChangeRequested);
- or -
playToReceiver.onsourcechangerequested = onSourceChangeRequested;
Public Custom Event SourceChangeRequested As TypedEventHandler(Of PlayToReceiver, SourceChangeRequestedEventArgs)
事件类型
注解
有关创建软件“播放到”接收器的示例,请参阅 媒体转换。
async void receiver_SourceChangeRequested(
Windows.Media.PlayTo.PlayToReceiver sender,
Windows.Media.PlayTo.SourceChangeRequestedEventArgs args)
{
if (args.Stream != null)
await dispatcher.RunAsync(
Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
var stream = args.Stream as Windows.Storage.Streams.IRandomAccessStream;
VideoPlayer.SetSource(stream, args.Stream.ContentType);
});
}
Async Sub receiver_SourceChangeRequested(
sender As Windows.Media.PlayTo.PlayToReceiver,
args As Windows.Media.PlayTo.SourceChangeRequestedEventArgs)
If args.Stream IsNot Nothing Then
Await Dispatcher.RunAsync(
Windows.UI.Core.CoreDispatcherPriority.Normal,
Sub()
Dim stream = TryCast(args.Stream, Windows.Storage.Streams.IRandomAccessStream)
VideoPlayer.SetSource(stream, args.Stream.ContentType)
End Sub)
End If
End Sub