首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Windows.Media.Miracast

如何使用Windows.Media.Miracast
EN

Stack Overflow用户
提问于 2019-10-06 22:47:09
回答 1查看 532关注 0票数 1

我在Windows.Media.Miracast中找到了关于MiracastReceiver的文档。(https://docs.microsoft.com/en-us/uwp/api/windows.media.miracast)但是Windows.Media.Miracast中有太多的类和函数,可能要花很多时间才能理解这些类和接口。有没有开放源代码或示例代码?

非常感谢

EN

回答 1

Stack Overflow用户

发布于 2019-10-07 16:26:53

如果要转换媒体,请使用Windows.Media.Casting命名空间在远程设备上呈现媒体。包括向各种Miracast设备发送媒体。这是官方code sample。以下是示例代码。目前,我们还没有提供Windows.Media.Miracast的教程或代码示例。我会发邮件给相关团队讨论这个问题,如果我们有任何更新,我会在下面更新。

代码语言:javascript
复制
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());
    });
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58258386

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档