Swift Sharp
Swift Sharp

Reputation: 2623

WP8 error media player can not start

I'm trying to play a small video file in my windows phone application. Is pretty basic

 void StartMediaPlayer()
    {
        MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher();

        mediaPlayerLauncher.Media = new Uri("/Assets/video/video1.wmv", UriKind.Relative);
        mediaPlayerLauncher.Location = MediaLocationType.Install;

        mediaPlayerLauncher.Controls = MediaPlaybackControls.All;
        mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;

        mediaPlayerLauncher.Show();
    }

i call this void on image tap event, and this is what happend

enter image description here

the debugger show that the error is here: mediaPlayerLauncher.Show();

Upvotes: 2

Views: 461

Answers (2)

Swift Sharp
Swift Sharp

Reputation: 2623

if some has the same problem, just a heads up the files should be in main directory

mediaPlayerLauncher.Media = new Uri("video1.wmv", UriKind.Relative);

Upvotes: 0

Paul Annetts
Paul Annetts

Reputation: 9604

That error will be thrown the application can't find your file /Assets/video/video1.wmv in the install directory on the phone. Make sure that your video is in your project, and is set to build type "Content". You could open the XAP file to double-check it's in the correct relative location too (it's just a ZIP file archive renamed).

Upvotes: 1

Related Questions