/// <summary> /// Begins the live stream using the information previously set in the FLVEncoderParams. /// If there was an error connecting to the server, than false is returned. /// </summary> /// <returns>True if encoding has begun properly / safely.</returns> public bool BeginLiveStream(string[] c_params) { if (!streamFile) { timer = new HighPerformanceTimer(); timer.Start(); //begin our timer (times are encoded). this.frameCount = 0; } Console.WriteLine(this.EncoderParameters.StreamingParams.Protocol); client = ConnectionProtocol.getProtocolHandler( this.EncoderParameters.StreamingParams.Protocol); client.ConnectionParameters = this.EncoderParameters.StreamingParams; Console.WriteLine("Connecting with: " + client.ProtocolName); if (!client.connect(c_params)) { return(false); } //turn on live streaming this.streamLive = true; //set the encoding progress to true this.encodeInProgress = true; //return success return(true); }
/// <summary> /// Begins creating a local .flv file based on the file path specified in teh FLVEncoderParams. /// </summary> /// <returns>True if encoding has begun, false is an error was encountered.</returns> public bool BeginFileEncode() { if (!streamLive) { //reset the framecount this.frameCount = 0; timer = new HighPerformanceTimer(); } //create a new file stream to the file FileStream fs = new FileStream(this.EncoderParameters.FileParams.FilePath, FileMode.Create); this.file_name = EncoderParameters.FileParams.FilePath; //save the output output = fs; //write the header information FLVHeader.WriteHeader(this.output); //write 4 0's for the tag size (this refers to the previous tag, which in this case is 0 since no tag is before) output.WriteByte(0); output.WriteByte(0); output.WriteByte(0); output.WriteByte(0); output.Flush(); if (!streamLive) { timer.Start(); //begin our timer (times are encoded). } //set streamFile flag to true this.streamFile = true; //set the encoding status this.encodeInProgress = true; //return success return(true); }
/// <summary> /// Begins creating a local .flv file based on the file path specified in teh FLVEncoderParams. /// </summary> /// <returns>True if encoding has begun, false is an error was encountered.</returns> public bool BeginFileEncode() { if (!streamLive) { //reset the framecount this.frameCount = 0; timer = new HighPerformanceTimer(); } //create a new file stream to the file FileStream fs = new FileStream(this.EncoderParameters.FileParams.FilePath, FileMode.Create); this.file_name = EncoderParameters.FileParams.FilePath; //save the output output = fs; //write the header information FLVHeader.WriteHeader(this.output); //write 4 0's for the tag size (this refers to the previous tag, which in this case is 0 since no tag is before) output.WriteByte(0); output.WriteByte(0); output.WriteByte(0); output.WriteByte(0); output.Flush(); if(!streamLive) timer.Start(); //begin our timer (times are encoded). //set streamFile flag to true this.streamFile = true; //set the encoding status this.encodeInProgress = true; //return success return true; }
/// <summary> /// Begins the live stream using the information previously set in the FLVEncoderParams. /// If there was an error connecting to the server, than false is returned. /// </summary> /// <returns>True if encoding has begun properly / safely.</returns> public bool BeginLiveStream(string[] c_params) { if (!streamFile) { timer = new HighPerformanceTimer(); timer.Start(); //begin our timer (times are encoded). this.frameCount = 0; } Console.WriteLine(this.EncoderParameters.StreamingParams.Protocol); client = ConnectionProtocol.getProtocolHandler( this.EncoderParameters.StreamingParams.Protocol); client.ConnectionParameters = this.EncoderParameters.StreamingParams; Console.WriteLine("Connecting with: " + client.ProtocolName); if (!client.connect(c_params)) { return false; } //turn on live streaming this.streamLive = true; //set the encoding progress to true this.encodeInProgress = true; //return success return true; }