Video SetPlaybackTime causes Javascript error

0 favourites
  • 6 posts
From the Asset Store
Add SubRip (SRT) subtitles to your videos in Construct 3
  • Problem Description

    After using the Video.SetPlaybackTime method with the video object, the following error occurs:

    Javascript error

    Uncaught InvalidStateError: Failed to set the "CurrentTime" property on "HTMLMediaElement": The element's

    readyState is HAVE_NOTHING, line 686 (col 3)

    If this method is not used, the video object works fine and plays the video within my game.

    Attach a Capx

    Not needed

    Description of Capx

    N/A

    Steps to Reproduce Bug

    • Use the SetPlaybackTime method with the video object

    Observed Result

    Javascript error displayed (see error in first part of this template). Error doesn't occur if

    the video.setplaybacktime method is removed from the code (video plays normally after

    using video.play method).

    Expected Result

    Video should play back faster than normal (video lasts 2 minutes, but set playback time to 15 seconds for testing purposes)

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (Not Tested)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    Windows 7 Professional, latest service pack

    Construct 2 Version ID

    Construct 2, Release 178 (64 bit)

    OpenGL information: Rendering with OpenGL 4.4.0, with NVidia GTX 770 card (using latest NVidia driver, ver 340.52)

  • Noticed after further researching this error that the problem is that when the js video plugin tries to set the

    video's current time, there's no control to ensure the video is ready (hence the HAVE_NOTHING status which is returned).

    C:\Program Files\Construct 2\exporters\html5\plugins\video\runtime.js :

    Acts.prototype.SetPlaybackTime = function (s)

    {

    this.video.currentTime = s; >> Need to add some control here to only set this property once video information is known

    };

  • You can workaround using "IsPlaying" event. Just set it to "Trigger once" then, set playback time.

  • Thanks onurdogan07, this works fine.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • welcome

  • Closing, a .capx is required or we won't investigate issues. Please submit a new report with a .capx demonstrating the problem as per the guidelines.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)