IRenderStreamingHandler.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using System;
  2. using System.Collections.Generic;
  3. using Unity.WebRTC;
  4. namespace Unity.RenderStreaming
  5. {
  6. public interface IRenderStreamingDelegate
  7. {
  8. /// <summary>
  9. ///
  10. /// </summary>
  11. event Action onStart;
  12. /// <summary>
  13. ///
  14. /// </summary>
  15. event Action<string> onCreatedConnection;
  16. /// <summary>
  17. ///
  18. /// </summary>
  19. event Action<string> onDeletedConnection;
  20. /// <summary>
  21. ///
  22. /// </summary>
  23. event Action<string, string> onGotOffer;
  24. /// <summary>
  25. ///
  26. /// </summary>
  27. event Action<string, string> onGotAnswer;
  28. /// <summary>
  29. ///
  30. /// </summary>
  31. event Action<string> onConnect;
  32. /// <summary>
  33. ///
  34. /// </summary>
  35. event Action<string> onDisconnect;
  36. /// <summary>
  37. ///
  38. /// </summary>
  39. event Action<string, RTCRtpTransceiver> onAddTransceiver;
  40. /// <summary>
  41. ///
  42. /// </summary>
  43. event Action<string, RTCDataChannel> onAddChannel;
  44. }
  45. public interface IRenderStreamingHandler
  46. {
  47. /// <summary>
  48. ///
  49. /// </summary>
  50. /// <param name="connectionId"></param>
  51. void CreateConnection(string connectionId);
  52. /// <summary>
  53. ///
  54. /// </summary>
  55. /// <param name="connectionId"></param>
  56. void DeleteConnection(string connectionId);
  57. /// <summary>
  58. ///
  59. /// </summary>
  60. /// <param name="connectionId"></param>
  61. /// <returns></returns>
  62. bool ExistConnection(string connectionId);
  63. /// <summary>
  64. ///
  65. /// </summary>
  66. /// <param name="connectionId"></param>
  67. /// <returns></returns>
  68. bool IsConnected(string connectionId);
  69. /// <summary>
  70. ///
  71. /// </summary>
  72. /// <param name="connection"></param>
  73. /// <returns></returns>
  74. bool IsStable(string connection);
  75. /// <summary>
  76. ///
  77. /// </summary>
  78. /// <param name="connectionId"></param>
  79. /// <param name="label"></param>
  80. /// <returns></returns>
  81. RTCDataChannel CreateChannel(string connectionId, string label = null);
  82. /// <summary>
  83. ///
  84. /// </summary>
  85. /// <param name="connectionId"></param>
  86. void SendOffer(string connectionId);
  87. /// <summary>
  88. ///
  89. /// </summary>
  90. /// <param name="connectionId"></param>
  91. void SendAnswer(string connectionId);
  92. /// <summary>
  93. ///
  94. /// </summary>
  95. /// <param name="connectionId"></param>
  96. /// <param name="track"></param>
  97. /// <param name="init"></param>
  98. /// <returns></returns>
  99. RTCRtpTransceiver AddTransceiver(string connectionId, MediaStreamTrack track, RTCRtpTransceiverInit init = null);
  100. /// <summary>
  101. ///
  102. /// </summary>
  103. /// <param name="connectionId"></param>
  104. /// <param name="kind"></param>
  105. /// <param name="init"></param>
  106. /// <returns></returns>
  107. RTCRtpTransceiver AddTransceiver(string connectionId, TrackKind kind, RTCRtpTransceiverInit init = null);
  108. /// <summary>
  109. ///
  110. /// </summary>
  111. /// <param name="connectionId"></param>
  112. /// <param name="track"></param>
  113. void RemoveSenderTrack(string connectionId, MediaStreamTrack track);
  114. /// <summary>
  115. ///
  116. /// </summary>
  117. /// <param name="connectionId"></param>
  118. /// <returns></returns>
  119. IEnumerable<RTCRtpTransceiver> GetTransceivers(string connectionId);
  120. }
  121. }