public override PlayableBase ToPlayable()
        {
            var ytresult = (IVideoInfo)Result;
            var result   = new YouTubeTrack
            {
                YouTubeId = YouTubeTrack.GetYouTubeIdFromLink(Url),
                TimeAdded = DateTime.Now,
                IsChecked = false
            };

            result.LoadInformation(ytresult);
            return(result);
        }
Beispiel #2
0
        public async override Task <PlayableBase> ToPlayable()
        {
            var ytresult = (Entry)Result;
            var result   = new YouTubeTrack
            {
                YouTubeId = YouTubeTrack.GetYouTubeIdFromLink(Url),
                TimeAdded = DateTime.Now
            };

            if (_soundSourceInfo == null && !(await CheckIfAvailable()))
            {
                throw new Exception();
            }

            result.LoadInformation(ytresult, _soundSourceInfo);
            return(result);
        }
Beispiel #3
0
        public override async Task <bool> CheckIfAvailable()
        {
            var result = new YouTubeTrack {
                YouTubeId = YouTubeTrack.GetYouTubeIdFromLink(Url)
            };

            try
            {
                using (var x = await result.GetSoundSource())
                {
                    _soundSourceInfo = SoundSourceInfo.FromSoundSource(x);
                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }