Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Append audio file to html
Forum Update on Monday, May 27th 2025

Append audio file to html

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    morpe
    wrote on 3 Oct 2012, 03:47 last edited by
    #1

    Hi,

    I used the code below to play audio file but instead of "mMedia->play()", I would like to append the audio file as html tag in a html file. After several search online, I came to the understanding that Qt 4.8 library doesn't support html5 tag and audio tag is part of html5. Can anyone suggest a way around this problem?

    @void MainWindow::InsertAudio()
    {
    Phonon::MediaObject* mMedia = new Phonon::MediaObject(this);
    Phonon::AudioOutput* mAudio = new Phonon::AudioOutput(Phonon::MusicCategory, this);
    Phonon::createPath(mMedia, mAudio);
    mMedia->setCurrentSource(QFileDialog::getOpenFileName(0,QString("Select audio file"),QString()));
    mMedia->play();
    }@

    Thanks.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      butterface
      wrote on 3 Oct 2012, 12:26 last edited by
      #2

      Maybe you can write something like this in your website:

      @
      <html><head><title>Test</title></head>
      <body>
      <embed type="audio/x-midi" autostart="false" src="breeze.mid" width="300" height="200"></embed><br>
      <a >Starten</a>
      </body></html>
      @

      Hope this helps.

      EDIT: The js was removed from the link (please remove spaces)
      java <remove newline>
      script : document . e m b e d s [ 0 ] . p l a y ( )

      Sorry for this stupid formatting but the editor will remove it otherwise.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        morpe
        wrote on 3 Oct 2012, 13:51 last edited by
        #3

        Thank you for your reply. There is no existing website. The Qt application I'm working on is suppose to be wysiwyg html editor and I need to be able to insert audio. The output is suppose to be html. What is your advice on how to achieve this?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          butterface
          wrote on 3 Oct 2012, 15:29 last edited by
          #4

          If you want to play the audio in the wysiwyg you can do it as you described above and for the output you can use the html above. You have to provide the audio file on your webserver then as well of course.

          1 Reply Last reply
          0

          1/4

          3 Oct 2012, 03:47

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved