예제 #1
0
 internal void SetMediaPlayerElement(MediaPlayerElement mediaPlayerElement)
 {
     _mpe = mediaPlayerElement;
 }
예제 #2
0
        private async Task InitializeMPE()
        {
            var mpe = new Windows.UI.Xaml.Controls.MediaPlayerElement();

            if (sizeChk.IsChecked.Value)
            {
                mpe.Width  = 200.0 * scale;
                mpe.Height = 170.0 * scale;
            }

            m = mpe;

            if (this.enableMTC.IsChecked.Value)
            {
                mpe.AreTransportControlsEnabled = true;
                mpe.AutoPlay = false;
                if (IsPlayList)
                {
                    mpe.TransportControls.IsNextTrackButtonVisible     = true;
                    mpe.TransportControls.IsPreviousTrackButtonVisible = true;

                    /*
                     * mpe.TransportControls.IsPlaybackRateButtonVisible = true;
                     * mpe.TransportControls.IsFastForwardButtonVisible = true;
                     * mpe.TransportControls.IsFastRewindButtonVisible = true;
                     * mpe.TransportControls.IsFullWindowButtonVisible = true;
                     * mpe.TransportControls.IsSkipBackwardButtonVisible = true;
                     * mpe.TransportControls.IsSkipForwardButtonVisible = true;
                     * mpe.TransportControls.IsStopButtonVisible = true;
                     * mpe.TransportControls.IsVolumeButtonVisible = true;
                     * mpe.TransportControls.IsZoomButtonVisible = true;
                     */
                }
            }
            else
            {
                mpe.AutoPlay                    = true;
                mpe.TransportControls           = null;
                mpe.AreTransportControlsEnabled = false;
            }

            mpe.AutoPlay = this.autoPlay.IsChecked.Value;

            mpe.Stretch = GetStretchMode(this.stretchMode.SelectedIndex);

            if (this.enableFullWindow.IsChecked.Value)
            {
                mpe.IsFullWindow = true;
            }

            if (this.poster.IsChecked.Value)
            {
                var bitmapImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage();
                var urlStr      = MediaData.PosterUrlStr;
                bitmapImage.UriSource = new Uri(urlStr);
                mpe.PosterSource      = bitmapImage;
            }

            if (this.extPlayer.IsChecked.Value)
            {
                var mp = new MediaPlayer();
                mpe.SetMediaPlayer(mp);
            }
            else
            {
                mpe.Source = await CreateSource();
            }

            MediaPanel.Children.Add(mpe);
            await Dispatcher.RunIdleAsync((v) =>
            {
                presenter = VisualTreeUtils.FindElementOfTypeInSubtree <MediaPlayerPresenter>(mpe);
            });

            //VideoElementContainer.Content = mpe;

            Log.Text = "made it";

            mpe.Tapped         += OnTapped;
            mpe.PointerPressed += this.OnPointerPressed;
            mpe.DoubleTapped   += this.OnDoubleTapped;
            //mpe.TransportControls.DoubleTapped += this.OnDoubleTapped;
        }