我在 Windows.Media.Miracast 中找到了有关 MiracastReceiver 的文档。(https://docs.microsoft.com/en-us/uwp/api/windows.media.miracast)但是 Windows.Media 中的类和函数太多.Miracast,可能要花很多时间去理解这些类和接口,有没有开源代码或者示例代码?
非常感谢您
我在 Windows.Media.Miracast 中找到了有关 MiracastReceiver 的文档。(https://docs.microsoft.com/en-us/uwp/api/windows.media.miracast)但是 Windows.Media 中的类和函数太多.Miracast,可能要花很多时间去理解这些类和接口,有没有开源代码或者示例代码?
非常感谢您
如果您想投射您的媒体,请使用Windows.Media.Casting
命名空间在远程设备上渲染媒体。涵盖将媒体发送到各种 Miracast 设备。这是官方代码示例。以下是示例代码。目前,我们还没有提供Windows.Media.Miracast
. 我会邮寄给相关团队讨论这个问题,如果我们有任何更新,我会在下面更新。
picker = new CastingDevicePicker();
//Set the picker to filter to video capable casting devices
picker.Filter.SupportsVideo = true;
//Hook up device selected event
picker.CastingDeviceSelected += Picker_CastingDeviceSelected;
private async void Picker_CastingDeviceSelected(CastingDevicePicker sender, CastingDeviceSelectedEventArgs args)
{
//Casting must occur from the UI thread. This dispatches the casting calls to the UI thread.
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
{
//Create a casting conneciton from our selected casting device
CastingConnection connection = args.SelectedCastingDevice.CreateCastingConnection();
//Hook up the casting events
connection.ErrorOccurred += Connection_ErrorOccurred;
connection.StateChanged += Connection_StateChanged;
//Cast the content loaded in the media element to the selected casting device
await connection.RequestStartCastingAsync(video.GetAsCastingSource());
});
}