Playing sound through the UI

Discussion in 'Mod Support' started by flubbateios, November 4, 2016.

  1. flubbateios

    flubbateios Active Member

    Messages:
    103
    Likes Received:
    240
    I can't seem to play sounds with the HTML5 audio tag or the audio object in js. Iframes only work with youtube.
  2. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Random thought: Maybe it needs to be hosted on a "normal" url. So not some magic coherent link?
  3. flubbateios

    flubbateios Active Member

    Messages:
    103
    Likes Received:
    240
    Tested mp3 on a different url, and also coherent ui url. Neither worked.
  4. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,327
    Likes Received:
    2,125
    I used this script:
    Code:
          at = new Audio();
          if(at.canPlayType("audio/ogg"))
            document.writeln("<p>Can play OGG</p>");
          else
            document.writeln("<p>Cannot play OGG</p>");
          if(at.canPlayType("audio/wav"))
            document.writeln("<p>Can play WAV</p>");
          else
            document.writeln("<p>Cannot play WAV</p>");
          if(at.canPlayType("audio/mp3"))
            document.writeln("<p>Can play MP3</p>");
          else
            document.writeln("<p>Cannot play MP3</p>");
          if(at.canPlayType("audio/flac"))
            document.writeln("<p>Can play FLAC</p>");
          else
            document.writeln("<p>Cannot play FLAC</p>");
    
    and PA reports that it cannot play MP3. It can however play WAV and OGG.
    Also, testing <audio src="test.ogg" controls="true" autoplay="true"></audio> does indeed work. I haven't tried with coui:// links though.
  5. flubbateios

    flubbateios Active Member

    Messages:
    103
    Likes Received:
    240

Share This Page