예제 #1
0
        public async Task <List <LiveClientModel> > GetClientsState()
        {
            try
            {
                var root = await LiveService.GetClientInfo();

                var list = root?.clients?.Select(item => new LiveClientModel()
                {
                    SrsClientId = item.id,
                    SrsHostId   = item.vhost,
                    SrsStreamId = item.id,
                    SrsServerId = root.server,
                    ClientIp    = item.ip,
                    PageUrl     = item.pageUrl,
                    SwfUrl      = item.swfUrl,
                    TcUrl       = item.tcUrl,
                    Url         = item.url,
                    Type        = item.type == "Play"? LiveClientModel.LiveClientType.播放:item.type == "fmle-publish"? LiveClientModel.LiveClientType.推流: LiveClientModel.LiveClientType.未知,
                    IsPublish   = item.publish == "true",
                    AliveTime   = TimeSpan.FromMilliseconds(item.alive).ToString("g"),
                });
                return(list?.ToList());
            }
            catch (Exception e)
            {
                throw;
            }
        }
예제 #2
0
        public async Task <List <LiveStreamModel> > GetStreamsState()
        {
            try
            {
                var root = await LiveService.GetStreamInfo();

                var list = root?.streams?.Select(item => new LiveStreamModel()
                {
                    SrsHostId       = item.vhost,
                    SrsStreamId     = item.id,
                    SrsServerId     = root.server,
                    Name            = item.name,
                    App             = item.app,
                    ClientCount     = item.clients,
                    SendFlowKB      = item.send_bytes / 1024 / 8,
                    RecvFlowKB      = item.recv_bytes / 1024 / 8,
                    SendFlowRateKBs = item.kbps.send_30s / 8,
                    RecvFlowRateKBs = item.kbps.recv_30s / 8,
                    Active          = item.publish?.active == "true",
                    VideoCode       = item.video?.codec,
                    VideoProfile    = item.video?.profile,
                    VideoLevel      = item.video?.level,
                    AudioCode       = item.audio?.codec,
                    AudioSampleRate = item.audio?.sample_rate,
                    AudioChannel    = item.audio?.channel,
                    AudioProfile    = item.audio?.profile,
                });
                return(list?.ToList());
            }
            catch (Exception e)
            {
                throw;
            }
        }
예제 #3
0
        public async Task <List <LiveVHostModel> > GetVhostsState()
        {
            try
            {
                var root = await LiveService.GetVhostInfo();

                var list = root?.vhosts?.Select(item => new LiveVHostModel()
                {
                    SrsHostId       = item.id,
                    SrsServerId     = root.server,
                    Name            = item.name,
                    Enable          = item.enabled == "true",
                    ClientCount     = item.clients,
                    StreamCount     = item.streams,
                    SendFlowKB      = item.send_bytes / 1024 / 8,
                    RecvFlowKB      = item.recv_bytes / 1024 / 8,
                    SendFlowRateKBs = item.kbps.send_30s / 8,
                    RecvFlowRateKBs = item.kbps.recv_30s / 8,
                    IsHaveHls       = item.hls?.enabled == "true",
                });
                return(list?.ToList());
            }
            catch (Exception e)
            {
                throw;
            }
        }
예제 #4
0
        protected override void ExecuteCommand(string[] args)
        {
            var address = WalletService.GetAddress(addressArgument.Value);

            LiveService.AddCommand(new Node.Processors.Commands.GetAccountCommand(address.Encoded, (account, code) =>
            {
                if (code == ResultCode.Success)
                {
                    Console.WriteLine("----------------------");
                    Console.WriteLine("Address : {0}", account.Address.Encoded);
                    foreach (var balance in account.Balances)
                    {
                        Console.WriteLine("{0} : {1}", Currency.ToSymbol(balance.Currency), Amount.ToWholeDecimal(balance.Amount));
                    }
                    Console.WriteLine("----------------------");
                }
                else
                {
                    Console.WriteLine("Get Balance Failed");
                }
            }));
        }
 public LivesController(LiveService liveService)
 {
     _liveService = liveService;
 }
예제 #6
0
 public LiveController(LiveService service)
 {
     _service = service;
 }
예제 #7
0
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     var liveService = new LiveService();
 }
 public LiveController(MagmaLiveDbContext magmaLiveDbContext)
 {
     liveService         = new LiveService(magmaLiveDbContext);
     liveResponseFactory = new LiveResponseFactory();
 }
예제 #9
0
 static async Task Main(string[] args)
 {
     Console.WriteLine("Hello World!");
     LiveService tmp = new LiveService();
     await tmp.Send();
 }