+ Post New Thread
Results 1 to 5 of 5

Thread: How to play sound, music, intro or speech after website load?

  1. #1
    Administrator
    Join Date
    Mar 2013
    Posts
    2,724

    How to play sound, music, intro or speech after website load?

    Hi,

    do you have good tips on how to auto play music or some sound after a webpage is opened?

    So far i found this code to be working good:

    for mp3
    <audio autoplay>
    <source src="song.mp3" type="audio/mpeg">
    </audio>
    for ogg
    <audio autoplay>
    <source src="song.ogg" type="audio/ogg">
    </audio>
    just add to a webpage code. make sure audio file is in same folder as webpage file, you can also set path like /sounds/song.mp3 ---> source src="/sounds/song.mp3" and that means you need to add your song into yourdomain.com/sounds/ folder.

    Example auto play sound you can find at website: http://hostinghostgatorcoupons.com/
    The voice is created by: http://www.ivona.com/en/ (speaker is: Joey)
    I just let him speak it and being recording by audio recorder software.

  2. #2
    Junior Member Hexajob's Avatar
    Join Date
    Mar 2016
    Location
    Ludhiana
    Posts
    5


    Is this useful / helpfull? Yes | No
    Html 5 offers this facility to play music after loading the website

  3. #3
    Junior Member
    Join Date
    Apr 2016
    Posts
    4


    Is this useful / helpfull? Yes | No
    Html 5 offers this facility
    apis development | application programmers | api application
    Last edited by bondj9433; 04-15-2016 at 05:49 AM.

  4. #4


    Is this useful / helpfull? Yes | No
    Html 5 offers this facility to play music after loading the website

    Sports Prediction

  5. #5
    Member Gimli's Avatar
    Join Date
    Jun 2018
    Location
    South Africa , East London
    Posts
    29


    Is this useful / helpfull? Yes | No
    document.addEventListener('DOMContentLoaded', function() {
    // your code here
    }, false);
    or if your comfort with jquery,

    $(document).ready(function(){
    // your code
    });

    $(document).ready() fires on DOMContent Loaded, but this event is not being fired consistently among browsers. This is why jQuery will most probably implement some heavy workarounds to support all the browsers. And this will make it very difficult to "exactly" simulate the behavior using plain Javascript (but not impossible of course).

    as Jeffrey Sweeney and New Perspective design suggested, i think its better to have a setTimeout function on the website, before firing the function like below :

    setTimeout(function(){
    //your code here
    }, 3000);

+ Post New Thread

Similar Threads

  1. How to optimize website for faster load times?
    By Fli in forum HTML,CSS, Javascript Coding & Programming
    Replies: 1
    Last Post: 06-04-2022, 10:27 AM
  2. Replies: 0
    Last Post: 09-28-2019, 10:21 AM
  3. Sound alert when website is offline?
    By Fli in forum General Webmaster Discussion
    Replies: 0
    Last Post: 12-02-2017, 09:22 PM
  4. How to play AVI or MKV video on website?
    By Fli in forum General Webmaster Discussion
    Replies: 0
    Last Post: 04-17-2014, 02:22 PM
  5. How to minimize load time for any website?
    By shreeharisg in forum General Webmaster Discussion
    Replies: 1
    Last Post: 02-21-2014, 09:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
 Protected by : ZB BLOCK  &  StopForumSpam