Beispiel #1
0
        public async Task Play(IMediaFile mediaFile, string title = null)
        {
            try
            {
                _filePath = mediaFile.Url;
                if (_playbackStateSubject.Latest().First() == MediaPlayerStatus.Paused)
                {
                    await Pause();

                    return;
                }

                _canPlaySubject.OnNext(true);
                await CrossMediaManager.Current.Play(mediaFile);

                _titleSubject.OnNext(title);
            }
            catch (Exception e)
            {
                _canPlaySubject.OnNext(false);
                Debug.WriteLine(e);
            }
        }