[英]Passing video path from a media element to a media element within another class
嗨,我正在開發與Power Point類似的軟件。 要添加視頻,請添加視頻幻燈片,然后選擇瀏覽以搜索視頻。 添加視頻后,您可以選擇右鍵單擊該視頻,然后在選項內將是編輯視頻。 選擇編輯視頻將彈出另一個頁面,其中包含媒體元素,並在其下面帶有播放,暫停,停止按鈕的滑動條。 當我從主窗口類調用視頻編輯器類時,視頻路徑肯定正確傳遞了(我已逐步完成並找到了此路徑)它將視頻路徑添加到媒體元素源,但從未加載,就好像該路徑從未被加載一樣通過了。 在編輯器中,有一個瀏覽按鈕可添加更多視頻,當我以這種方式添加視頻時,它們會與媒體元素一起正確顯示。
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方法是在主窗口中調用的方法
私人無效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();
}
我通過__props.Video傳遞視頻,並且在VideoWindow類的頁面加載中,我將media元素設置為具有路徑。 此后,我已經在該類中創建了一個方法,如果經過路徑,現在將該路徑傳遞到media元素中,則在VideoWindow類的頁面加載中調用該方法:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.