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 8132487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:21:45+00:00 2026-06-06T09:21:45+00:00

We have a video (13 minutes long) which we would like to control using

  • 0

We have a video (13 minutes long) which we would like to control using HTML5. We want to be able to let our users control and select the parts of the video they want to play. Preferably this control would be through 2 input fields. They would input start time (in seconds) in first box and input duration to play (in seconds) in second box. For example, they might want to start the video 10 seconds in and play for 15 seconds. Any suggestions or guidance on the Javascript needed to do this?

Note: I have found the following:

  • Start HTML5 video at a particular position when loading?

But it addresses only starting at a particular time, and nothing with playing the video for a specified length of time.

  • 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-06T09:21:46+00:00Added an answer on June 6, 2026 at 9:21 am

    You could use the timeupdate event listener.

    Save the start time and duration time to variable after loadedmetadata event.

    // Set video element to variable
    var video = document.getElementById('player1');
    
    var videoStartTime = 0;
    var durationTime = 0;
    
    video.addEventListener('loadedmetadata', function() {
      videoStartTime = 2;
      durationTime = 4;
      this.currentTime = videoStartTime;
    }, false);
    

    If current time is greater than start time plus duration, pauses the video.

    video.addEventListener('timeupdate', function() {
      if(this.currentTime > videoStartTime + durationTime){
        this.pause();
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a video that is 60 seconds long. I am working on adding
I have a video i'm storing on my server. I dont want people to
I have one video object and 3 thumbnails which, when clicked, will play different
I have the video gallery in my database, which has over 200 000 videos.
i have to implement flash streaming for the relaunch of our video-on-demand system but
I have a long running job that updates 1000's of entity groups. I want
I have a site which has a section containing a Youtube video and the
I have an interesting project wherein I need to allow users to capture video
I have video durations stored in HH:MM:SS format. I'd like to display it as
I have a ten minute long video where people can stop the video and

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.