C2 Video Plugin to support "controls" and "track"

0 favourites
  • 1 posts
From the Asset Store
8-bit retro-style music and sound effects: 10 loops-able music tracks and 301 individual SFX!
  • There are 3 small enhancements I'd like to suggest for the Video HTML5 exporter plugin.

    The first one allows to programmatically add the Controls with options: No|When Requires Touch|Always

    The second attaches a VTT file for Close Captioning

    The third one allows you to define a thumbnail, by setting the 'poster" attribute of the HTML5 Video element to a picture

    Changes are very easy. Please consider adding these 2 features in a future release of Construct2

    Hugo

    1- design time JS, add the following properties

    new cr.Property(ept_text, "Track File (*.vtt) ", "", "Standard VTT track file for the video. See "),

    new cr.Property(ept_combo, "Controls", "No", "Add controls to the video.", "No|When Requires Touch|Always"),

    new cr.Property(ept_text, "Poster File (*.png | *.gif) ", "", "Poster file used as thumbnail "),

    2- runtime.js in instanceproto.onCreate= function(){ (Add around line 220)

    if (this.video.hasAttribute("controls") && this.properties[7]==0){

    this.video.removeAttribute("controls");

    }

    if (!this.video.hasAttribute("controls") && this.properties[7]==2){

    this.video.setAttribute("controls", "true");

    }

    if (!this.video.hasAttribute("controls") && this.properties[7]==1 && this.useNextTouchWorkaround){

    this.video.setAttribute("controls", "true");

    }

    if (this.properties[6]){

    var track = document.createElement("track");

    track.src = this.properties[6];

    track.kind="subtitles";

    track.label="English subtitles"

    track.srclang="en"

    //track.default="default";

    this.video.appendChild(track);

    }

    if (this.properties[8]){

    if (this.video.hasAttribute("poster") ){

    this.video.removeAttribute("poster");

    }

    this.video.setAttribute("poster", properties[8]);

    }

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)