2012-01-30 4 views
10

보안 모니터 응용 프로그램을 개발하고 있었고 Skype가 가장 좋은 방법이었습니다.C# Skype API 비디오 호출

가능한 침입이 발생하면 응용 프로그램이 지정된 내 Skype ID를 호출합니다. 이는 내 안드로이드 전화 일 뿐이며 모든 이미지 처리 작업을 수행했습니다. 하지만 난이 코드 조각 쓴이 스카이프 API에 붙어입니다 : 이것은 음성 통화 만 call.StartVideoSend에()를 시작

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using SKYPE4COMLib; 


namespace SkypeCall 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      Skype skype; 
      skype = new Skype("Skype4COM.Skype", "Skype_"); 

      Call call = skype.PlaceCall(SkypeID); 
      call.StartVideoSend(); 
     } 
    } 
} 

을; 심지어 this 시도 오류

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in SkypeCall.exe 

Additional information: CALL: Action failed 

을 보여줍니다하지만 난 그 오래된 API이고 그것에서 아무것도 얻을 수없는 것 같아요. 그리고 심지어는 commands을 보내야합니다.

누군가가 나를 도와 주면 감사 할 것입니다.

답변

5

전화가 연결될 때까지 기다려야한다고 생각합니다.

가장 쉬운 방법은, 그러나 당신 만이 할 수있는이 프로젝트를 위해 그것을 사용하지 않는, 그래서이 모든 호출에 발사 할 생각 call.Status

class Program 
    { 
     static void Main(string[] args) 
     { 
      Skype skype; 
      skype = new SKYPE4COMLib.Skype(); 
      string SkypeID = args[1]; 
      Call call = skype.PlaceCall(SkypeID); 
      do 
      { 
       System.Threading.Thread.Sleep(1); 
      } while (call.Status != TCallStatus.clsInProgress); 
      call.StartVideoSend(); 
     } 
    } 

또한 이벤트를 추가 할 수 있습니다를 테스트하는 것입니다 너무 많은.

class Program 
    { 
     static string SkypeID = ""; 
     static void Main(string[] args) 
     { 
      Skype skype; 
      skype = new SKYPE4COMLib.Skype(); 
      skype.CallStatus += new _ISkypeEvents_CallStatusEventHandler(skype_CallStatus); 
      Call call = skype.PlaceCall(SkypeID); 

      Console.ReadKey(); 
     } 

     static void skype_CallStatus(Call pCall, TCallStatus Status) 
     { 
      if (Status == TCallStatus.clsInProgress && pCall.PartnerHandle == SkypeID) { pCall.StartVideoSend(); } 
     } 
    } 
+0

감사합니다. @Matt –