视频在Aura Components中结束后如何启用按钮?

时间:2020-07-10 18:06:42

标签: javascript salesforce salesforce-lightning lwc trailblazer

因此,我需要在视频播放结束后启用关闭按钮。我看了一下render方法,但是我遇到了麻烦,希望能提供帮助

//Helper

addListeners: function(component, event) {
  var cmp = component.find("video").get("v.value");
  cmp.getElement().addEventListener('ended', videoEndHandler, false);

  function videoEndHandler(e) {
    console.log("opaaaaaaaaaa");
  }
}

//Renderer
({
    afterRender: function (component, helper) {
        var afterRend = this.superAfterRender();
        
        helper.addListeners(component)
        return afterRend;
    },
})
<aura:handler name="render" value="{!this}" action="{!c.onRender}" />

<!-- Modal Body -->
<div>
  <aura:if isTrue="{!v.profile == '00ef4000000lYoJAAU'}">
    <div class="slds-modal__content slds-p-around_medium">
      <section class="slds-align_absolute-center" style="height:auto">
        <iframe id='video' src="https://player.vimeo.com/video/398893657" width="640" height="283" frameborder="0" allow="fullscreen"></iframe>
      </section>
    </div>
  </aura:if>

0 个答案:

没有答案