2017-03-06 81 views
1

我跟着这个教程:https://docs.microsoft.com/en-us/windows/uwp/audio-video-camera/media-playback-with-mediasource并复制以下行:MediaSource的不包含任何方法

mediaSource = MediaSource.CreateFromStorageFile(file); 

但Visual Studio中显示了一个错误: “类型名称‘CreateFromStoargeFile’不存在的类型存在' MediaSource'“

MediaSource不包含任何方法/属性/ ... IntelliSense poup甚至没有显示。

enter image description here

enter image description here

我猜有什么错误与Visual Studio或UniversalWindowsPlatform核心。我让Visual Studio自行修复,但它不起作用。

编辑: MediaSource的的元数据包含了所有方法,但... enter image description here

解决方案:

我把new关键字在MediaSource面前......

我很惭愧自己...

+1

你有没有参考'Windows.Media.Core.dll'程序集?你有'使用Windows.Media.Core;'在你的类文件的顶部? –

回答

2

从您的屏幕截图中可以看出,您在方法调用前使用了new关键字。

尝试删除。

相关问题