Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Rewinding and/or seeking html5 video raises INDEX_SIZE_ERR



  • I'm writing an application using Qt 4.7 and QtWebKit that displays a video. I'd like to add a stop button that stops the video and rewinds to the beginning. Whenever I try to set the video currentTime = 0.0 it raises an INDEX_SIZE_ERR exception. I can read currentTime just fine and the values are correct and I can also pause / play the video however any attempt to seek the video, even back to the beginning, fails.

    Here is the relevant code:

    @
    <video id="lionvideo" src="video/lion.mpeg" preload="auto">Foo</video>

    <script>
    function playPause() {
    var myVideo = document.getElementsByTagName('video')[0];
    if (myVideo.paused)
    myVideo.play();
    else
    myVideo.pause();
    }

    function rewindVideo() {
    var myVideo = document.getElementsByTagName('video')[0];
    try {
    myVideo.currentTime = 0.0;
    }
    catch (err) {
    alert('Error: ' + err);
    }

    </script>

    <input type=button onclick="playPause()" value="Play/Pause">
    <input type=button onclick="rewindVideo()" value="Rewind">
    @
    The video is being loaded from a local file on my hard drive and has had plenty of time to load.

    Thank you for your help.


Log in to reply