WSRtcHandler.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using LitJson;
  5. public class WSRtcHandler {
  6. public delegate void OnIceCandidateDelegate(JsonData data);
  7. public delegate void OnOfferDelegate(JsonData data);
  8. public delegate void OnAnswerDelegate(JsonData data);
  9. public delegate void OnSpeekingDelegate (JsonData data);
  10. public delegate void OnProhibitSpeekDelegate (JsonData data);
  11. public OnIceCandidateDelegate OnIceCandidate;
  12. public OnOfferDelegate OnOffer;
  13. public OnAnswerDelegate OnAnswer;
  14. public OnSpeekingDelegate OnSpeeking;
  15. public OnProhibitSpeekDelegate OnProhibitSpeek;
  16. public void IceCandidate (string socketId, string label, string id, string candidate)
  17. {
  18. }
  19. public void Offer(string socketId, string sdpType, string sdpDescription)
  20. {
  21. }
  22. public void Answer(string socketId, string sdpType, string sdpDescription)
  23. {
  24. }
  25. public void Speeking( bool isSpeeking)
  26. {
  27. }
  28. public void ProhibitSpeek(string socketId, bool canSpeek)
  29. {
  30. }
  31. public void OnMessageReceived(JsonData data)
  32. {
  33. }
  34. private void OnIceCandidateReceived(JsonData data)
  35. {
  36. if (OnIceCandidate != null) {
  37. OnIceCandidate (data);
  38. }
  39. }
  40. private void OnOfferReceived(JsonData data)
  41. {
  42. if (OnOffer != null) {
  43. OnOffer (data);
  44. }
  45. }
  46. private void OnAnswerReceived(JsonData data)
  47. {
  48. if (OnAnswer != null) {
  49. OnAnswer (data);
  50. }
  51. }
  52. private void OnSpeekingReceived(JsonData data)
  53. {
  54. }
  55. private void OnProhibitSpeekReceived(JsonData data)
  56. {
  57. }
  58. }