0

While play media (using Play() method) with https url getting exception:

An unhandled exception of type 'System.NullReferenceException' occurred in PresentationCore.dll

Additional information: Object reference not set to an instance of an object.

Is there any alternate way to make it working?

I have written below code:

MeMediaElement.Source = new Uri(txtPath.Text, UriKind.RelativeOrAbsolute);
MeMediaElement.Play();
Community
  • 1
  • 1
  • What is the inner exception? Any other details? – Orkun Bekar Dec 28 '15 at 14:50
  • Inner Exception is "null" – user3378939 Dec 28 '15 at 15:10
  • Stack Trace: at System.Windows.Media.MediaPlayerState.OpenMedia(Uri source) at System.Windows.Media.MediaPlayerState.SetSource(Uri source) at System.Windows.Media.MediaPlayerState.Open(Uri source) at System.Windows.Media.MediaPlayer.Open(Uri source) at System.Windows.Controls.AVElementHelper.HandleStateChange() at System.Windows.Controls.AVElementHelper.SetState(MediaState mediaState) at System.Windows.Controls.MediaElement.Play() – user3378939 Dec 28 '15 at 15:11
  • It seems there is a problem with the path of your media element. – Orkun Bekar Dec 28 '15 at 15:13
  • Yes. but same url is working in windows media player and web browser. – user3378939 Dec 28 '15 at 15:20
  • i have found one post for same problem: https://connect.microsoft.com/VisualStudio/feedback/details/934355/in-a-wpf-standalone-application-exe-when-the-source-of-a-mediaelement-is-set-to-a-https-uri-it-throws-a-nullreferenceexception please check if you able to help me. – user3378939 Dec 28 '15 at 15:22
  • I'm afraid there is not an easy solution for that. What about downloading file to local disk and then streaming? – Orkun Bekar Dec 29 '15 at 08:39
  • No. that will be not good way when file size is very large like More then 10MB. – user3378939 Dec 29 '15 at 11:39

0 Answers0