Esempio n. 1
0
        public async Task <MediaPlayer> GetMainMediaPlayerAsync()
        {
            using (_busyStack.GetToken())
            {
                var item = await _mediaPlayerRepository.GetMainMediaPlayerAsync()
                           .ConfigureAwait(true);

                return(_mediaPlayerMapper.GetMain(item, _playlistMapper.Get(item.Playlist)));
            }
        }
Esempio n. 2
0
        public async Task <MediaPlayer> GetMainMediaPlayerAsync()
        {
            using (_busyStack.GetToken())
            {
                var player = await Task.Run(() => _context.Mediaplayers.FirstOrDefault(p => p.IsPrimary));

                if (player != null)
                {
                    var playlist = await GetPlaylistByIdAsync(player.PlaylistId);

                    if (playlist != null)
                    {
                        return(_mediaPlayerMapper.GetMain(player, GetPlaylistById(player.PlaylistId)));
                    }
                }

                return(default(MediaPlayer));
            }
        }