SonopostLiveVideoPusher.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using Vinno.IUS.Common.Network.Leaf;
  3. using Vinno.vCloud.FIS.CrossPlatform.Common.LiveVideo;
  4. using Vinno.vCloud.FIS.CrossPlatform.Common.LiveVideo.Interface;
  5. namespace Vinno.vCloud.Common.FIS.LiveVideos
  6. {
  7. public class SonopostLiveVideoPusher : LiveVideoPusher
  8. {
  9. /// <summary>
  10. /// 推流状态改变时触发,主要给预览用
  11. /// </summary>
  12. public event EventHandler<PusherState> PusherStateChanged;
  13. /// <summary>
  14. /// 当前的推流器
  15. /// </summary>
  16. public ILiveVideoPusherForSonopost LivePusher => _pusher;
  17. public SonopostLiveVideoPusher(ClientLeaf leaf, string terminalId, string terminalName) : base(leaf, terminalId, terminalName)
  18. {
  19. }
  20. protected override void StartPusher(IExtendedData pushParams)
  21. {
  22. PusherStateChanged?.Invoke(this, PusherState.Preparing);
  23. base.StartPusher(pushParams);
  24. PusherStateChanged?.Invoke(this, PusherState.Prepared);
  25. }
  26. protected override void StopPusher(bool isPaused)
  27. {
  28. PusherStateChanged?.Invoke(this, PusherState.Preparing);
  29. base.StopPusher(isPaused);
  30. if (!isPaused)
  31. {
  32. PusherStateChanged?.Invoke(this, PusherState.Prepared);
  33. }
  34. }
  35. }
  36. }