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

  • Home
  • SEARCH
  • 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 8884011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:57:35+00:00 2026-06-14T20:57:35+00:00

I am trying to pause a video on a specific location in my test

  • 0

I am trying to pause a video on a specific location in my test code, and trying to start it from a totally different position. It eventually did start from the other point but when it pauses again, it moves back to the first instance it registered. I’d like to know what am I doing wrong in this code.

The code in CS file is

namespace timer_thread_and_gui
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
        DispatcherTimer timer;
        DispatcherTimer timer1;


    public MainWindow()
    {
        InitializeComponent();

   }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        timer1 = new DispatcherTimer();
        timer1.Tick += new EventHandler(dispatcherTimer_Tick1);
        timer1.Interval = new TimeSpan(0, 0, 10);

                    timer = new DispatcherTimer();
                    timer.Tick += new EventHandler(dispatcherTimer_Tick);
                    timer.Interval = new TimeSpan(0, 0, 5);
                    video_panel.Play();




            timer1.Start();
            timer.Start();




    }

    private void dispatcherTimer_Tick(object sender, EventArgs e)
    {
        this.draw_an_elipse();

       draw_an_elipse()
    {
       ++a;
       txt.Text = a.ToString();



       if (a%5==0)
       {
           video_panel.Stop();
           video_panel.Position = new TimeSpan(0, 18, 30);

           video_panel.Play();
           timer1.Start();
       }
    }

   private void dispatcherTimer_Tick1(object sender, EventArgs e)
   {

    video_panel.Pause();
    timer1.Stop();
   }

}

And the XAML code is

<MediaElement Height="266" HorizontalAlignment="Left" Margin="12,33,0,0" Name="video_panel" 
                  VerticalAlignment="Top" Width="474" 
                  LoadedBehavior="Manual" UnloadedBehavior="Stop" 
                  Source="c:\users\ayymmoo\documents\visual studio 2010\Projects\Unfinished.avi" />
  • 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-14T20:57:36+00:00Added an answer on June 14, 2026 at 8:57 pm

    If you want to jump to another position depending on the position where the video was stopped, your TimeSpan should be relative to this stop position, and not absolute:

    If you want, say, jump over 10 seconds after the pause, that should be like that:

    MediaElement.Position += TimeSpan.FromSeconds(10);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pause and play YouTube videos with the following code which is
I'm trying to pause a video in jw player when the mouse is not
I am trying to develop an Android based application, which can play video from
I'm trying to make a small extension to allow me to play/pause a video
I'm trying to create an app to stream video from an ip-camera to android
I am trying to displaying a ProgressDialog before a video with the following code:
I'm trying to pause the video when the user clicks on it but looks
I am looking to be able to pause a vimeo video from a separate
I'm trying to control the play and pause function an HTML5 video using the
I'm trying to create an easy play / pause button system with Raphael but

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.