使用MediaPlayer播放本地ismv文件

时间:2014-06-02 10:58:11

标签: c# windows windows-phone-8

每当我尝试播放本地ismv文件时,我都会收到“System.IO.FileNotFoundException”。这是我的代码

 MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher();

 mediaPlayerLauncher.Media = new Uri("To_The_Limit_720_230.ismv", UriKind.Relative);
 mediaPlayerLauncher.Location = MediaLocationType.Data;
 mediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop;
 mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;

 mediaPlayerLauncher.Show();

我在这里做错了什么?

2 个答案:

答案 0 :(得分:0)

尝试使用UriKind.RelativeOrAbsolute

mediaPlayerLauncher.Media = new Uri("To_The_Limit_720_230.ismv", UriKind.RelativeOrAbsolute);

添加以下行

mediaPlayerLauncher.Location = MediaLocationType.Install;

注意:

mediaPlayerLauncher.Location = MediaLocationType.Data; // If you open media from isolated storage    
// (or)     
mediaPlayerLauncher.Location = MediaLocationType.Install; // If you open media from application project

答案 1 :(得分:0)

您是否曾尝试使用UriKind.Absolute并为其指定文件目标的完整路径?

mediaPlayerLauncher.Media = new Uri(".../.../To_The_Limit_720_230.ismv", UriKind.Absolute);