Append audio file to html
-
wrote on 3 Oct 2012, 03:47 last edited by
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.
-
wrote on 3 Oct 2012, 12:26 last edited by
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.
-
wrote on 3 Oct 2012, 13:51 last edited by
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?
-
wrote on 3 Oct 2012, 15:29 last edited by
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/4