HTML5 Audio events with QWebView

438 views Asked by At

Trying to get the hooks for the audio tag events in the HTML5 through QtWeKit. For that I created a sample application that just loads a html file through QwebView.

The html file contains a HTML5 audio tag.

<audio id="audio_with_local_controls" controls>
   <source src="nokia-tune.mp3" type="audio/mp3" />
</audio>

In the script side, I'm trying to get the hooks for the audio tag play, pause and ended events.

/// AUDIO TAG EVENTS.

var aid = document.getElementById('audio_with_local_controls');

function onplay_(){
console.log('onplay');
alert('onplay');
}

function oncanplay_(){
console.log('oncanplay');
alert('oncanplay');
}

function onpause_(){
console.log('onpause');
alert('onpause');
}

console.log(aid);

aid.onplay = onplay_;
aid.oncanplay = oncanplay_;
aid.onpause = onpause_;
aid.onprogress = function onprogress_(){ alert('onprogress'); }
aid.onended = function onended_(){ alert('onended'); }
aid.onabort = function onabort_(){ alert('onabort'); }

The code sequence might not make sense as I was trying something up and down in the code. Chrome was able to capture the hooks. But QWebView remains silent on this, nothing gets captured. Is it that QWebView doesn't support this? or Am I writing something wrong?

0

There are 0 answers