Steven Ferrino

Technical SEO / PHP Developer

  • Home
  • SEO
  • Local Search
  • PHP
You are here: Home / Random / CloudPlayer Pro Stopping Video

CloudPlayer Pro Stopping Video

July 24, 2013 by Steven Leave a Comment

Are you needing to stop (or start) a Cloud Player Pro video with JavaScript?

I was! The problem is that the Player Id changes on every refresh of the page. This means that the first order of business is to get the variable ID, then invoke the stop() , or start() functions.

The easiest way I found around doing this is to use the jQuery each() function to step through all the div’s to find the Cloud Player div.

Then you just have to use that ID within the Global window[].

 

jQuery(document).ready(function() { 

  jQuery("div").each(function() {
    if ( jQuery(this).attr("id") && jQuery(this).attr("id").substr(0, 11) == "CloudPlayer" ) {
      CloudPlayerId = jQuery(this).attr("id");
      return false;
    }
  });

  jQuery("#UIYour-Button").on("click", function() {
    window["player" + CloudPlayerId].stop();
  });

});

Filed Under: Random

Steven Ferrino

Recent Posts

  • Google Core March 2023 Not Just E-A-T
  • [Fix] – Jupiter Theme: /jupiter/dynamic-styles/global/header.php on line 346
  • Laravel 5.4: SQLSTATE[42000]: Password_resets – [Solution]
  • Restrict wp-login.php Access With Htaccess
  • Reading CSV Data and Ignoring NA’s

Blogroll

  • Microdata Generator

Profiles

  • LinkedIn
  • Twitter

Copyright © 2023 · Dynamik-Gen on Genesis Framework · WordPress · Log in