标题:C#的windows media player 怎么实现边下载边播放,有例子最好...
取消只看楼主
流氓13少
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-3-13
 问题点数:0 回复次数:1 
C#的windows media player 怎么实现边下载边播放,有例子最好...
程序代码:
 private void DownLoad()
        {
            var request = WebRequest.Create("http://112.91.92.82/down_group226/M00/10/F9/d5NjWU9sgi8AAAAAAI1JBCBiFuQ1908112/%E6%9A%97%E5%8F%B7.avi?k=o3k9tkPyCjxURbqvBPTpJw&t=1332512185&u=114.240.35.97@29851728@dpdw3zsk&file=%E6%9A%97%E5%8F%B7.avi&speed=153600");
            var response = request.GetResponse();
            var strm = response.GetResponseStream();
            Thread thread = null;
            thread = new Thread
                (
                    () =>
                    {
                        long totalLength = response.ContentLength;
                        byte[] buffer = new byte[1024 * 1024];
                        long count = 0;
                        int length = strm.Read(buffer, 0, buffer.Length);
                        FileStream fsWrite = new FileStream(@"E:\aa.avi",FileMode.Create);
                        while (length != 0)
                        {
                            fsWrite.Write(buffer,0,length);
                            count += length;
                            int percentage = (int)(count * 100 / totalLength);
                            //this.progressBar1.Value = percentage;
                            //percentage.ToString()+"%"
                            length = strm.Read(buffer, 0, buffer.Length);
                        }
                        thread.Abort();
                        strm.Close();
                        fsWrite.Close();
                    }
                );
            thread.Start();
        }
搜索更多相关主题的帖子: windows player media 最好 
2012-03-23 22:42
流氓13少
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-3-13
得分:0 
这个已经实现了下载,可是不知道怎么边下边播。
2012-03-23 22:42



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-364148-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.238854 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved