本文介绍了在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();
}
推荐答案
这篇关于在TreeView中播放下一个视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!