VLC ActiveX插件冻结

时间:2017-11-11 21:52:00

标签: c# activex vlc

我想了解我的问题来自哪里......我的应用在将第三次视频加载到VLC后总是崩溃。我没有收到错误信息或任何它只是冻结的信息。

继承我的代码来播放文件:

private void launchVLC (string url, string title)
    {
        // Si le lecteur est déjà entrain de jouer on stop
        if (isPlaying)
        {
            vlcPlayer.playlist.stop();
            vlcPlayer.playlist.items.clear();
            isPlaying = false;
        }

        try
        {
            // Requête GET vers videos.php pour obtenir le lien direct vers la vidéo
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
            req.Method = "GET";
            req.AllowAutoRedirect = true;

            // On récupère le lien
            HttpWebResponse myResp = (HttpWebResponse)req.GetResponse();
            mediaUrl = myResp.ResponseUri.ToString();

            // On récupére le titre de la vidéo
            Uri uri = new Uri(mediaUrl);
            tabPlayer.Text = System.IO.Path.GetFileName(uri.LocalPath);

            // Switch sur la tab ou ce trouve vlc
            tabBrowser.Hide();
            tabControl1.SelectedIndex = 1;
            tabPlayer.Show();

            // Lancement de la vidéo
            vlcPlayer.playlist.add(mediaUrl, title, null);
            vlcPlayer.playlist.play();

            isPlaying = true;
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message);
        }
    }

注意:每次它都是不同的视频,因此它不能是一个损坏的文件或由于该文件而发生的w / e。

我正在使用VS2017并下载了最新的VLC。

2 个答案:

答案 0 :(得分:0)

我有同样的问题。 然后我检查了任务栏上的内存使用情况,它正在增加。当内存达到极限时,该应用程序不会引起您的注意。 您需要运行一个线程来检查正在运行的进程的内存。 处置播放器后,运行GC.collect()

答案 1 :(得分:0)

我有一个类似的问题,(我只有一个el),但我是这样解决的:

       this.axVLCPlugin21.playlist.stop();
        this.axVLCPlugin21.playlist.items.clear();

        this.axVLCPlugin21.playlist.add(m_MRL, "live", ms_options);
        this.axVLCPlugin21.playlist.play();
相关问题