Skip to main content
Inspiring
February 28, 2021
Answered

Audio with javascript + streaming from google drive.

  • February 28, 2021
  • 1 reply
  • 1265 views

1. I have an audio in the library with a linkage of "dude"

2. I use the following code to instantiate and play the audio.

    var audio = new Audio(dude);
    audio.play();

It doesn't work.

3. I need to add 100's-1000's of audio files - (Learning English platform.)

    I would like to host them on google drive and download as necessary. 

    This way I save on traffic to my website. Is that all possible. 

Could you point me in the right direction to learn about streaming audio.

Also, if it's streamed then it won't have a linkage name as it's not in my library so how can I instantiate as needed.

Thanks.

    This topic has been closed for replies.
    Correct answer DeanUtian

    Here's  a video that goes into SoundJS and Animate in more detail.

    https://www.youtube.com/watch?v=bmGJIZo73Zg 

    1 reply

    Community Expert
    February 28, 2021

    To play a sound where the audio is in the library with a linkage column name, I tend to use:  
    createjs.Sound.play("soundNameInLinkageColumn");

    To stop the sound, you could use:
    createjs.Sound.stop();

     

    For external sound, try 
    var myAudio = new Audio('sounds/dude.mp3');
    myAudio.play();


    Where dude.mp3 is in a subfolder called 'sounds' under your published HTML.

    To the other part of your question, if the sound is on a particular URL, you could have:
    var myAudio = new Audio(''https://website.com/dude.mp3');

    I am not sure if it will work with audio hosted on Google Drive. You could test and see.

    DeanUtianCommunity ExpertCorrect answer
    Community Expert
    February 28, 2021

    Here's  a video that goes into SoundJS and Animate in more detail.

    https://www.youtube.com/watch?v=bmGJIZo73Zg 

    Inspiring
    February 28, 2021

    Yep, excellent video - that's going to help me a great deal.

    So just a quick question.

    1 - Can I stream the audios from google drive? I suppose I can.

    2 - Can I still use the auto lipsynch feature so that my avatar mc lips synch with the audio OR do I need to drag audio onto a layer at design time in order to use auto lipsynch?