Exemplo n.º 1
0
        public ActionResult <HmacKeyResponseModel> GetHmacKey(string channelId)
        {
            int parsedChannelId;

            if (!(int.TryParse(channelId, out parsedChannelId)))
            {
                _logger.LogInformation("HMAC request failed: ID {channel} is not an integer",
                                       channelId);
                return(BadRequest("Channel ID must be an integer value."));
            }
            try
            {
                ChannelModel channelModel = _streamManager.GetChannel(parsedChannelId);
                _logger.LogInformation("HMAC key returned for Channel {channel}", parsedChannelId);
                return(Ok(new HmacKeyResponseModel()
                {
                    HmacKey = channelModel.HmacKey,
                }));
            }
            catch (ArgumentException)
            {
                _logger.LogInformation("HMAC request failed: Channel {channel} not found",
                                       parsedChannelId);
                return(BadRequest("Channel with given ID could not be found."));
            }
        }
Exemplo n.º 2
0
 public IActionResult Channel(int channelId)
 {
     try
     {
         var channel        = _streamManager.GetChannel(channelId);
         var posterImageUri = channel.ActiveStreams.Any(s => s.HasPreview) ?
                              Url.Action("Preview", new { streamId = channel.ActiveStreams.First().Id }) : "";
         var viewModel = new ChannelViewModel()
         {
             ChannelId      = channel.Id,
             ChannelName    = channel.Name,
             JanusUri       = _janusUri,
             PosterImageUri = posterImageUri,
         };
         return(View(viewModel));
     }
     catch (ArgumentException e)
     {
         return(NotFound(e.Message));
     }
 }