Topic: Audio continues after video in modal is closed

tom3 pro asked 6 years ago


There seems to be a problem on this page:

https://mdbootstrap.com/components/bootstrap-video/#modal

After the 'close' button is clicked when a video is playing in a modal, the sound continues once the video has disappeared.

The same issue is on this page too:

https://mdbootstrap.com/utilities/bootstrap-embeds/#modal


Marta Wierzbicka staff answered 6 years ago


Hi, we will think about solving this problem in the future and we'll write about this in our documentation. Best, Marta

Marta Wierzbicka staff answered 6 years ago


Hi, this is solution from stackoverflow, you can read more here. Best, Marta

tom3 pro commented 6 years ago

Thanks. I assumed it was an MDB problem, not a more general issue. It might be useful if your sample code for this component included this - I don't suppose anyone would want the sound to carry on once the video modal has been closed. I would be grateful for help with one more issue related to this. If there are multiple modals like this on the same page, this modification of your code seems to work: $('#modal_1,#modal_2').on('hidden.bs.modal', function (e) { $('iframe', this).attr("src", $('iframe', this).attr("src")); }); .. but I still have to enter an id for each modal. Is there a way to capture this dynamically so I don't have to edit these two lines? (It's not very important, but it would be good if it were possible. I've tried to find a way - without success). Thanks, Tom

tom3 pro commented 6 years ago

Thanks Marta.

Marta Wierzbicka staff answered 6 years ago


Hi, try this code: $('#modalYT').on('hidden.bs.modal', function (e) { // do something... $('#modalYT iframe').attr("src", $("#modalYT iframe").attr("src")); }); Best, Marta

tom3 pro commented 6 years ago

Hi Marta, Great - that works . Initially I thought this was just a way to capture the closing of the model - and it would be necessary to add the code to stop the video playing in the background (where you had typed '// do something..'). However, it works just as it is, without any extra code. I'm not sure why - or why you added 'do something'. I've made the modal static (ie so it's actually 'modal') and resized it- and it now works just as I want. Many thanks, Tom

Marta Wierzbicka staff answered 6 years ago


Hi, thank you for noticing this bug, we will fix this soon. Best, Marta

tom3 pro commented 6 years ago

Hi, This is still a problem - eg if you launch a video from a modal in the page referred to above. It doesn't seem to have been fixed in the recent update. The sound continues after the Close button is clicked (and the video continues to play, invisibly), making the feature useless. Do you have a workaround for this until it's fixed? I would very much like to use this feature. Thanks


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags