0

Windowsストアアプリケーションを実装したメディアプレーヤーがあります。このアプリケーションでは、ユーザーはメディアプレーヤーを介してストリームを視聴できます。URL のような C# コードでストリーム リンクを提供します。ユーザーが再生をクリックすると、ストリームが視聴されます。どうやってやるの?Mediaplayer コードは次のとおりです。

int flag = 0;
        private Size _previousVideoContainerSize = new Size();

        private void FullscreenToggle()
        {
            if (flag == 0)
            {
                TransportControlsPanel.Visibility = Visibility.Collapsed;
                _previousVideoContainerSize.Width = videoContainer.ActualWidth;
                _previousVideoContainerSize.Height = videoContainer.ActualHeight;
                videoContainer.Width = Window.Current.Bounds.Width;
                videoContainer.Height = Window.Current.Bounds.Height;
                exit.Visibility = Visibility.Visible;
                inn.Visibility = Visibility.Collapsed;
                flag = 1;
            }
            else
            {
                TransportControlsPanel.Visibility = Visibility.Visible;
                videoContainer.Width = _previousVideoContainerSize.Width;
                videoContainer.Height = _previousVideoContainerSize.Height;
                exit.Visibility = Visibility.Collapsed;
                inn.Visibility = Visibility.Visible;
            }
        }

        private void btnFullScreenToggle_Click(object sender, RoutedEventArgs e)
        {
            FullscreenToggle();
        }

        private void VideoContainer_KeyUp(object sender, KeyRoutedEventArgs e)
        {
            if (flag == 1 && e.Key == Windows.System.VirtualKey.Escape)
            {
                FullscreenToggle();
            }

            e.Handled = true;
        }

        private void btnPlay_Click(object sender, RoutedEventArgs e)
        {
            if (videoMediaElement.DefaultPlaybackRate != 1)
            {
                videoMediaElement.DefaultPlaybackRate = 1.0;
            }

            videoMediaElement.Play();
        }

        private void btnStop_Click(object sender, RoutedEventArgs e)
        {
            videoMediaElement.Stop();
        }

        private void btnVolumeDown_Click(object sender, RoutedEventArgs e)
        {
            if (videoMediaElement.IsMuted)
            {
                videoMediaElement.IsMuted = false;
            }

            if (videoMediaElement.Volume < 1)
            {
                videoMediaElement.Volume += .1;

            }
            vol.Value -= 5;
        }
        private void btnMute_Click(object sender, RoutedEventArgs e)
        {
            videoMediaElement.IsMuted = !videoMediaElement.IsMuted;
        }
        private void btnVolumeUp_Click(object sender, RoutedEventArgs e)
        {
            if (videoMediaElement.IsMuted)
            {
                videoMediaElement.IsMuted = false;
            }

            if (videoMediaElement.Volume > 0)
            {
                videoMediaElement.Volume -= .1;
            }
            vol.Value += 5;
        }

よろしく...

4

1 に答える 1