找回密码
 立即注册

QQ登录

只需一步,快速开始

lbzxy

银牌会员

4

主题

9

帖子

2088

积分

银牌会员

积分
2088

活字格认证

最新发帖
lbzxy
银牌会员   /  发表于:2013-10-18 21:01  /   查看:4885  /  回复:4
如题

4 个回复

倒序浏览
lbzxy
银牌会员   /  发表于:2013-10-18 21:12:00
沙发
C1MediaPlayer C1MP = new C1MediaPlayer();
            this.LayoutRoot.Children.Add(C1MP);
            
           
            C1MediaItem plI = new C1MediaItem();
            C1MP.Items.Add(plI);
            Stream stream = File.Open(fileInfo.FullName,FileMode.Open);
         
            plI.MediaStream = stream;
这样不给播呀
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2013-10-21 12:22:00
板凳
回复 2楼lbzxy的帖子

有没有调用 C1MediaPlayer  的 Play 方法?或者是否尝试过 C1MediaItem MediaSource 属性赋值?
回复 使用道具 举报
lbzxy
银牌会员   /  发表于:2013-10-21 22:18:00
地板
你说的写在xaml里可以可是要选择文件时怎么办?
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2013-10-22 10:14:00
5#
回复 4楼lbzxy的帖子

我通过以下代码正常播放WMV格式视频:

  1. private void Button_Click(object sender, RoutedEventArgs e)
  2.         {
  3.             OpenFileDialog op = new OpenFileDialog()
  4.             {
  5.                 Filter = "Video files(*.wmv)|*.wmv|All Files(*.*)|*.*"
  6.                
  7.             };
  8.             
  9.             if (op.ShowDialog()==true)
  10.             {
  11.                 FileStream stream = op.File.OpenRead();

  12.                 C1MediaItem plI = new C1MediaItem();
  13.                 plI.MediaStream = stream;
  14.                 c1mediaplayer.Items.Add(plI);
  15.                 c1mediaplayer.Play();
  16.             }
  17.         }
复制代码


请问你播放的是什么格式的文件?
C1MediaPlayer 支持文件格式如下:

  1. Video

  2. The video formats supported are as follows:
  3. ?Raw Video
  4. ?YV12 - YCrCb(4:2:0)
  5. ?RGBA - 32 bit Alpha Red, Green, Blue
  6. ?WMV, MV2, and MV3 ( Windows Media Video 7, 8, and 9)
  7. ?Supports Simple and Main Profiles
  8. ?Supports only progressive (non-interlaced) content.
  9. ?WMVA: Windows Media Video Advanced Profile, non-VC-1.
  10. ?WVC1: Windows Media Video Advanced Profile, VC-1.
  11. ?Supports Advanced Profile.
  12. ?Supports only progressive (non-interlaced) content.
  13. ?H264 (ITU-T H.264 / ISO MPEG-4 AVC).
  14. Audio

  15. The audio formats supported are as follows:
  16. ?“1” - WAV format.
  17. ?"353" - Microsoft Windows Media Audio v7, v8 and v9.x Standard (WMA Standard).
  18. ?"354" - Microsoft Windows Media Audio v9.x and v10 Professional (WMA Professional).
  19. ?"85" - ISO MPEG-1 Layer III (MP3).
  20. ?"255" - ISO Advanced Audio Coding (AAC).
复制代码
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部