private void SendChunk(ChunkDetail chunk)
        {
            string frag = "-" + chunk.ChunkIndex.ToString("00000") + ".ts";
            string fn   = pre + frag;


            using (Stream fs = File.Open(chunk.SourceFilePath, FileMode.Open)) {
                TransferAgent.Transfer(fs, new Uri(dest + fn));
            }
            OnUploadComplete(this, new ChunkUploadedEventArgs()
            {
                ChunkIndex = chunk.ChunkIndex, ChunkDuration = chunk.ChunkDuration, SourceFilePath = chunk.SourceFilePath
            });
        }
Example #2
0
        protected void UploadAction(object o)
        {
            try {
                string dir      = BaseDirectory;
                string filename = Path.Combine(dir, PlaylistFilename);
                TransferAgent.Transfer(new Uri(filename, UriKind.Absolute), new Uri(PlaylistDestination, UriKind.Absolute));

                filename += ".gz";                 // upload compressed version
                TransferAgent.Transfer(new Uri(filename, UriKind.Absolute), new Uri(PlaylistDestination + ".gz", UriKind.Absolute));

                WaitingUploads = 0;                 // any transfer is as good as all.
                Console.WriteLine("Uploaded new playlist");
            } catch {
                // Some sort of error notification might help!
                Console.WriteLine("Missed a playlist upload");
                TransportPlaylist();                 // try again!
            }
        }