JD2022-TU1/main/tools/legacy/CrashDumpSender/VideoPlayer.cs

69 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;
namespace CrashDumpSender
{
public partial class VideoPlayer
{
Video Movie = null;
Size MovieDefaultSize;
float Aspect;
int InitialClientWidth = 0;
public VideoPlayer()
{
}
public void unAttach(Control newScreen)
{
Movie.Owner = newScreen;
}
public void Play(string MediaFile,Control screen,bool autoSize)
{
PlayThisMovie(MediaFile, screen, autoSize);
}
private void PlayThisMovie(string sThisMovie, Control screen, bool autoSize)
{
string sMovieName = sThisMovie;
try
{
Movie = new Video(sThisMovie.ToLower());
}
catch
{
//silent mp4 is not supported
//MessageBox.Show("Unable to play " + sMovieName);
return;
}
if (autoSize)
MovieDefaultSize = screen.ClientSize;
Movie.Owner = screen;
int UseWidth = Math.Max(MovieDefaultSize.Width, InitialClientWidth);
int UseHeight = MovieDefaultSize.Height;
Aspect = (float)((float)MovieDefaultSize.Width / (float)MovieDefaultSize.Height);
int h = (int)(float)(MovieDefaultSize.Width / Aspect);
Movie.Size = new Size(MovieDefaultSize.Width, h);
Movie.Play();
}
}
}