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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:25:07+00:00 2026-06-18T07:25:07+00:00

I got the following jsfiddle , which basically has 2 imgs and 2 iframes.

  • 0

I got the following jsfiddle, which basically has 2 imgs and 2 iframes.
each img and iframe are in a different div (as pair).

the iframe is hidden while the img is not.
When you click on the img, the img disappear, and the iframe become visible instead (and starts immediately to play the video)

if I click on the second img, the first one should be visible again instead of the iframe, and the video should pause, while the video of the second one starts to play

my fiddle above works as I want just for the first 2 occurrences, after that I get an error:

Error: TypeError: player.pauseVideo is not a function

and the video doesnt play.

desperate for help, tried for about 7 hours with no luck.
Thank you!

  • 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-18T07:25:09+00:00Added an answer on June 18, 2026 at 7:25 am

    Solved it by adding the player when click on the img, then check if player exist for this img, if exist play the existent

    if (typeof players[index] == 'undefined') {
        players.push(new YT.Player(iframe[0], {
            events: {
                'onReady': function (event) {
                    event.target.playVideo();
                }
            }
        }));
    } else {
        players[index].seekTo(0).playVideo();
    }
    

    jsfiddle

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

Sidebar

Related Questions

I've got the following... http://jsfiddle.net/yUVF4/3/ Basically it's just a form which when the button
All, I've got the following JS Fiddle: http://jsfiddle.net/HHtBX/11/ I'm trying to basically close all
I've got following problem: (c#) There is some class (IRC bot), which has method,
I've got the following code (which you can see in play at http://jsfiddle.net/5dbZx/ ).
I've got the following problem (test version available http://jsfiddle.net/qmP8R/2/ ): I have two <div>
I got following markup twice on the page with different id for each .option
I've got following method in a class, which is a custom adapter for an
I've got following bash script to do something for each parameter of the script
I got following question on an interview: Which SQL mechanisms allow user to browse
I got following example Backbone.View : var View = Backbone.View.extend({ tagName: "div", className: "advertisement",

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.