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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:48:50+00:00 2026-06-12T07:48:50+00:00

Question in reference to : http://jsfiddle.net/yusaf/VVEY9/55/ When the video player state has changed so

  • 0

Question in reference to : http://jsfiddle.net/yusaf/VVEY9/55/

When the video player state has changed so that onStateChange(0) ie the video has ended, how would I hide the .pause element and add a replay button to start the video over and once restarted show the .pause element

<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/2Qj8PhxSnhg&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2Qj8PhxSnhg&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>

<a class="play" href="#">play</a>
<a class="pause" href="#">pause</a>
<a class="replay" href="#">replay</a>



$(document).ready(function(){
 var obj = $('object')
     .wrap('<div id="test"></div>')
     .find('embed').attr('src', function(i,s){return s+'&enablejsapi=1&version=3'}).end()
     .find('param[name=movie]').attr('value', function(i,v){return v+'&enablejsapi=1&version=3'}).end()
     .detach()
     .appendTo($('#test'));
    $('.pause').hide();

 $('.play').click(function(){
  obj.find('embed')[0].playVideo();
  $(".pause").show();
  $(".play").hide();   
 });
 $('.pause').click(function(){
  obj.find('embed')[0].pauseVideo();
    $(".pause").hide();
  $(".play").show();
 })
});
$('.replay').click(function(){
  obj.find('embed')[0].playVideo();  
 });
  • 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-12T07:48:52+00:00Added an answer on June 12, 2026 at 7:48 am

    First of all, you will need to use Youtube API either iframe or flash. Why? simply because your current code is not crossbrowser compliant. And also there are plenty of methods and helpers to use there.

    Secondly, you can assign a onPlayerStateChange function using one of the mentioned APIs, which will be called when video ends (on iframe api you can use some predefined constants such as YT.PlayerState.ENDED

    Check a demo out at http://code.google.com/apis/ajax/playground/#polling_the_player

    The code should look similar to:

    function onPlayerStateChange(evt) {
        if (evt.data == YT.PlayerState.ENDED) {
              // do your jQuery login to hide and blah blah here.
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this fiddle which has an error --> http://jsfiddle.net/Osoascam/AkZZr/6/ (This is the version
I have a question with reference to this tutorial http://rox-xmlrpc.sourceforge.net/niotut/ In the read method
This question is in reference to the API documentation link, http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/barcodelib/BarcodeBitmap.html They specify that
I have a question about the dictionary in python, in the reference page: http://docs.python.org/tutorial/datastructures.html#dictionaries
I have a quick question in reference to changing an RSS url http://www.bellyscarf.com/rsscategoryproducts.sc?categoryId=6 As
In reference with this question We have a header with a date picked component
With reference to the question I asked couple of days back, it seems to
Reference: This is a self-answered question. It was meant to share the knowledge, Q&A
In reference to this answer to a Stack Overflow question : what is bench-testing
With the reference to this question:- JavaScript -Change CSS color for 5 seconds Working

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.