Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to repeat the files stored in d playlist

how to repeat the files stored in d playlist

Scheduled Pinned Locked Moved C#
databasegraphicshelptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mist_psycho
    wrote on last edited by
    #1

    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-----

    H 1 Reply Last reply
    0
    • M mist_psycho

      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-----

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      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.”

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups