在TreeView中播放下一个视频 [英] Play next video in TreeView

查看:62
本文介绍了在TreeView中播放下一个视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用wmp控件来播放我的文件。我能够通过点击它来播放第一个文件,并在第一个文件结束后将节点更改为下一个文件,但是我无法在下一个节点中播放下一个视频selecetd。

有人可以帮我解决这个问题吗?

这是我的代码:

I am using wmp control to play my files. I am able to play the first file by clicking on it, and change the node to the next file after the first one ended, but I can't play the next video selecetd in the next node.
Can someone please help me fix this problem?
Here is my code:

private void list_AfterSelect(object sender, TreeViewEventArgs e)
        {
            player.Ctlcontrols.stop();
            player.close();
            directoryInfo = new DirectoryInfo(Directory.GetCurrentDirectory().ToString());            
            var directoryNode = new TreeNode(directoryInfo.Name);
            TreeNode Cnode = e.Node;
            String path2 = Cnode.FullPath;
            path.Text = path2;
            list.Visible = false;
            ruta = Path.GetFullPath(Path.GetFileName(Path.GetFileName(path.Text)));
            player.URL = Path.GetFullPath(Path.GetFileName(Path.GetFileName(path.Text)));
            directoryInfo = new DirectoryInfo(Directory.GetCurrentDirectory().ToString());
            player.Ctlcontrols.play();
        }
private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {            
            if (player.playState == WMPLib.WMPPlayState.wmppsMediaEnded)
            {                                
                player.Ctlcontrols.stop();
                player.close();
                TreeNode obj = new TreeNode();
                obj = list.SelectedNode;                
                list.SelectedNode = obj.NextNode;
                player.URL = (Path.GetFullPath(Path.GetFileName(path.Text)));                
                player.Ctlcontrols.play();                              
            }

推荐答案

如果我理解你,你必须提供一种连续播放视频文件的方法。



看看这里:如何:遍历Windows窗体TreeView控件的所有节点 [ ^ ]







我认为它可能有用: http://stackoverflow.com/questions/14063843/how-to-add-multiple-files-to-a-playlist
If i understand you well, you have to provide a method to play video files continuously.

Have a look here: How to: Iterate Through All Nodes of a Windows Forms TreeView Control[^]



I think it might be useful: http://stackoverflow.com/questions/14063843/how-to-add-multiple-files-to-a-playlist


I在这个网站找到了解决方案:



http://stackoverflow.com/questions/1406384 3 /如何添加多个文件到播放列表 [ ^ ]
I found the solution in this site:

http://stackoverflow.com/questions/14063843/how-to-add-multiple-files-to-a-playlist[^]


这篇关于在TreeView中播放下一个视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆