playing short sound files without controls on the page

Discussion in 'Javascript' started by laredotornado@zipmail.com, Feb 2, 2007.

  1. Guest

    Hi,

    Is there a cross-browser way to play short (< 25K) sound files without
    spawning new windows or embedding any visual controls on the page? I
    would like to click a button and hear my short sound.

    Thanks for your help, - Dave

    ps - Searching Google turned up stuff for Netsacpe and IE 3, but I was
    hoping more for IE 7 and Firefox.
     
    , Feb 2, 2007
    #1
    1. Advertising

  2. getburl Guest

    On Feb 2, 8:35 am, ""
    <> wrote:
    > Hi,
    >
    > Is there a cross-browser way to play short (< 25K) sound files without
    > spawning new windows or embedding any visual controls on the page? I
    > would like to click a button and hear my short sound.
    >
    > Thanks for your help, - Dave
    >
    > ps - Searching Google turned up stuff for Netsacpe and IE 3, but I was
    > hoping more for IE 7 and Firefox.


    Hey Dave,

    The easiest way is to attach an 'embed' element and then change the
    src attribute. This willl load the file at that time and play it when
    it is loaded.

    I also wrote a small sound class for a particular need I had. I posted
    it here http://adambragg.blogspot.com/

    getburl
     
    getburl, Feb 2, 2007
    #2
    1. Advertising

  3. Guest

    On Feb 2, 11:18 am, "getburl" <> wrote:
    > On Feb 2, 8:35 am, ""
    >
    > <> wrote:
    > > Hi,

    >
    > > Is there a cross-browser way to play short (< 25K) sound files without
    > > spawning new windows or embedding any visual controls on the page? I
    > > would like to click a button and hear my short sound.

    >
    > > Thanks for your help, - Dave

    >
    > > ps - Searching Google turned up stuff for Netsacpe and IE 3, but I was
    > > hoping more for IE 7 and Firefox.

    >
    > Hey Dave,
    >
    > The easiest way is to attach an 'embed' element and then change the
    > src attribute. This willl load the file at that time and play it when
    > it is loaded.
    >
    > I also wrote a small sound class for a particular need I had. I posted
    > it herehttp://adambragg.blogspot.com/
    >
    > getburl


    Thanks for posting this. This is a very cleanly written class. I do
    have one question. is calling the "draw" function the equivalent of
    calling play? So, if someone clicked on a button labeled "Play",
    would the right JS be

    var s = new Sound();
    s.initialize('/path/to/my/sound', null, 'arbitraryId');
    s.draw();

    ?

    Thanks again, - Dave
     
    , Feb 2, 2007
    #3
  4. getburl Guest

    On Feb 2, 1:39 pm, ""
    <> wrote:
    > On Feb 2, 11:18 am, "getburl" <> wrote:
    >
    >
    >
    >
    >
    > > On Feb 2, 8:35 am, ""

    >
    > > <> wrote:
    > > > Hi,

    >
    > > > Is there a cross-browser way to play short (< 25K) sound files without
    > > > spawning new windows or embedding any visual controls on the page? I
    > > > would like to click a button and hear my short sound.

    >
    > > > Thanks for your help, - Dave

    >
    > > > ps - Searching Google turned up stuff for Netsacpe and IE 3, but I was
    > > > hoping more for IE 7 and Firefox.

    >
    > > Hey Dave,

    >
    > > The easiest way is to attach an 'embed' element and then change the
    > > src attribute. This willl load the file at that time and play it when
    > > it is loaded.

    >
    > > I also wrote a small sound class for a particular need I had. I posted
    > > it herehttp://adambragg.blogspot.com/

    >
    > > getburl

    >
    > Thanks for posting this. This is a very cleanly written class. I do
    > have one question. is calling the "draw" function the equivalent of
    > calling play? So, if someone clicked on a button labeled "Play",
    > would the right JS be
    >
    > var s = new Sound();
    > s.initialize('/path/to/my/sound', null, 'arbitraryId');
    > s.draw();
    >
    > ?
    >
    > Thanks again, - Dave- Hide quoted text -
    >
    > - Show quoted text -


    Sort of. I called it draw because that is more literal. Render would
    be even more literal because the DOM element is being inserted into
    the DOM of the page. So, the element is being drawn or rendered on the
    page. Then there is load time until the sound plays. So, you could
    rename it to play if that is more intuitive. Very good point. I may
    have to change that.
     
    getburl, Feb 2, 2007
    #4
  5. getburl Guest

    On Feb 2, 1:39 pm, ""
    <> wrote:
    > On Feb 2, 11:18 am, "getburl" <> wrote:
    >
    >
    >
    >
    >
    > > On Feb 2, 8:35 am, ""

    >
    > > <> wrote:
    > > > Hi,

    >
    > > > Is there a cross-browser way to play short (< 25K) sound files without
    > > > spawning new windows or embedding any visual controls on the page? I
    > > > would like to click a button and hear my short sound.

    >
    > > > Thanks for your help, - Dave

    >
    > > > ps - Searching Google turned up stuff for Netsacpe and IE 3, but I was
    > > > hoping more for IE 7 and Firefox.

    >
    > > Hey Dave,

    >
    > > The easiest way is to attach an 'embed' element and then change the
    > > src attribute. This willl load the file at that time and play it when
    > > it is loaded.

    >
    > > I also wrote a small sound class for a particular need I had. I posted
    > > it herehttp://adambragg.blogspot.com/

    >
    > > getburl

    >
    > Thanks for posting this. This is a very cleanly written class. I do
    > have one question. is calling the "draw" function the equivalent of
    > calling play? So, if someone clicked on a button labeled "Play",
    > would the right JS be
    >
    > var s = new Sound();
    > s.initialize('/path/to/my/sound', null, 'arbitraryId');
    > s.draw();
    >
    > ?
    >
    > Thanks again, - Dave- Hide quoted text -
    >
    > - Show quoted text -


    I did not read your code quite as well as I should have. The correct
    instantiation would be:

    var s = new Sound('/path/to/my/sound', null, 'arbitraryId'); //
    initialization is implicit when the object is instantiated
    s.draw();
     
    getburl, Feb 2, 2007
    #5
  6. Guest

    On Feb 2, 5:24 pm, "getburl" <> wrote:
    > On Feb 2, 1:39 pm, ""
    >
    >
    >
    > <> wrote:
    > > On Feb 2, 11:18 am, "getburl" <> wrote:

    >
    > > > On Feb 2, 8:35 am, ""

    >
    > > > <> wrote:
    > > > > Hi,

    >
    > > > > Is there a cross-browser way to play short (< 25K) sound files without
    > > > > spawning new windows or embedding any visual controls on the page? I
    > > > > would like to click a button and hear my short sound.

    >
    > > > > Thanks for your help, - Dave

    >
    > > > > ps - Searching Google turned up stuff for Netsacpe and IE 3, but I was
    > > > > hoping more for IE 7 and Firefox.

    >
    > > > Hey Dave,

    >
    > > > The easiest way is to attach an 'embed' element and then change the
    > > > src attribute. This willl load the file at that time and play it when
    > > > it is loaded.

    >
    > > > I also wrote a small sound class for a particular need I had. I posted
    > > > it herehttp://adambragg.blogspot.com/

    >
    > > > getburl

    >
    > > Thanks for posting this. This is a very cleanly written class. I do
    > > have one question. is calling the "draw" function the equivalent of
    > > calling play? So, if someone clicked on a button labeled "Play",
    > > would the right JS be

    >
    > > var s = new Sound();
    > > s.initialize('/path/to/my/sound', null, 'arbitraryId');
    > > s.draw();

    >
    > > ?

    >
    > > Thanks again, - Dave- Hide quoted text -

    >
    > > - Show quoted text -

    >
    > I did not read your code quite as well as I should have. The correct
    > instantiation would be:
    >
    > var s = new Sound('/path/to/my/sound', null, 'arbitraryId'); //
    > initialization is implicit when the object is instantiated
    > s.draw();


    Thanks. Just one more thing. When I load this script in the latest
    version of Firefox on the PC, I'm getting a "Class is not defined"
    error, supposedly referring to the line

    var Sound = Class.create();

    Was there something else I was supposed to include in addition to the
    lines posted on your blog?

    - Dave
     
    , Feb 2, 2007
    #6
  7. getburl Guest

    On Feb 2, 3:48 pm, ""
    <> wrote:
    > On Feb 2, 5:24 pm, "getburl" <> wrote:
    >
    >
    >
    >
    >
    > > On Feb 2, 1:39 pm, ""

    >
    > > <> wrote:
    > > > On Feb 2, 11:18 am, "getburl" <> wrote:

    >
    > > > > On Feb 2, 8:35 am, ""

    >
    > > > > <> wrote:
    > > > > > Hi,

    >
    > > > > > Is there a cross-browser way to play short (< 25K) sound files without
    > > > > > spawning new windows or embedding any visual controls on the page? I
    > > > > > would like to click a button and hear my short sound.

    >
    > > > > > Thanks for your help, - Dave

    >
    > > > > > ps - Searching Google turned up stuff for Netsacpe and IE 3, but I was
    > > > > > hoping more for IE 7 and Firefox.

    >
    > > > > Hey Dave,

    >
    > > > > The easiest way is to attach an 'embed' element and then change the
    > > > > src attribute. This willl load the file at that time and play it when
    > > > > it is loaded.

    >
    > > > > I also wrote a small sound class for a particular need I had. I posted
    > > > > it herehttp://adambragg.blogspot.com/

    >
    > > > > getburl

    >
    > > > Thanks for posting this. This is a very cleanly written class. I do
    > > > have one question. is calling the "draw" function the equivalent of
    > > > calling play? So, if someone clicked on a button labeled "Play",
    > > > would the right JS be

    >
    > > > var s = new Sound();
    > > > s.initialize('/path/to/my/sound', null, 'arbitraryId');
    > > > s.draw();

    >
    > > > ?

    >
    > > > Thanks again, - Dave- Hide quoted text -

    >
    > > > - Show quoted text -

    >
    > > I did not read your code quite as well as I should have. The correct
    > > instantiation would be:

    >
    > > var s = new Sound('/path/to/my/sound', null, 'arbitraryId'); //
    > > initialization is implicit when the object is instantiated
    > > s.draw();

    >
    > Thanks. Just one more thing. When I load this script in the latest
    > version of Firefox on the PC, I'm getting a "Class is not defined"
    > error, supposedly referring to the line
    >
    > var Sound = Class.create();
    >
    > Was there something else I was supposed to include in addition to the
    > lines posted on your blog?
    >
    > - Dave- Hide quoted text -
    >
    > - Show quoted text -


    Hey Dave,

    Yes, the class is based on the Prototype Framework found at http://
    prototypejs.org/
    The Sound class I wrote could be ported to a standalone class. I wrote
    it based on Prototype out of my own specific need.

    getburl
     
    getburl, Feb 3, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ron Clarke

    Sound lost when playing AVI files

    Ron Clarke, Feb 24, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    360
    Ron Clarke
    Feb 24, 2004
  2. Christian Kremser

    Problem with playing sound files

    Christian Kremser, Mar 8, 2005, in forum: Java
    Replies:
    1
    Views:
    360
    Knute Johnson
    Mar 9, 2005
  3. Replies:
    0
    Views:
    561
  4. fuli open

    Playing Sound Files

    fuli open, Mar 25, 2007, in forum: HTML
    Replies:
    4
    Views:
    470
    =?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=
    Mar 26, 2007
  5. Ravi

    Playing sound files

    Ravi, Apr 6, 2008, in forum: Java
    Replies:
    8
    Views:
    442
    Michael Jung
    Apr 8, 2008
Loading...

Share This Page