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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:08:14+00:00 2026-06-16T21:08:14+00:00

I am creating a video player which relies on loading both the vimeo and

  • 0

I am creating a video player which relies on loading both the vimeo and youtube playlist apis through ajax. Once they are loaded, for youtube I then need to loop through all the videos in the playlist and call the data api for each video to get its modified date. Once all vimeo videos are loaded and all youtube videos are loaded and have their creation dates, I need to sort them using jquery.

I’m looking for the best way to detect when these processes have been done, and the problem is I can’t really start the sort until both the vimeo functions and the youtube functions have been completed. The best thing I could come up with was to run a setInterval function which checks on the status of two boolean flags – for example:

var youtubeReady = false, vimeoReady = false;
var videoStatusInterval = setInterval("checkVideoStatus",1000);

function checkVideoStatus(){
  if (youtubeReady === true && vimeoReady === true){
    sortVideos();
  }
}

The problem is that this would run only periodically (every second in the example) – and it seems like there should be a way to do this instantaneously once both conditions are met. Anyone have any ideas?

  • 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-16T21:08:15+00:00Added an answer on June 16, 2026 at 9:08 pm

    I am not familiar with Youtube’s API nor Vimeo, but maybe they have a ‘ready’, ‘done’ or ‘loaded’ event that you can listen two, then, in the handler that you set, you set the two flags, so that, if both are true, then you execute, something like this:

        //Let's createa a couple of custome events to simulate the real ones, comming from Youtube and Vimeo.
    var youtube = document.createEvent('Event'),
        vimeo  = document.createEvent('Event');
    
    youtube.initEvent('youtubeReady');
    vimeo.initEvent('vimeoReady');
    
    /*
    * This function will be use to run YOUR code, ONCE BOTH events are triggered.
    * As said, functions are objects so, as any object in JS, you can add fields at any time you want.
    * Check this page in Mozilla's Developer Network for more detail:  http://goo.gl/Pdvpk */
    function sourcesReady(){
      if(sourcesReady.youtube && sourcesReady.vimeo){
            alert('Both sources ready!');
      }
      else if(sourcesReady.youtube){ 
        alert('Only Youtube ready!');
      }
      else if(sourcesReady.vimeo){ 
        alert('Only Vimeo ready!');
      }
    }
    
    //Let's set a couple of event handlers for the 'ready' events, these handlers will set the flags that we need.
    document.addEventListener('youtubeReady', function youtubeReadyHandler(){
      sourcesReady.youtube = true; //We set/create the field in the function, that is, the function ITSELF has the field, not the 'this'.
      sourcesReady(); //We call it to evaluate the condition.
    }, true);
    
    document.addEventListener('vimeoReady', function vimeoReadyHandler(){
      sourcesReady.vimeo = true; //same as before.
      sourcesReady(); //We call it to evaluate the condition.
    }, true);
    
    document.dispatchEvent(youtube);
    document.dispatchEvent(vimeo);
    

    Hope this suggestion helps. =)

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

Sidebar

Related Questions

i am having problem in creating a video player in flash via as3, the
Core video experts, I'm creating a custom video player for .mov files. I have
I'm creating a flex-based video player, using the FLVPlayback component (imported from Flash Pro
I am using media player to play audio and video. I am creating own
I am creating a video recorder and would like to create video player to
I'm creating an OS X application, and I have a video player in a
I am creating a music player which uses the spacebar to pause and play
I am creating a video player if Phonon and Qt. everything is working fine,
Greeting, I'm creating a video player with silverlight 4 and C#. the player is
I have been searching around for any info on creating a video player. Here

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.