www.webdeveloper.com
Results 1 to 3 of 3

Thread: Creating an Audio Controller

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Location
    Georgia
    Posts
    155

    Creating an Audio Controller

    Hello all!

    I'm doing a little website for my Mom and she wants to have a song that plays when our family goes to it. But she wants them to be able to stop, pause, etc. if they want. So, I was going to just use the code from this site, but I really don't want to use jQuery. Is there anyway to alter that code so it's just Javascript?

    Thanks a million!

    Link from above:

    http://www.position-absolute.com/art...-manipulation/

  2. #2
    Join Date
    Jun 2005
    Location
    Georgia
    Posts
    155
    I don't mean to seem impatient, because I'm not, but no one has any ideas on this? It certainly doesn't have to be a conversion from that jQuery. Anything that functions similarly would be fine. I just want to be able to implement it using just Javascript.

    Thank you!

  3. #3
    Join Date
    Oct 2013
    Posts
    20
    This is how I would do it:

    Code:
    <audio id="player" hidden>
    <source src="Soundfile.ogg" type="audio/ogg">
    <source src="Soundfile.mp3" type="audio/mpeg">
    </audio>
    
    <a href="#" onclick="document.getElementById('player').play()">play</a>
    <a href="#" onclick="document.getElementById('player').pause()">pause</a>
    <a href="#" onclick="document.getElementById('player').play(); document.getElementById('player').currentTime='35'">play at 35 seconds</a>
    <a href="#" onclick="document.getElementById('player').volume='0'">Volume to 0</a>
    <a href="#" onclick="document.getElementById('player').volume='1'">Volume open</a>
    I think that gives you exactly what that other script did.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles