FurioosSignalingSettings.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Unity.RenderStreaming.Signaling;
  5. using UnityEngine;
  6. namespace Unity.RenderStreaming
  7. {
  8. /// <summary>
  9. ///
  10. /// </summary>
  11. [Serializable]
  12. public class FurioosSignalingSettings : SignalingSettings
  13. {
  14. /// <summary>
  15. ///
  16. /// </summary>
  17. public override Type signalingClass => typeof(FurioosSignaling);
  18. /// <summary>
  19. ///
  20. /// </summary>
  21. public override IReadOnlyCollection<IceServer> iceServers => m_iceServers;
  22. /// <summary>
  23. ///
  24. /// </summary>
  25. public string url => m_url;
  26. [SerializeField]
  27. protected string m_url;
  28. [SerializeField]
  29. protected IceServer[] m_iceServers;
  30. /// <summary>
  31. ///
  32. /// </summary>
  33. /// <param name="url"></param>
  34. /// <param name="iceServers"></param>
  35. public FurioosSignalingSettings(string url, IceServer[] iceServers = null)
  36. {
  37. if (url == null)
  38. throw new ArgumentNullException("url");
  39. if (!Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute))
  40. throw new ArgumentException("url is not well formed Uri");
  41. m_url = url;
  42. m_iceServers = iceServers == null ? Array.Empty<IceServer>() : iceServers.Select(server => server.Clone()).ToArray();
  43. }
  44. /// <summary>
  45. ///
  46. /// </summary>
  47. public FurioosSignalingSettings()
  48. {
  49. m_url = "http://127.0.0.1";
  50. m_iceServers = new[]
  51. {
  52. new IceServer (urls: new[] {"stun:stun.l.google.com:19302"})
  53. };
  54. }
  55. /// <summary>
  56. ///
  57. /// </summary>
  58. /// <param name="arguments"></param>
  59. /// <returns></returns>
  60. public override bool ParseArguments(string[] arguments)
  61. {
  62. return true;
  63. }
  64. }
  65. }