title: How can I play only those videos where current time is greater than start time using java script?
body: <p>Unable to retrieve and play the videos</p>
  
  <pre><code>&lt;video id="media-video" width="600" height="300" src="http://localhost/CastingGallery/upload/2/php.mp4"&gt;        
  &lt;source class="" src="http://localhost/CastingGallery/upload/2/marimatrubhasha.mp4" id="videosource" type="video/mp4" startat="00:00:00" endat="00:04:07" name="Gujarati Bhasha" description="This is Gujarati Video"&gt;                  
  &lt;source class="active" src="http://localhost/CastingGallery/upload/2/php.mp4" id="videosource" type="video/mp4" startat="00:04:07" endat="00:19:06" name="PHP Video" description="This is PHP Video"&gt;
  &lt;/video&gt;
  </code></pre>
  
  <p>I want to fetch only those videos where current time is greater than the start time of that video </p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
      var mediaPlayer = document.getElementById('media-video');
      var videoSource = mediaPlayer.getElementsByTagName('source');   
      var d=new Date();
      var hh=d.getHours();
      var mm=d.getMinutes();
      var ss=d.getSeconds();
      var currentTime=hh+':'+mm+':'+ss
      console.log('current time is '+currentTime);
      var a=currentTime.split(':');       
      var getStartTime=document.getElementById('videosource').getAttribute('startat');        
      if(currentTime &gt;= getStartTime)
      {   
          var a=currentTime.split(':');
          var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);           
          mediaPlayer.currentTime=seconds;        
          mediaPlayer.play();
      }       
      }); 
     &lt;/script&gt;
  </code></pre>