1

i have the MediaElement and i want to play a video, as i know the only way of doing so is to set this item Source

mediaElement1.Source = new Uri(fileName);

but now i have the resources file which i wanna play but i cant do so because it doesnt have a path. so to make a long story short, i'm looking for a way to play video in the madiaElement from the resources file(without writing its byte first).

jeffm
  • 3,120
  • 1
  • 34
  • 57
Superzarzar
  • 509
  • 2
  • 8
  • 16

1 Answers1

6

From first line in the "Remarks" section of the MediaElement docs: "When distributing media with your application, you cannot use a media file as a project resource. In your project file, you must instead set the media type to Content and set CopyToOutputDirectory to PreserveNewest or Always."
So you can't play video from a resource. You can play a file attached to a project as content.
Some alternate ways described here..

Community
  • 1
  • 1
ridoy
  • 6,274
  • 2
  • 29
  • 60