Пример #1
0
        public async void PlayTrailer()
        {
            if (_item.LocalTrailerCount > 0)
            {
                try
                {
                    var trailers = await _apiClient.GetLocalTrailersAsync(_apiClient.CurrentUserId, _item.Id);

                    await _playbackManager.Play(new PlayOptions(trailers.First()));
                }
                catch (Exception)
                {
                    _presentation.ShowDefaultErrorMessage();
                }
            }
            else if (_item.RemoteTrailers != null && _item.RemoteTrailers.Count > 0)
            {
                var url = _item.RemoteTrailers.First().Url;

                if (_playbackManager.CanPlayEmbeddedUrl(url))
                {
                    try
                    {
                        await _playbackManager.PlayEmbeddedUrl(url);
                    }
                    catch (Exception)
                    {
                        _presentation.ShowDefaultErrorMessage();
                    }
                }
                else
                {
                    _presentation.ShowMessage(new MessageBoxInfo
                    {
                        Button  = MessageBoxButton.OKCancel,
                        Icon    = MessageBoxIcon.Information,
                        Caption = "Install Player",
                        Text    = ""
                    });
                }
            }
        }