當我單擊Windows窗體上的按鈕時,我試圖發送音頻文件(或直接通過當前的Skype輸入設備進行音頻)。我發現了一些鏈接,但所有引用似乎都被破壞了,我正在爲如何使用它而生氣。通過Skype通話發送音頻
我已經設法連接到Skype的API並使用它(我已經使用它的其他項目,它運行良好),但我真的不能通過輸入音頻流發送任何音頻。
任何建議將不勝感激。
當前代碼:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Speech;
using System.Speech.Synthesis;
using SKYPE4COMLib;
using System.Reflection;
using System.IO;
namespace TestSendAudioOnSkype
{
/// <summary>
/// Logica di interazione per MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private Call CurrentCall = null;
private Skype SkypeApplet;
private const int SkypeProtocol = 9;
private SpeechSynthesizer Speak = new SpeechSynthesizer();
public MainWindow()
{
InitializeComponent();
try
{
SkypeApplet = new Skype();
SkypeApplet.Attach(SkypeProtocol, true);
SkypeApplet.CallStatus += SkypeApplet_CallStatus;
//CurrentCall = SkypeApplet.ActiveCalls[0];
}
catch (Exception e)
{
MessageBox.Show("errore: " + e.ToString());
System.Windows.Application.Current.Shutdown();
}
}
void SkypeApplet_CallStatus(Call pCall, TCallStatus Status)
{
if (Status == TCallStatus.clsInProgress)
CurrentCall = pCall;
}
private void button1_Click(object sender, RoutedEventArgs e)
{
if (CurrentCall == null)
{
CurrentCall = SkypeApplet.ActiveCalls[1];
}
string path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string filepath = System.IO.Path.Combine(path,"tmp.wav");
Speak.SetOutputToWaveFile(filepath);
Speak.Speak("Hello world");
Speak.SetOutputToDefaultAudioDevice();
//Speak.SpeakAsync("Hello world");
try
{
CurrentCall.set_OutputDevice(TCallIoDeviceType.callIoDeviceTypeFile, filepath);
CurrentCall.set_InputDevice(TCallIoDeviceType.callIoDeviceTypeFile, filepath);
System.Threading.Thread.Sleep(3000);
CurrentCall.set_InputDevice(TCallIoDeviceType.callIoDeviceTypeFile, "");
CurrentCall.set_OutputDevice(TCallIoDeviceType.callIoDeviceTypeFile, "");
MessageBox.Show("invio terminato");
}
catch (Exception exc)
{
MessageBox.Show("errore: " + exc.ToString());
//System.Windows.Application.Current.Shutdown();
}
}
}
}
我到目前爲止已經發現:http://community.skype.com/t5/Desktop-API-former-Public-API/Sending-Audio-in-Skype/td-p/422