0

I'm using System.Windows.Media.MediaPlayer to play videos in a WPF window and apparently when there is a .srt file in the same folder as the the movie that the program loads in the MediaPlayer, it also displays the subtitle.

I was very happy to see that because that means that I don't have to write code to load the subtitle and display it to the screen, but I still want to have control over the subtitle.

I want to control the position of the subtitle on the screen, I want to control the font/font size/the color of the text and to deactivate the subtitle if the user does not need it. How do I do that ?

I use the next code to play the movie in the WPF window:

        VideoDrawing aVideoDrawing = new VideoDrawing();

        aVideoDrawing.Rect = new Rect(0, 0, _CoreMediaPlayer.NaturalVideoWidth, _CoreMediaPlayer.NaturalVideoHeight);

        aVideoDrawing.Player = _CoreMediaPlayer;

        DrawingBrush DBrush = new DrawingBrush(aVideoDrawing);

        DBrush.Stretch = System.Windows.Media.Stretch.Uniform;

        this.Width = _CoreMediaPlayer.NaturalVideoWidth;
        this.Height = _CoreMediaPlayer.NaturalVideoHeight;

        this.Background = DBrush;
Kiquenet
  • 14,494
  • 35
  • 148
  • 243
TheQuestioner
  • 427
  • 1
  • 7
  • 23

0 Answers0