1

デスクトップとマイクからの音声を同時に記録するアプリケーションを作成する必要があります。このファイルは、指定されたパスに自動的に保存される必要があります。DLL Windows Media Encoder を使用してアプリケーションを構築しようとしました。しかし、私たちが直面している問題は、セクションを手動でシステム フォルダに保存するためのポップアップ ウィンドウが表示されることです。これはうまくいっています。ただし、そのポップアップ ウィンドウを表示する必要はなく、セクションは指定されたパスに自動的に保存されます。ここから試してみましたが、保存されたセクションのオーディオの一部が欠落しています。これに対する解決策を見つけるのを手伝ってくれる人はいますか? 以下のコードを確認してください。

     try
        {
            if (DesktopEncoder != null)
            {
                DesktopEncoder.Stop();
                SaveFileDialog dialog = new SaveFileDialog();
                dialog.Filter = "Video Files (*.wmv)|*.wmv";
                dialog.DefaultExt = "wmv";
                DialogResult res = dialog.ShowDialog();
                if (res != DialogResult.Cancel)
                {
                    if (File.Exists(DirectoryPath + "\\Demo\\tempScreenRecordVideo\\tempscreenvideo.wmv"))//ConfigurationSettings.AppSettings["demoTempScreenRecordVideo"]
                    {
                        recentRecordingsToolStripMenuItem1.DropDownItems.Add(dialog.FileName, null, recentRecordings_Click);
                        recentRecordingsToolStripMenuItem.DropDownItems.Add(dialog.FileName, null, recentRecordings_Click);
                        if (File.Exists(dialog.FileName))
                            File.Delete(dialog.FileName);

                        File.Copy(DirectoryPath + "\\Demo\\tempScreenRecordVideo\\tempscreenvideo.wmv", dialog.FileName);//ConfigurationSettings.AppSettings["demoTempScreenRecordVideo"]
                        if (DesktopEncoder.RunState != WMENC_ENCODER_STATE.WMENC_ENCODER_RUNNING && DesktopEncoder.RunState != WMENC_ENCODER_STATE.WMENC_ENCODER_PAUSED)
                        {
                            File.Delete(DirectoryPath + "\\Demo\\tempScreenRecordVideo\\tempscreenvideo.wmv");//ConfigurationSettings.AppSettings["demoTempScreenRecordVideo"]
                        }
                        if (File.Exists(DirectoryPath + "\\Demo\\ScreenRecordVideo\\screenvideo.wmv"))//ConfigurationSettings.AppSettings["demoScreenRecordVideo"]
                            File.Delete(DirectoryPath + "\\Demo\\ScreenRecordVideo\\screenvideo.wmv");//ConfigurationSettings.AppSettings["demoScreenRecordVideo"]
                        File.Copy(dialog.FileName, DirectoryPath + "\\Demo\\ScreenRecordVideo\\screenvideo.wmv");//ConfigurationSettings.AppSettings["demoScreenRecordVideo"]
                        File.Delete(dialog.FileName);
                    }
                }
                tmrRcCounter.Enabled = false;
                tsRecDuration.Text = "";
                tmrViewerCount.Enabled = false;
                if (this.Visible)
                {
                    notifyRecorder.Text = "Recorder is in Visible Mode.";
                }
                else
                {
                    notifyRecorder.Text = "Recorder is in Invisible Mode.";
                }
                //Windows Media Encoder EXE.
                Process[] ps = Process.GetProcessesByName("wmenc");
                if (ps.Length != 0)
                {
                    ps[0].Kill();
                }
                DesktopEncoder = null;
                tmrRcCounter.Enabled = false;
            }
        }
        catch
        {
            MessageBox.Show("Can't Stop it.Please,Save Current Recording and Restart Application.");
        }

4

0 に答える 0