Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26

Thread: One of Beverley's Audio Players - Add Time

  1. #21
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    509
    Thanks
    9
    Thanked 59 Times in 57 Posts

    Default

    ID's need to be unique...
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  2. #22
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    509
    Thanks
    9
    Thanked 59 Times in 57 Posts

    Default

    Quote Originally Posted by KennyP View Post
    Sorry, I should have mentioned sooner that I had changed the selector from '#timeline-timedisplay' to '#tracktime'

    I used '#tracktime' to be consistent:
    Code:
    <audio id="music" preload="auto">
    	<source src="<?php echo $fname; ?>"/>
    </audio>
    
    <div id="audioplayer">
    	<div id="toggle-wrap" class="play">
    		<button id="toggle"></button>
    	</div>
    	<div class="timeline-wrap">
    		<div id="timeline">
    			<div id="playhead"></div>
      		</div>
    	<div id="tracktime"></div>
        </div>
    </div>
    I tried the code again - unfortunately, it doesn't work.
    Code:
    $('$tracktime').html('width', music.currentTime / music.duration * 100 + '%');
    Shouldnt that be (also note that you are using a $ and not #

    Code:
    $('#timeline').html('width', music.currentTime / music.duration * 100 + '%');
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  3. #23
    Join Date
    Dec 2009
    Location
    NY NY USA
    Posts
    228
    Thanks
    158
    Thanked 1 Time in 1 Post

    Default

    This is what I'm entering and it still doesn't work. What am I doing wrong?

    Code:
     <script>
    
     music.ontimeupdate = function(){
        $('#timeline').html('width', music.currentTime / music.duration * 100 + '%');
        $('#tracktime').html(Math.ceil(music.currentTime) + ' / ' + Math.ceil(music.duration));
      }
    	
    </script>
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Snap1.jpg 
Views:	35 
Size:	33.3 KB 
ID:	6312  

  4. #24
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    509
    Thanks
    9
    Thanked 59 Times in 57 Posts

    Default

    Code:
    $('#timeline').html('width', music.currentTime / music.duration * 100 + '%');
    Should be
    Code:
    $('#timeline').css('width', music.currentTime / music.duration * 100 + '%');
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  5. #25
    Join Date
    Dec 2009
    Location
    NY NY USA
    Posts
    228
    Thanks
    158
    Thanked 1 Time in 1 Post

    Default

    This follolwing still displays in seconds. Plus, it changes the timeline as in the attached screenshot.
    Code:
    <script>
     music.ontimeupdate = function(){
        $('#timeline').css('width', music.currentTime / music.duration * 100 + '%');
        $('#tracktime').html(Math.ceil(music.currentTime) + ' / ' + Math.ceil(music.duration));
      }	
    </script>
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	still-seconds.jpg 
Views:	34 
Size:	31.6 KB 
ID:	6313  

  6. #26
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    509
    Thanks
    9
    Thanked 59 Times in 57 Posts

    Default

    What are you trying to do? Are you trying to convert the seconds to minutes and seconds? If so then you shouldnt need my help with that. That is math calculation related. You just need to take
    Code:
    $('#tracktime').html(Math.ceil(music.currentTime) + ' / ' + Math.ceil(music.duration));
    Remove the other line and convert the Math.ceil into its own vars and calculate seconds and minutes. Hopefully, you know that there are 60 seconds in a min.

    An example:
    Code:
    var tsecs = 232;
    var rsecs = tsecs % 60;
    var rmins = Math.floor(tsecs/60);
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

Similar Threads

  1. Database for players and teams?
    By Exploding Art in forum MySQL and other databases
    Replies: 0
    Last Post: 12-07-2012, 10:27 PM
  2. Replies: 13
    Last Post: 10-16-2012, 02:31 AM
  3. Replies: 5
    Last Post: 10-07-2012, 09:31 AM
  4. flash players
    By d-machine in forum Looking for such a script or service
    Replies: 2
    Last Post: 08-08-2009, 10:41 AM
  5. web players
    By d-machine in forum PHP
    Replies: 2
    Last Post: 06-10-2009, 01:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •