2016-12-14 109 views
1

所以我希望这将是一个简单的解决方案。我目前正在设计一个使用MediaPlayerElement的媒体应用程序。我正在开发Windows 14393(周年纪念更新)我已经读过MediaPlaerElement只支持这个版本,但我想支持Windows(Build 10586或10240)的老版本。什么是最好的方法来做到这一点?我已经开始在我的代码下面,但不知道我应该用什么来显示旧版本的视频。在框架构造UWP MediaPlayerElement向后兼容性

创建代码:

 if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3)) 
     { 
      MediaPlayerElement newPlayer = new MediaPlayerElement() 
      { 
       AreTransportControlsEnabled = true, 
       Stretch = Stretch.Uniform, 
       AutoPlay = true, 
       IsRightTapEnabled = false 
      }; 
      newPlayer.TransportControls.IsZoomButtonVisible = false; 
      newPlayer.TransportControls.IsZoomButtonVisible = false; 
      Player = newPlayer.MediaPlayer; 
      newPlayer.TransportControls.DoubleTapped += SingleMediaElement_DoubleTapped; 
      this.MainGrid.Children.Add(newPlayer); 
     } 
     else 
     { 
      //Windows.Media.Playback.MediaPlayer oldPLayer = new Windows.Media.Playback.MediaPlayer() 
      //{ 
      // AutoPlay = true 
      //}; 
     } 

什么是创建和旧版本的Windows(理想UniversalAPI 1.0)在我的应用程序使用视频播放器的最佳方法是什么?

谢谢!

+0

你[不能运行在Windows的早期版本通用应用程序(http://stackoverflow.com/questions/30317848/run-windows-10-universal-apps-on-windows-8-1) – stuartd

+0

对不起,我的意思是像版本5011或Windows 10的原始版本,更新问题 –

+0

[MediaElement](https://msdn.microsoft .COM /库/窗/应用/ br242926)? – stuartd

回答