how to repeat the files stored in d playlist
-
the following code plays video files by storing it in a playlist.But it stops when the last file is played. I want the files to play in repeat mode...how can i enable repeat mode, in my code plz help----- thanks !!!! ************************************************************************** using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } System.IO.FileInfo[] files = null; int index = 0; string plist; private void Form1_Load(object sender, EventArgs e) { System.IO.DirectoryInfo df = new DirectoryInfo("C://Images"); files = df.GetFiles("*.wma"); WMPLib.IWMPPlaylist pl; pl = axWindowsMediaPlayer1.mediaCollection.getByName(plist); WMPLib.IWMPMedia m; if (files != null) { if (files.Length <= index) { index = 0; } else { m = axWindowsMediaPlayer1.newMedia(files[index++].FullName); pl.appendItem(m); } } axWindowsMediaPlayer1.currentPlaylist = pl; } } } ************************************************************************** ----mist-----
-
the following code plays video files by storing it in a playlist.But it stops when the last file is played. I want the files to play in repeat mode...how can i enable repeat mode, in my code plz help----- thanks !!!! ************************************************************************** using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } System.IO.FileInfo[] files = null; int index = 0; string plist; private void Form1_Load(object sender, EventArgs e) { System.IO.DirectoryInfo df = new DirectoryInfo("C://Images"); files = df.GetFiles("*.wma"); WMPLib.IWMPPlaylist pl; pl = axWindowsMediaPlayer1.mediaCollection.getByName(plist); WMPLib.IWMPMedia m; if (files != null) { if (files.Length <= index) { index = 0; } else { m = axWindowsMediaPlayer1.newMedia(files[index++].FullName); pl.appendItem(m); } } axWindowsMediaPlayer1.currentPlaylist = pl; } } } ************************************************************************** ----mist-----
create a bool field
bool keepPlaying = true; then while (keepPlaying) { pl.Clear() // This might not be exactly correct, look up how to clear the list if (files != null) { if (files.Length <= index) { index = 0; } else { m = axWindowsMediaPlayer1.newMedia(files[index++].FullName); pl.appendItem(m); } } axWindowsMediaPlayer1.currentPlaylist = pl; } then you can have a cancel button and in the `onclick` handler have `keepPlaying = false;`. Of course that will only stop when it reaches the end of the playlist, unless you also stop the player when setting the flag to false. You are having a lot of problems getting this application working, mostly with concepts that are elementary. I would seriously suggest that you get a C# getting started book and work through it, before continuing. Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”