0

I get url form vimeo and i want to play on MediaElement but I have problem like this.

var FullVimeoUrl = "https://pdlvimeocdn-a.akamaihd.net/36507/517/262124023.mp4?token2=1428493810_25ff23eaeb9489b76649aaaf3e7fa438&aksessionid=028dcbd66a5e2a5a"

mediaElement.Source = new Uri(FullVimeoUrl.ToString(), UriKind.RelativeOrAbsolute);
mediaElement.Play();

Problem:

An exception of type 'System.NullReferenceException' occurred in PresentationCore.dll but was not handled in user code

Additional information: Object reference not set to an instance of an object. Please help and solution for me thank.

NorthCat
  • 8,315
  • 16
  • 40
  • 45
Pheaktra Ty
  • 308
  • 3
  • 7
  • 2
    Related: [What is a `NullReferenceException` and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Soner Gönül Apr 08 '15 at 11:49
  • 1
    For future readers: this particular error is caused by bug in wpf media element which prevents it from playing http**s** urls. Change url to http and it will work. – Evk Jul 06 '17 at 14:27
  • @Evk thank you! I think it is the answer. – Cihan Yakar May 15 '19 at 11:22
  • FYI now that WPF is open sourced, I logged a bug and planning on fixing this soon: https://github.com/dotnet/wpf/issues/722 – dotMorten May 24 '19 at 04:35

1 Answers1

0

Your problem is caused by your invalid URL:

https://pdlvimeocdn-a.akamaihd.net/36507/517/262124023.mp4?token2=1428493810_25ff23eaeb9489b76649aaaf3e7fa438&aksessionid=028dcbd66a5e2a5a

If you try to view that in a browser (without your log in details), you'll find that the page will not load. Also the fact that it is an https address may also cause you a problem. If you try again with a publicly available video URL, you may have more luck.

Sheridan
  • 64,785
  • 21
  • 128
  • 175