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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:59:52+00:00 2026-06-08T12:59:52+00:00

I have a problem with playing a video in HTML5 and the ended Event.

  • 0

I have a problem with playing a video in HTML5 and the ended Event.
I view some HTML content and after a expired time I play a video. Is the video ended I will show the HTML content again. This should loop. Its for a presentation.

My problem is, that after the first complete run, the ended event will fired repeatedly and the HTML content will displayed false.

Here is the code part:

function playVideo() {
    var video = $('video')[0];
    video.addEventListener('ended', function () {
        $('video').hide();
        fadeShow();
    }, false);
    video.play();  
}

function fadeHide() {
    $('#content').fadeOut(1200, function () {
        $('div ul[id^=item]').each(function () {
            $(this).hide();
        });
        $('li[class^=visitor] span[id]').each(function () {
            $(this).hide();
        });
        playVideo();
    });
}

The fadeHide(); function will not called two times, just the video.addEventListener('ended', function () {}; fill called several times. `fadeshow(); will display the HTML content. Actually I use the newest version of Chrome.

Does anyone have an idea what went wrong?

Edit
HTML video code. I hide the video with css.

<video>
    <source src="video/mp4/xxx.mp4" type="video/mp4" />
    <source src="video/ogg/xxx.ogg" type="video/ogg" />
    <source src="video/webm/xxx.webm" type="video/webm" />
    Your browser does not support the video tag.
</video>

Greetz

  • 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-08T12:59:54+00:00Added an answer on June 8, 2026 at 12:59 pm

    You should assign the event listener once or when you assign it upon play everytime, you need to detach the event listener again.

    function playVideo() {
        var video = $('video')[0];
        video.addEventListener('ended', function () {
            $('video').hide();
            video.removeEventListener('ended'); <<<<<<<
            fadeShow();
        }, false);
        video.play();  
    }
    

    EDIT: I tested in chrome with this fiddle and indeed even if you remove the eventlistener it starts to fire multiple times. It seems there’s an issue that removing the event listener does not work correctly.

    You should change the event binding / unbinding to jQuery then there is only one ended event.

    function playVideo() {
        var video = $('video')[0];
        $('video').bind('ended', function () {
            $('video').unbind('ended');
            $('video').hide();
            fadeShow();
        });
        video.play();  
    }
    

    And your fiddle updated (with shorter video)

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

Sidebar

Related Questions

I have a problem with playing video in mediaplayer. I have a sound but
I'm just playing around with FastMember and have hit a problem. Each time I
I basically have the same problem in this questions: Flash Video still playing in
I'm having some trouble with HTML5 video in IE9. Video (MP4) is playing, but
I have use AVQueuePlayer to play two video at the same time, Now I
In my app i have to play some video files.I also have to play
I have no problem playing the video, just cant seem to get my label
I have a an HTML5 video element that plays and communicates with a some
When I rotate my phone, my Activity restarts. I have a video view playing
I have written this piece of objective-c code for playing a video after touching

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.