4 Replies Latest reply on Dec 2, 2015 2:46 PM by MadMikeGamerXL1

    Audio Only Plays Once

    MadMikeGamerXL1

      Hi,

      I'm creating a subscriber alert for Twitch (a streaming platform for gamers). Basically, I have the animation all playing, and if anyone has ever used Open Broadcaster Software (OBS), I have the animation added to it using CLR Browser.

      It sets text inside my textbox to the username of the subscriber, and plays the animation.. But the problem is the sound I have. When the animation triggers for the first time, the sound plays, but any time after that the audio will not play. To get it to play, I have to stop the preview stream and start it again in OBS each time the animation plays (which is not really possible while streaming to Twitch). I'd rather not have the partnered streamer have to untick the source every time someone subscribes.

       

      I've tested the animation in Chrome (by opening the HTML file), and the sound plays every time, so it's just CLR Browser that doesn't. But every other follow/subscriber alert made for OBS (such as TwitchAlerts) work properly, so it leads me to believe it's something in my project, rather than the OBS plugin. Just in case anyone has experience in the CLR Browser or OBS, I will be able to provide the log. I can't find how to attach the log file, and I don't want to make this message super long for a log if it isn't needed.

      I'll also include the part of my JS script that actually triggers the animation when someone subscribes (obviously because I'm not partnered myself, I can't test when someone subscribes, so I have it checking for a specific message of "1234" at the moment.)

       

      var message = event.data.substring(event.data.indexOf('#madmikegamerxl1 :') + 18, event.data.indexOf('\r'));
              var username = event.data.substring(1, event.data.indexOf("!"));
              if (message.toString() == "1234") {
                  console.log("Someone just subscribed!");
                  AdobeEdge.getComposition("subAnim").getStage().play("subalert");
                  AdobeEdge.getComposition("subAnim").getStage().$("subalert")[0].play();
                  AdobeEdge.getComposition("subAnim").getStage().play("Stage");
                  AdobeEdge.getComposition("subAnim").getStage().play();
                  AdobeEdge.getComposition("subAnim").getStage().$("Text2").html(username);
              }
              console.log("Message received in chat 'madmikegamerxl1' : \r\n" + message);
      

       

       

      Thanks in advance,

      Mike

        • 1. Re: Audio Only Plays Once
          resdesign Adobe Community Professional & MVP

          I am wondering if you should maybe add this before the play() event

           

          AdobeEdge.getComposition("subAnim").getStage().$("subalert")[0].currentTime = 0;

          • 2. Re: Audio Only Plays Once
            MadMikeGamerXL1 Level 1

            resdesign wrote:

             

            I am wondering if you should maybe add this before the play() event

             

            AdobeEdge.getComposition("subAnim").getStage().$("subalert")[0].currentTime = 0;

            Hmm I tried that and still the same thing happens.

            It's really strange that it works in Google Chrome perfectly fine though.

             

            Thanks for the reply

             

            EDIT: I fixed it! It was a very strange problem that the plugin I used mustn't have liked... Basically, after trying the currentTime = 0 statement, it didn't affect anything. I then swapped both the currentTime function and the play() function to the top of the code, just above the .play("stage") line. It must've wanted the audio to play slightly before the stage does, for some strange reason, while Chrome worked either way... Strange! But either way, it's working now. Thank you for the help!

            • 3. Re: Audio Only Plays Once
              resdesign Adobe Community Professional & MVP

              glad you got it to work! Sorry I was not more helpful.

              • 4. Re: Audio Only Plays Once
                MadMikeGamerXL1 Level 1

                resdesign wrote:

                 

                glad you got it to work! Sorry I was not more helpful.

                Don't worry about it, I just appreciate the reply