こんにちは、私はパワーポイントに似たソフトウェアに取り組んでいます。ビデオを追加するには、ビデオ スライドを追加し、[参照] を選択してビデオを検索します。ビデオが追加されると、そのビデオを右クリックするオプションがあり、オプション内でビデオを編集できます。ビデオの編集を選択すると、メディア要素と、その下に再生、一時停止、停止ボタンのあるスライド バーを含む別のページが表示されます。メイン ウィンドウ クラスからビデオ エディター クラスを呼び出すと、ビデオ パスが確実に正しく渡されます (ステップスルーしてこれを見つけました)。ビデオ パスをメディア要素ソースに追加しますが、パスが決してロードされなかったかのようにロードされません。渡した。エディタ内には、さらにビデオを追加するための参照ボタンがあり、この方法でビデオを追加すると、メディア要素とともに正しく表示されます。
VideoWindow は、ビデオ エディターのクラスです。
public VideoWindow(Video __video, Roots __roots)
{
InitializeComponent();
_roots = __roots;
string videoFilePathFull = "";
foreach (string file in Directory.EnumerateFiles(_roots.RunTimeTemp, "*.mp4*", SearchOption.AllDirectories))
{
videoFilePathFull = file;
}
mediaElement1.Source = new Uri(videoFilePathFull, UriKind.Relative);
_staticVideo = __video;
_tempVideo.Path = videoFilePathFull;
initVideo();
}
editVideoElement メソッドは、メイン ウィンドウ内で呼び出されるメソッドです。
private void editVideoElement(オブジェクト送信者, RoutedEventArgs e) {
string __vidFileName = "";
DesignerItem __item = getSingleSelectedElement();
ComponentProperties __props = _slideFactory.GetComponentProperties(__item.Name);
__vidFileName = __props.Video.Path;
VideoWindow __slideVideo = new VideoWindow(__props.Video, roots);
__slideVideo.Owner = this;
__slideVideo.ShowDialog();
}