上传者: fy53888
|
上传时间: 2021-11-19 12:51:21
|
文件大小: 722KB
|
文件类型: -
语音聊天源码
namespace VoiceChat.Model
{
// Подтверждения
public enum Flags
{
Accept,
BeginVideoSend,
EndVideoSend
}
// Состояния модели
public enum ModelStates
{
WaitCall,
OutgoingCall,
IncomingCall,
Talk,
Close
}
public class VoiceChatModel : INotifyPropertyChanged
{
private const int LINES_COUNT = 2;
public AudioSharing audio;
public VideoSharing video;
public BdtpClient bdtpClient;
private Thread waitCall;
public bool Connected
{
get
{
return bdtpClient.Connected;
}
}
public IPAddress RemoteIP
{
get
{
return remoteIP;
}
set
{
remoteIP = value;
OnPropertyChanged("RemoteIP");
}
}
private IPAddress remoteIP;
public IPAddress LocalIP
{
get
{
return bdtpClient.LocalIP;
}
}
// Текущее состояние
public ModelStates State
{
get
{
return state;
}
set
{
state = value;
OnPropertyChanged("State");
mediaSounds.ControlSounds();
}
}
private ModelStates state;
public CallTimer callTimer;
private MediaSounds mediaSounds;
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string PropertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(PropertyName));
}
public VoiceChatModel()
{
bdtpClient = new BdtpClient(GetLocalIP(), LIN