Forum Discussion

RussLickteig's avatar
RussLickteig
Community Member
27 days ago

Video Controls. Enable and Disable

Hi.....I know how to "turn on" video controls but I want to be able to turn them on and off with script.  For example I do NOT want them available when someone first comes to a slide with a video on it.  If they revisit that slide later then I want to enable them.  I see things where people cover them but there are issues with that in my case.  Why is this not possible or I'm I just missing something easy?  

3 Replies

  • You could put the video on the base layer with no controls. Then, create a True/False variable called something like "VideoViewed" with a default value of False. Change the variable from false to true when the timeline ends on the slide. Create a layer (for example "video layer") on the slide and add the same video there, with controls on. Create a trigger on the base layer to show the video layer when the timeline starts on the slide if VideoViewed = True. This means that if they ever come back to the slide, they're actually seeing the Video Layer, where the video has controls.


    Example attached.

  • Here's an alternate version of Elizabeth's option that doesn't require two copies of the video. It does use a layer and a "VideoViewed" T/F variable.

    Put the video on the base with the controls.

    Create a layer. Leave it blank, except for a shape that covers the video controls on the base. Here's the important part: set the Slide Layer Properties to prevent the user from clicking on the other layers. That will prevent them from using the video controls on the base.

    On the base, add a trigger that shows the layer when the timeline starts on the slide with the condition that the "VideoViewed" variable = False. 

    Also add a trigger that hides the layer when the media completes (that is, when the video ends). 

    And add a trigger that changes the variable to True when the media completes.

  • RussLickteig's avatar
    RussLickteig
    Community Member

    Thanks for the ideas!!!  I ended up doing a JavaScript option that only requires the one video and it turns off the seek bar. I have "Video1Complete" set to False by default. Video controls are set to on by default.  First time the video is watched the variable is by default False which means the JavaScript shuts off the seek bar. Once "Video1Complete" switches to "True" then the seek bar is available.



    /* Hide the Storyline video playback bar */
    (function hideSeekbar () {
      // search for the root div : <div class="video-seekbar draggable …">
      var seekbar = document.querySelector('.video-seekbar.draggable');
    
      if (seekbar) {
        seekbar.style.display = 'none';          // on la cache
      } else {
        // If it's not yet in the DOM, we'll try again in 150ms.
        setTimeout(hideSeekbar, 150);
      }
    })();