Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8583463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:32:40+00:00 2026-06-11T21:32:40+00:00

what i want to do is pause a video after every 10s the video

  • 0

what i want to do is pause a video after every 10s
the video should pause after ever 10s till the video ends

the code given below gives unexpected results
the video pauses fine for the firs time (i.e after 10s)
but when i play again it should pause after 10s but in my case it pauses randomly sometimes at 8s,3s 5s and etc
what should i do??
please help
thanks!!

void PlayClick(object sender, EventArgs e)
{
             VideoControl.Play();
            var dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 10);
            dispatcherTimer.Start();
 }

 private void dispatcherTimer_Tick(object sender, EventArgs e)
        {

            VideoControl.Pause();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:32:41+00:00Added an answer on June 11, 2026 at 9:32 pm
    1. Add this in your dispatcherTimer_Tick-Method:

      dispatcherTimer.Stop();
      
    2. Move the following part into the constructor:

      dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
      dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
      dispatcherTimer.Interval = new TimeSpan(0, 0, 10);
      
    3. Make the DispatcherTimer a global variable.

    EDIT: Thats how it should look like:

        class MyClass
        {
            private DispatcherTimer _dispatcherTimer; //now your dispatcherTimer is accessible everywhere in this class
    
            public MyClass()
            {
                _dispatcherTimer = new DispatcherTimer();
                _dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
                _dispatcherTimer.Interval = new TimeSpan(0, 0, 10);
            }
    
            void PlayClick(object sender, EventArgs e)
            {
                VideoControl.Play();
                _dispatcherTimer.Start();
            }
    
            void dispatcherTimer_Tick(object Sender, EventArgs e)
            {
                _dispatcherTimer.Stop();
                VideoControl.Pause();
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to pause the video being played at a particular instant till a
i want to play the video of this URL http://www.youtube.com/watch?v=JPUWNcGDyvM&feature=player_embedded where i PAUSE last
I want to pause 1 second for every time it loops, it is usually
I want to insert a pause in my create after loading the layout before
I want to create java program that can pause / play the vlc video
I want to detect events like Video is playing Video has been paused Video
As soon as View Loads I want to display a paused video, with its
I want to pause UIImageView animation and based on my research found that you
I want to pause the timer thread....or i can say want to put it
I want to pause my android application when the phone receives an incoming call.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.