Exemple #1
0
        public PlayerView()
        {
            InitializeComponent();

            NavigationPage.SetHasNavigationBar(this, false);

            Player = DependencyService.Get <IPlayerService>(DependencyFetchTarget.NewInstance);

            Player.StateChanged()
            .ObserveOn(SynchronizationContext.Current)
            .Subscribe(OnPlayerStateChanged, OnPlayerCompleted);

            Player.PlaybackError()
            .ObserveOn(SynchronizationContext.Current)
            .Subscribe(async message => await OnPlaybackError(message));

            Player.BufferingProgress()
            .ObserveOn(SynchronizationContext.Current)
            .Subscribe(OnBufferingProgress);

            PlayButton.Clicked += (s, e) => { Play(); };

            PropertyChanged += PlayerViewPropertyChanged;

            _seekLogic = new SeekLogic(this);
        }
Exemple #2
0
 private void InitializeJuvoPlayer()
 {
     Player = new PlayerServiceProxy(new PlayerServiceImpl(window));
     Player.StateChanged()
     .Subscribe(OnPlayerStateChanged, OnPlaybackCompleted);
     Player.PlaybackError()
     .Subscribe(message =>
     {
         var param = new JObject();
         param.Add("Message", message);
         SendEvent("onPlaybackError", param);
     });
     Player.BufferingProgress()
     .Subscribe(UpdateBufferingProgress);
 }
Exemple #3
0
        private void HandlePlaybackStart()
        {
            if (Player == null)
            {
                Player = new Player(_playerWindow);
                Player.StateChanged()
                .ObserveOn(SynchronizationContext.Current)
                .Where(state => state == Common.PlayerState.Prepared)
                .Subscribe(state =>
                {
                    if (Player == null)
                    {
                        return;
                    }
                    _options.LoadStreamLists(Player);
                    Player.Start();
                }, () => { _playbackCompletedNeedsHandling = true; });

                Player.PlaybackError()
                .ObserveOn(SynchronizationContext.Current)
                .Subscribe(message =>
                {
                    Logger?.Info($"Playback Error: {message}");
                    ReturnToMainMenu();
                    DisplayAlert("Playback Error", message, "OK");
                });

                Player.BufferingProgress()
                .ObserveOn(SynchronizationContext.Current)
                .Subscribe(UpdateBufferingProgress);
            }

            Logger?.Info(
                $"Playing {_resourceLoader.ContentList[_selectedTile].Title} ({_resourceLoader.ContentList[_selectedTile].Url})");
            Player.SetSource(_resourceLoader.ContentList[_selectedTile]);
            _options.ClearOptionsMenu();
            _seekLogic.IsSeekInProgress = false;
            _bufferingInProgress        = false;
            _bufferingProgress          = 0;
        }
        private void InitializeJuvoPlayer()
        {
            Player = new PlayerServiceProxy <PlayerServiceImpl>();
            Player.SetWindow(window);
            playerStateChangeSub = Player.StateChanged()
                                   .Subscribe(OnPlayerStateChanged, OnPlaybackCompleted);
            playbackErrorsSub = Player.PlaybackError()
                                .Subscribe(message =>
            {
                var param = new JObject();
                param.Add("Message", message);
                SendEvent("onPlaybackError", param);
            });
            bufferingProgressSub = Player.BufferingProgress()
                                   .Subscribe(UpdateBufferingProgress);

            playbackTimer = new Timer(
                callback: new TimerCallback(UpdatePlayTime),
                state: seekLogic.CurrentPositionUI,
                dueTime: Timeout.Infinite,
                period: Timeout.Infinite);
        }
        public PlayerView()
        {
            InitializeComponent();

            NavigationPage.SetHasNavigationBar(this, false);

            Player = DependencyService.Get <IPlayerService>(DependencyFetchTarget.NewInstance);

            _subscriptions = new CompositeDisposable
            {
                Player.StateChanged()
                .ObserveOn(SynchronizationContext.Current)
                .Subscribe(OnPlayerStateChanged, OnPlayerCompleted),

                Player.PlaybackError()
                .ObserveOn(SynchronizationContext.Current)
                .Subscribe(async message => await OnPlaybackError(message)),

                Player.BufferingProgress()
                .ObserveOn(SynchronizationContext.Current)
                .Subscribe(OnBufferingProgress)
            };

            PlayButton.Clicked += (s, e) => { Play(); };

            Progressbar.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "Progress")
                {
                    UpdateSeekPreviewFramePosition();
                }
            };

            PropertyChanged += PlayerViewPropertyChanged;

            _seekLogic = new SeekLogic(this);
        }
 public IObservable <int> BufferingProgress()
 {
     return(proxied.BufferingProgress());
 }