Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

MP4 won't play on button click

Valorous Hero ,
Aug 08, 2019 Aug 08, 2019

I'm having issues getting an mp4 to play when I click a button. To simplify troubleshooting I started a new project with a video component and a button component and followed the steps on this page: Components  in Animate

I followed the steps, have everything on frame one, and I'm using the below code. This is taken directly from the example page. The problem is that the video doesn't play when I click the button. It will play if I check "Autoplay" or make the controls visible and use those. I'm trying to figure this out before I integrate it into my actual project and make the video play with those buttons.

For clarity, Animate assigned the instance names "movieClip_2" to the button and "movieClip_3" to my video.

if (!this.movieClip_2_click_cbk) {

     function movieClip_2_click(evt) {

          console.log("Button clicked");

          this.movieClip_3.on("added", function () {

               $("#movieClip_3")[0].play();

          }, this, true);

}

     $("#dom_overlay_container").on("click", "#movieClip_2", movieClip_2_click.bind(this));

     this.movieClip_2_click_cbk = true;

}

182
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 08, 2019 Aug 08, 2019
LATEST

I ended up using the Code Wizard which produced a significantly simpler output, but more importantly, it works!

this.btn1.on('click', function () {

$('#v1')[0].play();

});

That being said, if someone runs across this and could explain to me why the nested snippets didn't work I'd appreciate it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines