Tobias Herzog
Tobias Herzog

Reputation: 55

MediaSource doesn't contain any method

I followed this tutorial: https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/media-playback-with-mediasource and copied following line:

mediaSource = MediaSource.CreateFromStorageFile(file);

But Visual Studio shows an error: "The type name 'CreateFromStoargeFile' does not exist in the type 'MediaSource'"

And MediaSource doesn't contain any Method/Property/... The IntelliSense poup doesn't even show.

enter image description here

enter image description here

I guess there is something wrong with Visual Studio or the UniversalWindowsPlatform core. I let Visual Studio repair itself but it doesn't work.

Edit: The metadata of MediaSource contains all methods though... enter image description here

Solution:

I put the new keyword in front of the MediaSource...

I am ashamed of myself...

Upvotes: 1

Views: 158

Answers (1)

Dakota Kronberger
Dakota Kronberger

Reputation: 119

From your screenshots, it looks like you are using the new keyword in front of your method call.

Try removing that.

Upvotes: 2

Related Questions