Click here to Skip to main content
15,886,077 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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();                              
            }
Posted

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[^]


[EDIT]
I think it might be useful: http://stackoverflow.com/questions/14063843/how-to-add-multiple-files-to-a-playlist
 
Share this answer
 
v3
Comments
Member 10850253 20-Sep-15 12:33pm    
I already can change to the next node, but what I can't do is make wmp play the next file in the next node.
Can you please help me?
 
Share this answer
 
v2
Comments
PIEBALDconsult 20-Sep-15 17:13pm    
Please don't answer your own question. You can use "improve question" to add detail and context to your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900