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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:26:22+00:00 2026-06-10T23:26:22+00:00

HTML : <video id=player class=video-js vjs-default-skin controls preload=auto width=400 height=264 data-setup={}> <source src=http://video-js.zencoder.com/oceans-clip.mp4 type=’video/mp4′>

  • 0

HTML :

<video id="player" class="video-js vjs-default-skin" controls
  preload="auto" width="400" height="264"
  data-setup="{}">
  <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4'>
  <source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm'>
</video>

<a href="#">Click to play video</a>    
<br>
<code></code>

JS :

var player = _V_("player");
var pasue_check = false;

$("a").click(function() {
  player_play();
});


function player_play() {
$("#player").fadeIn();
$("a").fadeOut();

player.ready(function(){
player.play().addEvent("ended",player_ended);
player.addEvent("pause",player_pause);
player.play().addEvent("play",player_resume);
});

}


function player_ended() {
$("#player").fadeOut();
$("a").fadeIn();

    if(pasue_check== true) {
     clearInterval(countInterval);
     pasue_check = false;
    }
    pasue_check = false;
}


function player_pause() {
    count = 1;

    countInterval = setInterval(function() {
        $("code").html(count);
         pasue_check = true;
        if (count==5) {
            player_ended();
        }
         count++
    }, 1000);

}


function player_resume() {
   if(pasue_check== true) {
     clearInterval(countInterval);
     pasue_check = false;
    }
}

Live test : http://jsfiddle.net/973gT/

I try to use setInterval & clearInterval , but it dosen´t work so good when i counting & pause counting.

Sometime it doble count like 2-4-6 … or cant clearInterval

Can some one help me, what i did fail ?

  • 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-10T23:26:23+00:00Added an answer on June 10, 2026 at 11:26 pm

    The player.ready listener is added inside player_play, which means that the second time, play is pressed, all the event listeners will be bound once more. Because of this, player_pause is bound twice to the pause event, so that two intervals are started, after the second pause.

    If you extract the player.ready listener to be added at DOMReady rather than at each player_play, you will get rid of this problem.

    Demo

    Another issue is that you’re setting pasue_check (which is misspelled, but at least consistently so) to true within the interval. You would be better off setting this before the interval, because as it is right now, there will be a one second delay from the click of the pause button, until the pasue_check is true. If resume is clicked before that second has elapsed, then clearInterval will not execute. So move that out of the interval as well.

    Demo

    The reason your video is auto-playing, is that you’re calling .play() upon player.ready. Remove that if that’s not what you want.

    Demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

HTML: <video class=0 autoplay=true width=586px height=440 src=></video> JS: $('video').mediaelementplayer(); if($('video').attr('class') == 0){ $('video')[0].player.pause(); }
<!DOCTYPE HTML> <html> <body> <video width=320 height=240 controls=controls> <source src=tutorial.mp4 type=video/mp4 /> Your browser
so i have the two following iframe codes: <iframe title=YouTube video player class=youtube-player type=text/html
<iframe class=youtube-player type=text/html src=http://www.youtube.com/embed/JW5meKfy3fY?wmode=opaque&autohide=1&autoplay=1&volume=0&vol=0&mute=1 frameborder=0>&lt;br /&gt;</iframe> The video isn't muted! I want volume to
I've been building a customised video player with HTML and I've run into a
Question I have video player chrome buttons designed with HTML/CSS. The full screen button
I am getting error while streaming video <html> <body> <div id='container'>The player will be
So, using a HTML 5 compliant video player, (like Video JS) how would one
Here is a part of my html code (video urls marked with a django-template
Live streaming video in html 5 - what is required from server to stream

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.