CefMediaSink.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. namespace Xilium.CefGlue
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Runtime.InteropServices;
  7. using Xilium.CefGlue.Interop;
  8. /// <summary>
  9. /// Represents a sink to which media can be routed. Instances of this object are
  10. /// retrieved via CefMediaObserver::OnSinks. The methods of this class may
  11. /// be called on any browser process thread unless otherwise indicated.
  12. /// </summary>
  13. public sealed unsafe partial class CefMediaSink
  14. {
  15. /// <summary>
  16. /// Returns the ID for this sink.
  17. /// </summary>
  18. public string Id
  19. {
  20. get
  21. {
  22. var n_result = cef_media_sink_t.get_id(_self);
  23. return cef_string_userfree.ToString(n_result);
  24. }
  25. }
  26. /// <summary>
  27. /// Returns the name of this sink.
  28. /// </summary>
  29. public string Name
  30. {
  31. get
  32. {
  33. var n_result = cef_media_sink_t.get_name(_self);
  34. return cef_string_userfree.ToString(n_result);
  35. }
  36. }
  37. /// <summary>
  38. /// Returns the description of this sink.
  39. /// </summary>
  40. public string Description
  41. {
  42. get
  43. {
  44. var n_result = cef_media_sink_t.get_description(_self);
  45. return cef_string_userfree.ToString(n_result);
  46. }
  47. }
  48. /// <summary>
  49. /// Returns the icon type for this sink.
  50. /// </summary>
  51. public CefMediaSinkIconType IconType =>
  52. cef_media_sink_t.get_icon_type(_self);
  53. /// <summary>
  54. /// Asynchronously retrieves device info.
  55. /// </summary>
  56. public void GetDeviceInfo(CefMediaSinkDeviceInfoCallback callback)
  57. {
  58. cef_media_sink_t.get_device_info(_self, callback.ToNative());
  59. }
  60. /// <summary>
  61. /// Returns true if this sink accepts content via Cast.
  62. /// </summary>
  63. public bool IsCastSink => cef_media_sink_t.is_cast_sink(_self) != 0;
  64. /// <summary>
  65. /// Returns true if this sink accepts content via DIAL.
  66. /// </summary>
  67. public bool IsDialSink => cef_media_sink_t.is_dial_sink(_self) != 0;
  68. /// <summary>
  69. /// Returns true if this sink is compatible with |source|.
  70. /// </summary>
  71. public bool IsCompatibleWith(CefMediaSource source)
  72. {
  73. return cef_media_sink_t.is_compatible_with(_self, source.ToNative()) != 0;
  74. }
  75. }
  76. }