0

我开发了一个 Winform 应用程序,它有一个面板作为主屏幕,每侧有两个其他面板用于上一个和下一个视频。和两个按钮,帮助应用程序遍历不同的视频并将其设置到主面板。我现在有 21 个视频......这是我的代码......

public void loadvideo2(int a)
    {

            int width = viewscreen.Width;
            int height = viewscreen.Height;
            int width1 = nxtpnl.Width;
            int height1 = nxtpnl.Height;
            int width2 = prepnl.Width;
            int height2 = prepnl.Height;

            video = new Video(vpath[a]);
            video.Owner = viewscreen;
            video.Stop();
            viewscreen.Size = new Size(width, height);

            video1 = new Video(vpath[a + 1]);
            video1.Owner = nxtpnl;
            video1.Stop();
            nxtpnl.Size = new Size(width1, height1);

            video2 = new Video(vpath[a - 1]);
            video2.Owner = prepnl;
            video2.Stop();
            prepnl.Size = new Size(width2, height2);

            plystpBtn.BackgroundImage = Video_Project.Properties.Resources.Style_Play_icon__1_;
            plystpBtn.BackgroundImageLayout = ImageLayout.Stretch;

            trckstatus.Minimum = Convert.ToInt32(video.CurrentPosition);
            trckstatus.Maximum = Convert.ToInt32(video.Duration);

            duration = CalculateTime(video.Duration);
            playposition = "0:00:00";
            posdurtrclbl.Text = playposition + "/" + duration;

            b = a;
            vlbl.Text = "Video" + Convert.ToString(b);
        } 

 private void preBtn_Click(object sender, EventArgs e)
    {
        videono += 1;
        if (videono <= vcount-1)
        {
            loadvideo2(videono);
        }
        else
            MessageBox.Show("File Not Found!!!");
    }

 private void nxtBtn_Click(object sender, EventArgs e)
    {
            videono -= 1;
            if (videono >= 0)
            {
                loadvideo2(videono);
            }
            else
                MessageBox.Show("FIle Not Found!!!");
    }

现在,当我通过按下按钮遍历视频时,它工作正常,直到第 16 个视频,我收到一条错误消息

ffmpeg.dll failed to load

谁能帮我解决这个问题

4

1 回答 1

0

解决了。这可能是一个内存消耗问题。

public void loadvideo2(int a)
    {


            int width = viewscreen.Width;
            int height = viewscreen.Height;
            int width1 = nxtpnl.Width;
            int height1 = nxtpnl.Height;
            int width2 = prepnl.Width;
            int height2 = prepnl.Height;

            video.Dispose();


            video = new Video(vpath[a]);
            video.Owner = viewscreen;
            video.Stop();
            viewscreen.Size = new Size(width, height);

            video1 = new Video(vpath[a + 1]);
            video1.Owner = nxtpnl;
            video1.Stop();
            nxtpnl.Size = new Size(width1, height1);

            video2 = new Video(vpath[a - 1]);
            video2.Owner = prepnl;
            video2.Stop();
            prepnl.Size = new Size(width2, height2);



            plystpBtn.BackgroundImage = Video_Project.Properties.Resources.Style_Play_icon__1_;
            plystpBtn.BackgroundImageLayout = ImageLayout.Stretch;

            trckstatus.Minimum = Convert.ToInt32(video.CurrentPosition);
            trckstatus.Maximum = Convert.ToInt32(video.Duration);

            duration = CalculateTime(video.Duration);
            playposition = "0:00:00";
            posdurtrclbl.Text = playposition + "/" + duration;

            b = a;
            vlbl.Text = "Video" + Convert.ToString(b);
            video1.Dispose();
            video2.Dispose();
        }
于 2012-09-19T10:40:18.873 回答