Topic: JavaScript for Video in Modal

TeddyS31 pro asked 5 years ago


I am trying to understand as to why there is JS code for the video iframe in a modal? Can someone further explain why a JS call would be necessary? snippet below

https://mdbootstrap.com/snippets/jquery/stanowski/250827$

('#modal1').on('hidden.bs.modal', function (e) {
// do something...
$('#modal1 iframe').attr("src", $("#modal1 iframe").attr("src"));
});


Hi, Teddy!

Mentioned part of the code will "reset" the video after you close the modal. After you launch the modal again, the video will start from the 1st second of the movie. Why do we reset the videos? In some cases we had issues with YouTube player - when the modal was closed, the video was still playing so we had the modal closed, but the sound was still hearable, but comes from nowhere :)



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.15
  • Device: Macbook Pro 13
  • Browser: Chrome
  • OS: Mac OS Mojave
  • Provided sample code: Yes
  • Provided link: Yes