Beispiel #1
0
        private void SetupPlayerFragment()
        {
            var appPrefs = ApplicationMain.ServiceLocator.GetInstance<ApplicationPreference>();

            var transaction = this.FragmentManager.BeginTransaction();
            var playerType = appPrefs.PlayerType.Value;

            // RTMPは突然の死を迎えることがある…
            if (!appPrefs.IsLastShutdownCorrectly.Value && appPrefs.StreamingType.Value == StreamingType.Rtmp)
            {
                appPrefs.StreamingType.Value = StreamingType.Hls;
            }

            var newFragment = (playerType == PlayerType.ExoPlayer)
                ? (PlaybackPlayerFragmentBase)new PlaybackExoPlayerFragment()
                    : (playerType == PlayerType.AndroidDefault)
                        ? (PlaybackPlayerFragmentBase)new PlaybackDefaultVideoViewFragment()
                        : (PlaybackPlayerFragmentBase)new PlaybackWebViewPlayerFragment();

            if (this._playerFragment != null)
            {
                transaction.Replace(Resource.Id.MainFrame, newFragment, newFragment.GetType().Name);
            }
            else
            {
                transaction.Add(Resource.Id.MainFrame, newFragment, newFragment.GetType().Name);
            }
            transaction.Commit();

            this._playerFragment = newFragment;
            this._playerFragment.Play();

            ApplicationMain.ServiceLocator.GetInstance<ApplicationPreference>().IsLastShutdownCorrectly.Value = false; // 正常シャットダウンフラグを折っておく
        }
 public PlaybackControlsRowViewModel(PlaybackPlayerFragmentBase playbackPlayer, NowPlaying nowPlaying)
 {
     this.PlaybackPlayer = playbackPlayer;
     this.NowPlaying = nowPlaying;
 }