Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have recently explored
C#
Microsoft.DirectX.AudioVideoPlayback;

i'm able play video. but i've short video which needs to looped in the background how can i do it there is
C#
Video.Duration
Can i use it to loop my video?? if ,yes is the answer then how can i use it??
Posted

1 solution

C#
public partial class Form1 : Form
{
     Video video;



    public Form1()
    {
        InitializeComponent();
        Initializevid1();

    }

    public void Initializevid1()
    {

           // store the original size of the panel
            int width = viewport.Width;
            int height = viewport.Height;

            // load the selected video file
            video = new Video("C:\\Users\\Dave\\Desktop\\WaterDay1.wmv");

            // set the panel as the video object’s owner
            video.Owner = viewport;

            // stop the video
            video.Play();
            video.Ending +=new EventHandler(BackLoop);

            // resize the video to the size original size of the panel
            viewport.Size = new Size(width, height);

    }

    private void BackLoop(object sender, EventArgs e)
    {

        video.CurrentPosition = 0;// Video keeps looping...
    }
 
Share this answer
 

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