简体   繁体   中英

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

在此处输入图片说明

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

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).

如果某些文件具有相同的问题,请仅将文件放在主目录中

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM