Results 1 to 4 of 4

Thread: Playing video files each with a duration of 10 seconds

  1. #1

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Playing video files each with a duration of 10 seconds

    Hey guys, I have a problem that I'm finding it hard to locate material on. What I have to do is play some video files one afte the other and keep repeating this indefinitely or until the application is closed off. Each video file is to be played for exactly 20 seconds, so if the file is too long piece will not play and if the file is too short it must repeat for 20 seconds. Now I got the first half of the problem in that I got the video files to play in a playlist and repeat. I added a window media control and my code looks like:

    // Add items to the playlist.
    wmpPlayer.currentPlaylist.appendItem(wmpPlayer.newMedia (@"file.mpeg"));
    wmpPlayer.currentPlaylist.appendItem(wmpPlayer.newMedia (@"pic1.jpg"));

    wmpPlayer.settings.autoStart = true; // Set this option so it will start auto - not working.

    wmpPlayer.settings.setMode("loop", true); // Loop indefinitely.



    Does anyone knows how I could play these two files for an exact duration of time? any help will be greately appreciated.

    And happy new year to everyone. I was on holidays for a while but I'm back - Jennifer

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Playing video files each with a duration of 10 seconds

    I guess you could start a timer with 20-second duration when you start the video, and then in its Tick event stop the video?


    Edit: I just realised this thread is a week old, so ignore me if you've solved it already
    Last edited by penagate; Jan 16th, 2006 at 02:30 PM.

  3. #3

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: Playing video files each with a duration of 10 seconds

    I tried that already. Played the movie within a timer set to a duration of 10 seconds. However there is a little problem. The movie takes approximately 0.5 to 1 second to start playing. Thus when I play about 10 movies in succession, the average time each movie is played when the timer is set to 10 seconds is betwenn 9 to 11 seconds. Is there anyway I could get the value of this timer from window media player?

    Also another problem that arised is that when I'm playing more than one movie, and the movies are switching from one to the next, there is a little pause in between approximately 1/4 to 1/2 second long. Anyone knows how to have a smooth transition between two movies played using win med player in a window application?

    Jennifer

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Playing video files each with a duration of 10 seconds

    If you go through the loop and then back to the beginning again do you still get the delay? If not then I guess the clips must be getting cached. You could use this fact to pre-load your clips to reduce lag. There may also be some event raised by WMP when it actually starts playing the clip. If so you could Stop the Timer when you tell WMP to play the clip and then Start the Timer again when it actually starts playing. This is all conjecture of course. I have no real idea what I'm talking about.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width