Playback Rate for Video

0 favourites
  • 14 posts
From the Asset Store
Add SubRip (SRT) subtitles to your videos in Construct 3
  • Ayy,

    I was curious, is there a "playback rate" for the video plugin? Is it possible to expose this via scripting?

    I'm making a lil rhythm game, and the audio playback rate can be adjusted to change the difficulty of the song. The backgrounds are sometimes muted videos, but I can't think of a workaround to get the video to play faster/slower.

  • I added it as a behavior once in C2, never tried it on C3 though I don't think there will be an issue with it.

    Basically the video plugin is an html5 video object, so every property should be accessible, even if not mapped by the plugin.

    For speed use this.inst.video.playbackRate

  • Here is the full list of all the properties:

    w3schools.com/tags/ref_av_dom.asp

  • Hey, thanks for the idea! I'll give it a try when I get home.

    I lack javascript knowledge and was reading about the Audio API, and I assumed it would work similarly with Video. I will find out later!

  • Perhaps it's my lack of understanding of Javascript, but I can't get this to work - Infact I can't get any of the video properties to change, including "Volume" or "currentTime".

    let inst = runtime.objects.Video.getFirstInstance();
    inst.x = 200;
    inst.currentTime = 0;
    

    If I do that, I see the Video get moved to X=200 which is good and proves it is picking the Video object fine, but I can't seem to change any properties of the video (I've also tried inst.Volume = 0 ).

    I should really re-read Ashley's in-depth Javascript tutorial to understand this better, but as I was so close with successfully setting the X position of the Video object, it must mean I am REALLY close to being able to set the playbackRate.

    My next method to try and figure this out, is to try and do something with the Audio plugin, as I remember reading about the "audioContext" stuff.

    Could it be that Video is not scriptable as of now in C3? If so, is that the same for many plugins? Do the devs of C3 need to expose each and every property for each plugin? I ask, as I want to try to understand if this is more "Scripting unlocks almost 100% freedom" or "Scripting requires the C3 devs to implement what you need".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As far as I know and I might be wrong, but scripting only lets you access features that were implement in the original plugin/behavior and even then not all are accessible, Scirra are adding support for more and more access all the time.

    You would need to create a behavior that will expand the video plugin

    Then you can probably add scripting access to it too.

    Honestly I haven't created any C3 plugins or behaviors yet (only C2), so I can't guide you on how to do it.

    This is the behavior I created that adds the playbackrate action in C2:

    http://headbangames.com/hb_video_extras.zip

    I know that there is a plugin convertor, maybe you can check it out.

  • Ahh I follow - Thank you for the information and resources, I greatly appreciate it!!

  • It's like, so reachable, yet so out of reach haha...

    Like, perhaps I could convert the plugin from C2 to C3 and figure out how to fix it if it's broken and everything. But then I'm thinking "All of this, for 1 variable to be exposed for the Video plugin", a crucial variable that I require for my project, yeah, but... what if the Video plugin got an update/fix in future, then my plugin would be borked and I'd have to maintain it, all just to have control over playback rate lol.

    I understand I can't just download the current C3 Video plugin and try to add the lines in for playbackRate either.

    I also know I could post as a suggestion, but seems like few people would upvote something like this. And also, checking the suggestion topic, I guess it's soon to be renewed to 22H1, as it's still currently on 21H2.

    I'm kinda like... what do I do?

    I want to politely request to Scirra if this would be a quick task to add in to the Video plugin, but then it's the whole predicament of "Is this a minor addition?", and if everyone starts spamming the forum for their small requests, then problems happen again.

    All this headache to make speedy videos lol. Hmm.

  • I hear ya.

    You can try asking in the forum, maybe someone can help you with the conversion. I guess some users already went through the process.

    Since it's just one action and no external scripts or any other complications, it should be a quick task.

    And sure also post it as a suggestion, it seems like a fairly reasonable request and it doesn't cost you anything :)

    Oh and I don't think you should worry about future changes to the video plugin, the playbackrate is a standard html5 media property and I doubt that's going to change.

  • Setting the playback rate is a straightforward addition for the video plugin, so I've added it for the next beta cycle.

  • Thank you Ashley, I really appreciate it!!

    Perhaps I should have just simply asked from the start, considering that it seemed like a "feature that simply needs to be exposed".

  • Ayy, uhm, no expectations, but was this forgotten in the latest beta?

  • By "next beta cycle" I mean "the first beta release after the next stable release". We aim to minimise changes in the run-up to a stable release to ensure a smooth release.

  • Oh I understand now. Yeah I can imagine unpredictable things happening even when adding something seemingly small. Thanks!

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