示例#1
0
        public async Task <object> Get(GetLiveMediaInfo request)
        {
            var item = _libraryManager.GetItemById(request.Id);
            IEnumerable <MediaSourceInfo> mediaSources;

            var channelItem = item as IChannelMediaItem;
            var user        = _userManager.GetUserById(request.UserId);

            if (channelItem != null)
            {
                mediaSources = await _channelManager.GetChannelItemMediaSources(request.Id, true, CancellationToken.None)
                               .ConfigureAwait(false);
            }
            else
            {
                var hasMediaSources = (IHasMediaSources)item;

                if (user == null)
                {
                    mediaSources = hasMediaSources.GetMediaSources(true);
                }
                else
                {
                    mediaSources = hasMediaSources.GetMediaSources(true, user);
                }
            }

            return(ToOptimizedResult(new LiveMediaInfoResult
            {
                MediaSources = mediaSources.ToList()
            }));
        }
示例#2
0
 public Task <object> Get(GetLiveMediaInfo request)
 {
     return(GetPlaybackInfo(request.Id, request.UserId));
 }
示例#3
0
        public async Task <object> Get(GetLiveMediaInfo request)
        {
            var result = await GetPlaybackInfo(request.Id, request.UserId, new[] { MediaType.Audio, MediaType.Video }).ConfigureAwait(false);

            return(ToOptimizedResult(result));
        }