コード例 #1
0
        public List <VideoChunk> loadPlaylist(PlaylistM3U8 pl)
        {
            Console.WriteLine("Loading meeting id " + pl.meetingID + " video chunks ...");
            string reCL = webReq.getRequest(pl.chunklist.AbsoluteUri, String.Empty);

            uint i = 0;
            List <VideoChunk> lvc    = new List <VideoChunk>();
            Uri            localPath = pl.getLocalUri();
            RefreshingLine rl        = new RefreshingLine("Creates chunks list...");

            try
            {
                string       line;
                StringReader reader = new StringReader(reCL);
                while ((line = reader.ReadLine()) != null)
                {
                    if (line.StartsWith("media"))
                    {
                        rl.WriteRefreshLine(string.Format("Add chunk number {0}", i));
                        lvc.Add(new VideoChunk(new Uri(localPath.AbsoluteUri + Uri.UnescapeDataString(line))));
                        i++;
                    }
                }
                ;
                rl.NewWriteLine(string.Format("Finsh - added {0} chunks", i));
                return(lvc);
            }
            catch (Exception)
            {
                throw new Exception("Cannot create chunks list");
            }
        }