Namespace: Un4seen.Bass.Misc
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax
Return Value
Type: Booleanon success, else (see LastError or LastErrorMessage for details).
Remarks
If already connected, this method will first Disconnect from the Server, which might result in stopping the underlying BaseEncoder.
If the channel handle (as defined in the ChannelHandle) is already playing, it will be shortly paused during the setup and resumed when done.
Note: If you have set the AutoReconnect property to this call will automatically try to reconnect even if this method returns !
Examples
private BroadCast _broadCast; private ENCODEPROC _myEncProc; ... // create your encoder (using a recording handle) EncoderLAME lame = new EncoderLAME(_recHandle); // create an streaming server instance SHOUTcast shoutcast = new SHOUTcast(lame); // create the broadcast instance _broadCast = new BroadCast(shoutcast); _broadCast.AutoReconnect = true; _broadCast.Notification += new BroadCastEventHandler(OnBroadCast_Notification); // create your encoder callback _myEncProc = new ENCODEPROC(MyEncodingCallback); // start the encoder (paused) _broadCast.StartEncoder(_myEncProc, IntPtr.Zero, true); // now connect to start your broadcast _broadCast.Connect(); // and really start the encoder _broadCast.Server.Encoder.Pause(false); ... // your broadcast encoder callback implementation private void MyEncodingCallback(int handle, int channel, IntPtr buffer, int length, IntPtr user) { // here we receive the encoded data back (manual mode) if ( _broadCast.IsConnected ) { _broadCast.SendData(buffer, length); } } private void OnBroadCast_Notification(object sender, BroadCastEventArgs e) { if (e.EventType == BroadCastEventType.EncoderRestartRequired) _broadCast.StartEncoder(_myEncProc, 0); if (!_broadCast.IsConnected) { // connection lost } }
See Also